diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..85e7c1df --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/AI.php b/AI.php index 34c7dc21..0fa85209 100644 --- a/AI.php +++ b/AI.php @@ -7,234 +7,221 @@ */ -if(isset($_GET['m1'])) { - define('GAME',true); - - setlocale(LC_CTYPE ,"ru_RU.CP1251"); - - include('_incl_data/__config.php'); - include('_incl_data/class/__db_connect.php'); - - $sp = mysql_query('SELECT * FROM `users_recombats` WHERE `email` != "" ORDER BY `name` DESC LIMIT 7000'); - while( $pl = mysql_fetch_array($sp) ) { - echo "
".$pl['email']; - } -}elseif(isset($_GET['bk1'])) { - define('GAME',true); - - setlocale(LC_CTYPE ,"ru_RU.CP1251"); - - include('_incl_data/__config.php'); - include('_incl_data/class/__db_connect.php'); - include('_incl_data/class/__user.php'); - - $ins = 'Вещи БК-1:
'; - $sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1'); - while( $pl = mysql_fetch_array($sp) ) { - - $po = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.$pl['id'].'" LIMIT 1')); - $po = $u->lookStats($po['data']); - - if(!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) { - $po['add_minAtack'] = $po['sv_minAtack']; - $po['add_maxAtack'] = $po['sv_maxAtack']; - } - - $ins .= 'INSERT INTO `items_main` ( +if (isset($_GET['m1'])) { + define('GAME', true); + + setlocale(LC_CTYPE, "ru_RU.CP1251"); + + include_once '_incl_data/__config.php'; + include_once '_incl_data/class/__db_connect.php'; + + $sp = mysql_query('SELECT * FROM `users_recombats` WHERE `email` != "" ORDER BY `name` DESC LIMIT 7000'); + while ($pl = mysql_fetch_array($sp)) { + echo "
" . $pl['email']; + } +} elseif (isset($_GET['bk1'])) { + define('GAME', true); + + setlocale(LC_CTYPE, "ru_RU.CP1251"); + + include('_incl_data/__config.php'); + include('_incl_data/class/__db_connect.php'); + $u = User::start(); + + $ins = 'Вещи БК-1:
'; + $sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1'); + while ($pl = mysql_fetch_array($sp)) { + + $po = mysql_fetch_array( + mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1') + ); + $po = $u->lookStats($po['data']); + + if (!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) { + $po['add_minAtack'] = $po['sv_minAtack']; + $po['add_maxAtack'] = $po['sv_maxAtack']; + } + + $ins .= 'INSERT INTO `items_main` ( `id`, `name`, `img`, `art`, `type`, `inslot`, `use_magic`, `price`, `price2`, `iznosMAXi`, `massa`, `tr_level`, `tr_s1`, `tr_s2`, `tr_s3`, `tr_s4`, `tr_s5`, `tr_s6`, `add_s1`, `add_s2`, `add_s3`, `add_s4`, `add_s5`, `add_s6`, `add_hp`, `add_mp`, `add_m1`, `add_m2`, `add_m3`, `add_m4`, `add_b1`, `add_b2`, `add_b3`, `add_b4`, `add_attack_min`, `add_attack_max` ,`tr_a1`,`tr_a2`,`tr_a3`,`tr_a4`,`tr_mg1`,`tr_mg2`,`tr_mg3`,`tr_mg4`,`tr_mg5`,`tr_mg6`,`tr_mg7` ,`add_a1`,`add_a2`,`add_a3`,`add_a4`,`add_mg1`,`add_mg2`,`add_mg3`,`add_mg4`,`add_mg5`,`add_mg6`,`add_mg7` ) VALUES '; - $ins .= '( + $ins .= '( NULL, - "'.$pl['name'].'", - "'.$pl['img'].'", - "'.( 0 + round( $po['art'] ) ).'", - "'.$pl['type'].'", - "'.$pl['inslot'].'", + "' . $pl['name'] . '", + "' . $pl['img'] . '", + "' . (0 + round($po['art'])) . '", + "' . $pl['type'] . '", + "' . $pl['inslot'] . '", "", - "'.$pl['price1'].'", - "'.$pl['price2'].'", - "'.$pl['iznosMAXi'].'", - "'.$pl['massa'].'", - "'.( 0 + round( $po['tr_lvl'] ) ).'", - "'.( 0 + round( $po['tr_s1'] ) ).'", - "'.( 0 + round( $po['tr_s2'] ) ).'", - "'.( 0 + round( $po['tr_s3'] ) ).'", - "'.( 0 + round( $po['tr_s4'] ) ).'", - "'.( 0 + round( $po['tr_s5'] ) ).'", - "'.( 0 + round( $po['tr_s6'] ) ).'", - "'.( 0 + round( $po['add_s1'] ) ).'", - "'.( 0 + round( $po['add_s2'] ) ).'", - "'.( 0 + round( $po['add_s3'] ) ).'", - "'.( 0 + round( $po['add_s4'] ) ).'", - "'.( 0 + round( $po['add_s5'] ) ).'", - "'.( 0 + round( $po['add_s6'] ) ).'", - "'.( 0 + round( $po['add_hpAll'] ) ).'", - "'.( 0 + round( $po['add_mpAll'] ) ).'", - "'.( 0 + round( $po['add_m1'] ) ).'", - "'.( 0 + round( $po['add_m2'] ) ).'", - "'.( 0 + round( $po['add_m3'] ) ).'", - "'.( 0 + round( $po['add_m4'] ) ).'", - "'.( 0 + round( $po['add_mib1'] ) ).'", - "'.( 0 + round( $po['add_mib2'] ) ).'", - "'.( 0 + round( $po['add_mib3'] ) ).'", - "'.( 0 + round( $po['add_mib4'] ) ).'", - "'.( 0 + round( $po['add_minAtack'] ) ).'", - "'.( 0 + round( $po['add_maxAtack'] ) ).'", - "'.( 0 + round( $po['tr_a1'] ) ).'", - "'.( 0 + round( $po['tr_a2'] ) ).'", - "'.( 0 + round( $po['tr_a3'] ) ).'", - "'.( 0 + round( $po['tr_a4'] ) ).'", - "'.( 0 + round( $po['tr_mg1'] ) ).'", - "'.( 0 + round( $po['tr_mg2'] ) ).'", - "'.( 0 + round( $po['tr_mg3'] ) ).'", - "'.( 0 + round( $po['tr_mg4'] ) ).'", - "'.( 0 + round( $po['tr_mg5'] ) ).'", - "'.( 0 + round( $po['tr_mg6'] ) ).'", - "'.( 0 + round( $po['tr_mg7'] ) ).'", - "'.( 0 + round( $po['add_a1'] ) ).'", - "'.( 0 + round( $po['add_a2'] ) ).'", - "'.( 0 + round( $po['add_a3'] ) ).'", - "'.( 0 + round( $po['add_a4'] ) ).'", - "'.( 0 + round( $po['add_mg1'] ) ).'", - "'.( 0 + round( $po['add_mg2'] ) ).'", - "'.( 0 + round( $po['add_mg3'] ) ).'", - "'.( 0 + round( $po['add_mg4'] ) ).'", - "'.( 0 + round( $po['add_mg5'] ) ).'", - "'.( 0 + round( $po['add_mg6'] ) ).'", - "'.( 0 + round( $po['add_mg7'] ) ).'" + "' . $pl['price1'] . '", + "' . $pl['price2'] . '", + "' . $pl['iznosMAXi'] . '", + "' . $pl['massa'] . '", + "' . (0 + round($po['tr_lvl'])) . '", + "' . (0 + round($po['tr_s1'])) . '", + "' . (0 + round($po['tr_s2'])) . '", + "' . (0 + round($po['tr_s3'])) . '", + "' . (0 + round($po['tr_s4'])) . '", + "' . (0 + round($po['tr_s5'])) . '", + "' . (0 + round($po['tr_s6'])) . '", + "' . (0 + round($po['add_s1'])) . '", + "' . (0 + round($po['add_s2'])) . '", + "' . (0 + round($po['add_s3'])) . '", + "' . (0 + round($po['add_s4'])) . '", + "' . (0 + round($po['add_s5'])) . '", + "' . (0 + round($po['add_s6'])) . '", + "' . (0 + round($po['add_hpAll'])) . '", + "' . (0 + round($po['add_mpAll'])) . '", + "' . (0 + round($po['add_m1'])) . '", + "' . (0 + round($po['add_m2'])) . '", + "' . (0 + round($po['add_m3'])) . '", + "' . (0 + round($po['add_m4'])) . '", + "' . (0 + round($po['add_mib1'])) . '", + "' . (0 + round($po['add_mib2'])) . '", + "' . (0 + round($po['add_mib3'])) . '", + "' . (0 + round($po['add_mib4'])) . '", + "' . (0 + round($po['add_minAtack'])) . '", + "' . (0 + round($po['add_maxAtack'])) . '", + "' . (0 + round($po['tr_a1'])) . '", + "' . (0 + round($po['tr_a2'])) . '", + "' . (0 + round($po['tr_a3'])) . '", + "' . (0 + round($po['tr_a4'])) . '", + "' . (0 + round($po['tr_mg1'])) . '", + "' . (0 + round($po['tr_mg2'])) . '", + "' . (0 + round($po['tr_mg3'])) . '", + "' . (0 + round($po['tr_mg4'])) . '", + "' . (0 + round($po['tr_mg5'])) . '", + "' . (0 + round($po['tr_mg6'])) . '", + "' . (0 + round($po['tr_mg7'])) . '", + "' . (0 + round($po['add_a1'])) . '", + "' . (0 + round($po['add_a2'])) . '", + "' . (0 + round($po['add_a3'])) . '", + "' . (0 + round($po['add_a4'])) . '", + "' . (0 + round($po['add_mg1'])) . '", + "' . (0 + round($po['add_mg2'])) . '", + "' . (0 + round($po['add_mg3'])) . '", + "' . (0 + round($po['add_mg4'])) . '", + "' . (0 + round($po['add_mg5'])) . '", + "' . (0 + round($po['add_mg6'])) . '", + "' . (0 + round($po['add_mg7'])) . '" );'; - $ins .= "\n".'
'; - } - - echo $ins; - - die(); + $ins .= "\n" . '
'; + } + + echo $ins; + + die(); } -if( isset($_GET['test'])) { - $i = 3; - - - function yrn($sila) { - $r = 0; - - $level = $_GET['test']; - - $r = 2 + $level + $sila - round($sila / 5); - - return $r; - } - - - while( $i <= 100 ) { - echo ' '; - echo $i.' = '.yrn($i).''; - echo ''; - $i++; - } - - die(); +if (isset($_GET['test'])) { + $i = 3; + + + function yrn($sila) + { + return 2 + $_GET['test'] + $sila - round($sila / 5); + } + + + while ($i <= 100) { + echo ' '; + echo $i . ' = ' . yrn($i); + echo ''; + $i++; + } + + die(); } -function getIP() { - if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; +function getIP() +{ + return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR']; } -if(isset($_GET['robot'])) { - -}elseif(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '31.131.116.166') { - if( !isset($_GET['test'])) { - die(getIP().'
'.$_SERVER['SERVER_ADDR']); - } +if (!isset($_GET['robot']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP( + ) != '31.131.116.166' && !isset($_GET['test'])) { + die(getIP() . '
' . $_SERVER['SERVER_ADDR']); } -define('GAME',true); +const GAME = true; -setlocale(LC_CTYPE ,"ru_RU.CP1251"); +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/bot.priem.php'); -include('_incl_data/class/bot.logic.php'); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +$count = [0, 0, 0, 0, 0, 0]; + +function inuser_go_btl($id) +{ + if (isset($id['id'])) { + file_get_contents( + 'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5( + $id['id'] . '_brfCOreW@!_' . $id['pass'] + ) . '&pass=' . $id['pass'] + ); + } } -$count = array( - 0, - 0, - 0, - 0, - 0, - 0 +$sp = mysql_query( + 'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200' ); -function inuser_go_btl($id) { - if(isset($id['id'])) { - file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass']); - } +$btltest = []; + +while ($pl = mysql_fetch_array($sp)) { + + $i++; + + if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) { + + $btltest[$pl['battle']]++; + + if ($pl['timereg'] == 0) { + mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['bot'] == 0) { + mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + + BotLogic::start($pl['id']); + + } else { + + if ($pl['zv'] > 0) { + BotLogic::start($pl['id']); + } + + if ($pl['timereg'] == 0) { + mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['bot'] == 0) { + mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + + echo '*'; + } + echo '+'; + echo '[' . $pl['login'] . '] -> Действие: ' . $pl['ipreg'] . ' , ожидаем: ' . ($pl['timeMain'] - time( + )) . ' сек., заявка: ' . $pl['zv'] . ', поединок: ' . $pl['battle'] . ''; + echo '
'; } - -$sp = mysql_query('SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200'); - -$btltest = array(); - -while($pl = mysql_fetch_array($sp)) { - - $i++; - - if( $pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) { - - $btltest[$pl['battle']]++; - - if( $pl['timereg'] == 0 ) { - mysql_query('UPDATE `users` SET `timereg` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['bot'] == 0 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - - botLogic::start( $pl['id'] ); - - }else{ - - if( $pl['zv'] > 0 ) { - botLogic::start( $pl['id'] ); - } - - if( $pl['timereg'] == 0 ) { - mysql_query('UPDATE `users` SET `timereg` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['bot'] == 0 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `nextAct` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - - echo '*'; - } - echo '+'; - echo '['.$pl['login'].'] -> Действие: '.$pl['ipreg'].' , ожидаем: '.($pl['timeMain']-time()).' сек., заявка: '.$pl['zv'].', поединок: '.$pl['battle'].''; - echo '
'; -} -?> diff --git a/_incl_data/__config.php b/_incl_data/__config.php index ecc7f242..e148e520 100644 --- a/_incl_data/__config.php +++ b/_incl_data/__config.php @@ -1,11 +1,12 @@ '1.8.3.7' + 'ver' => '1.8.3.7', ]; /* Конфигурации игры */ $c['name'] = 'Бойцовский Клуб'; @@ -48,45 +49,16 @@ $c['expstop'] = 2999999; //9; // $c['expstopu'] = 2999999; //Опыт на котором останавливаемся $c['noobgade'] = false; //нуб квест (пещера) $c['bonusonline'] = true; //бонус за онлайн -$c['bonusonline_kof'] = 1; //коэфицент кр за лвл $c['level_ransfer'] = 8; //С какого уровня разрешены передачи $c['znahar'] = true; //бесплатный знахарь $c['nolevel'] = false; //лимитирование уровней $c['noitembuy'] = false; //Не требует ресурсы для покупки $c['effz'] = 0; //Скольким секундам равен заряд $c['money_haot'] = true; //кр за хаоты -$c['money_haot_proc'] = 0.10; //сколько процентов от фулла выдает в награду $c['crtoecr'] = 500; //Курс обмена кр на екр (если 0, то выключено) $c['ecrtocr'] = 200; //Курс обмена екр на кр $c['bonuslevel'] = true; //Бонус уровня $c['bonussocial'] = false; //Бонус социальный -$c['exp_limit_many'] = false; //Лимит опыта, если более 5 боев, то 0 опыта даст - -$c['exp_mega'] = false; //Повышенный лимит опыта -$c['exp_mega_val'] = [ - 0 => 1000, - 1 => 1000, - 2 => 1000, - 3 => 1000, - 4 => 1000, - 5 => 1000, - 6 => 1000, - 7 => 1500, - 8 => 0, - 9 => 0, - 10 => 0, - 11 => 0, - 12 => 0, - 13 => 0, - 14 => 0, - 15 => 0, - 16 => 0, - 17 => 0, - 18 => 0, - 19 => 0, - 20 => 0, - 21 => 0 -]; //Повышенный лимит опыта $c['w'] = date('w'); $c['m'] = date('m'); @@ -105,5 +77,20 @@ if (isset($_GET['version'])) { // Для всех доработок, пока нет автозагрузки классов. require_once 'class/Insallah/Config.php'; -//Вместо крона для турнира. -if (\Insallah\Tournament::IS_ENABLED) (new \Insallah\Tournament())->startAllBattles(); \ No newline at end of file +// Попробуем в автозагрузку. +// Никогда не заработает с такими названиями классов и файлов! +// "На потом." +spl_autoload_register(function ($className) { + # 1 with namespaces + # 2 without + $fileName = [ + __DIR__ . '/class/' . str_replace('\\', '/', $className . '.php'), + __DIR__ . '/class/' . $className . '.php' + ]; + foreach ($fileName as $file) { + if (file_exists($file)) { + require_once $file; + break; + } + } +}); diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php new file mode 100644 index 00000000..3d1061b3 --- /dev/null +++ b/_incl_data/class/Battle.php @@ -0,0 +1,11785 @@ +users[$this->uids[$u1]]['login']); + $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type]; //защита цели + $v_p = 0 + round(($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4); //подавление защиты от магии + $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type]; //мощность мага + // + return ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); '; + } + + public function typeBattle($x) + { + $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок']; + if ($x < 50000) { + //Обычный бой + } elseif ($x >= 50000 && $x < 100000) { + $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; + } elseif ($x < 500000) { + $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; + } elseif ($x < 1000000) { + $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; + } elseif ($x < 2500000) { + $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; + } elseif ($x >= 5000000) { + $r = [150, 150, 'Судный День', 'Судный День']; + } + return $r; + } + + public $mncolor = [ + 1 => '006699', + 2 => '006699', + 3 => '006699', + 4 => '006699', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + public $mcolor = [ + 1 => 'A00000', + 2 => '008080', + 3 => '0000FF', + 4 => 'A52A2A', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + public $mname = [ + 'огонь' => 1, + 'воздух' => 2, + 'вода' => 3, + 'земля' => 4, + 'свет' => 5, + 'тьма' => 6, + 'серая' => 7, + ]; + public $prm = [ + /* + act: 1 - когда персонаж получает повреждение + 2 - когда персонаж наносит удар + type_of: 1 - уворот + 2 - крит + 3 - атака + 4 - защита + 5 - прочее + */ + 1 => ['name' => 'Прикрыться', 'act' => 1, 'type_of' => 5], + 2 => ['name' => 'Вломить', 'act' => 2, 'type_of' => 3], + 4 => ['name' => 'Сильный удар', 'act' => 2, 'type_of' => 3], + 7 => ['name' => 'Активная защита', 'act' => 1, 'type_of' => 4], + + + 290 => ['name' => 'Вытягивание души', 'act' => 1, 'type_of' => 4], + + //Излом хаоса + //291 => array( 'name' => 'Грация Боя', 'act' => 2, 'type_of' => 4 ), + + //Канализация + 294 => ['name' => 'Зловонная Вода', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 295 => ['name' => 'Проткнуть', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 296 => ['name' => 'Гнилая Кровь', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 297 => ['name' => 'Собраться', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 298 => ['name' => 'Приказ Слабости', 'act' => 2, 'type_of' => 3], + // + + 141 => ['name' => 'Призрачная защита', 'act' => 2, 'type_of' => 4], + 147 => ['name' => 'Призрачный кинжал', 'act' => 2, 'type_of' => 4], + 148 => ['name' => 'Призрачный топор', 'act' => 2, 'type_of' => 4], + 149 => ['name' => 'Призрачный удар', 'act' => 2, 'type_of' => 4], + 150 => ['name' => 'Призрачное лезвие', 'act' => 2, 'type_of' => 4], + + + 142 => ['name' => 'Призрачный огонь', 'act' => 2, 'type_of' => 4], + 144 => ['name' => 'Призрачный воздух', 'act' => 2, 'type_of' => 4], + 146 => ['name' => 'Призрачная земля', 'act' => 2, 'type_of' => 4], + 145 => ['name' => 'Призрачная вода', 'act' => 2, 'type_of' => 4], + + 8 => ['name' => 'Танец ветра', 'act' => 1, 'type_of' => 1], + 9 => ['name' => 'Дикая удача', 'act' => 2, 'type_of' => 3], + 10 => ['name' => 'Предвидение', 'act' => 1, 'type_of' => 1], + 11 => ['name' => 'Удачный удар', 'act' => 2, 'type_of' => 3], + + 45 => ['name' => 'Полная защита', 'act' => 1, 'type_of' => 4], + + 47 => ['name' => 'Слепая удача', 'act' => 2, 'type_of' => 2], + 48 => ['name' => 'Танец лезвий', 'act' => 1, 'type_of' => 1], + 49 => ['name' => 'Второе дыхание', 'act' => 1, 'type_of' => 1], + 138 => ['name' => 'Сокрушающий удар', 'act' => 2, 'type_of' => 3], + 140 => ['name' => 'Абсолютная защита', 'act' => 1, 'type_of' => 4], + 193 => ['name' => 'Усиленные удары', 'act' => 2, 'type_of' => 3], + //204 => array( 'name' => 'Обречённость', 'act' => 2 , 'type_of' => 5 ), + 204 => ['name' => 'Обречённость', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 211 => ['name' => 'Агрессивная защита', 'act' => 1, 'type_of' => 4], + 213 => ['name' => 'Коварный Уход', 'act' => 1, 'type_of' => 4], + 215 => ['name' => 'Скрытая ловкость', 'act' => 1, 'type_of' => 1], + 216 => ['name' => 'Скрытая сила', 'act' => 2, 'type_of' => 2], + 217 => ['name' => 'Разгадать тактику', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 219 => ['name' => 'Точный удар', 'act' => 2, 'type_of' => 3], + 220 => ['name' => 'Ставка на опережение', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 222 => ['name' => 'Последний удар', 'act' => 2, 'type_of' => 3], + 225 => ['name' => 'Магическая защита', 'act' => 1, 'type_of' => 4], + 226 => ['name' => 'Возмездие', 'act' => 1, 'type_of' => 4], + 231 => ['name' => 'Глухая защита', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 234 => ['name' => 'Осторожность', 'act' => 2, 'type_of' => 4], + 235 => ['name' => 'Шокирующий удар', 'act' => 2, 'type_of' => 3], + 342 => ['name' => 'Круговая Защита', 'act' => 0, 'type_of' => 0], + 343 => ['name' => 'Натиск', 'act' => 0, 'type_of' => 0], + + 237 => ['name' => 'Разведка боем', 'act' => 2, 'type_of' => 3 /*, 'moment' => 3*/], + + 239 => ['name' => 'Поступь смерти', 'act' => 2, 'type_of' => 3], + 240 => ['name' => 'Хлебнуть крови', 'act' => 2, 'type_of' => 5] + + //Оледенение + , + 21 => ['name' => 'Оледенение [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 73 => ['name' => 'Оледенение [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 74 => ['name' => 'Оледенение [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 75 => ['name' => 'Оледенение [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 76 => ['name' => 'Оледенение [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 77 => ['name' => 'Оледенение [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 78 => ['name' => 'Оледенение [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 79 => ['name' => 'Оледенение [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Отравление + , + 22 => ['name' => 'Отравление [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 80 => ['name' => 'Отравление [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 81 => ['name' => 'Отравление [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 82 => ['name' => 'Отравление [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 83 => ['name' => 'Отравление [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 84 => ['name' => 'Отравление [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Регенерация + , + 36 => ['name' => 'Регенерация [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 85 => ['name' => 'Регенерация [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 86 => ['name' => 'Регенерация [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 87 => ['name' => 'Регенерация [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 88 => ['name' => 'Регенерация [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 89 => ['name' => 'Регенерация [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 90 => ['name' => 'Регенерация [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Ядовитое облако + , + 23 => ['name' => 'Ядовитое Облако [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 70 => ['name' => 'Ядовитое Облако [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 71 => ['name' => 'Ядовитое Облако [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 72 => ['name' => 'Ядовитое Облако [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Иней + , + 269 => ['name' => 'Иней [8]', 'act' => 2, 'type_of' => 9] + , + 276 => ['name' => 'Иней [9]', 'act' => 2, 'type_of' => 9] + , + 277 => ['name' => 'Иней [10]', 'act' => 2, 'type_of' => 9] + + //Духи Льда + , + 270 => ['name' => 'Духи Льда', 'act' => 2, 'type_of' => 5, 'type_sec' => 5] + + //Хватка Льда + , + 280 => ['name' => 'Хватка Льда', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Жертва Воде + , + 281 => ['name' => 'Жертва Воде', 'act' => 2, 'type_of' => 5] + + //Ледяное спасение + , + 282 => ['name' => 'Ледяное Спасение', 'act' => 2, 'type_of' => 5] + + // + // + + //Медитация + , + 24 => ['name' => 'Медитация', 'act' => 2, 'type_of' => 0, 'moment' => 3] + + //Магический барьер + , + 210 => ['name' => 'Магический Барьер [4]', 'act' => 2, 'type_of' => 8] + , + 209 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8] + , + 208 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8] + , + 207 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8] + , + 206 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8] + , + 284 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8] + + //Силовое поле + , + 175 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8] + , + 176 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8] + , + 177 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8] + , + 178 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8] + , + 179 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8] + + // + // + + //Метеорит + , + 42 => ['name' => 'Метеорит [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 121 => ['name' => 'Метеорит [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 122 => ['name' => 'Метеорит [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 123 => ['name' => 'Метеорит [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 124 => ['name' => 'Метеорит [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 125 => ['name' => 'Метеорит [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Каменный Щит + , + 249 => ['name' => 'Каменный Щит', 'act' => 2, 'type_of' => 4] + + //Песчанный щит + , + 248 => ['name' => 'Песчаный Щит', 'act' => 2, 'type_of' => 4] + + //Заземление + , + 251 => ['name' => 'Заземление: Плюс', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 252 => ['name' => 'Заземление: Минус', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + // + // + + //Туманный образ + , + 273 => ['name' => 'Туманный Образ [10]', 'act' => 1, 'type_of' => 4] + , + 286 => ['name' => 'Туманный Образ [9]', 'act' => 1, 'type_of' => 4] + , + 287 => ['name' => 'Туманный Образ [8]', 'act' => 1, 'type_of' => 4] + , + 288 => ['name' => 'Туманный Образ [7]', 'act' => 1, 'type_of' => 4] + + // + , + 255 => ['name' => 'Воздушный Щит', 'act' => 2, 'type_of' => 8] + + // + // + + //Пещерные приемы + , + 337 => ['name' => 'Выпить Душу', 'act' => 2, 'type_of' => 5] + + //Пожирающее Пламя + , + 33 => ['name' => 'Пожирающее Пламя [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 56 => ['name' => 'Пожирающее Пламя [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 57 => ['name' => 'Пожирающее Пламя [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 58 => ['name' => 'Пожирающее Пламя [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 59 => ['name' => 'Пожирающее Пламя [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 60 => ['name' => 'Пожирающее Пламя [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + + //Огненный Щит + , + 245 => ['name' => 'Огненный Щит', 'act' => 2, 'type_of' => 9] + //Эффекты + , + 327 => ['name' => 'Живая Вода', 'act' => 2, 'type_of' => 0, 'moment' => 3] + , + 328 => ['name' => 'Сушеный Мухомор', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 329 => ['name' => 'Мешочек Пыли', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 330 => ['name' => 'Отвар когтей ПГ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 331 => ['name' => 'Отвар Василиска', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 332 => ['name' => 'Точильный Камень', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 333 => ['name' => 'Волшебный Эликсир', 'act' => 2, 'type_of' => 0, 'moment' => 3] + , + 334 => ['name' => 'Цепь Защитника', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 335 => [ + 'name' => 'Эликсир Безумного Критовика', + 'act' => 2, + 'type_of' => 0, + 'moment' => 0, + 'moment_end' => 3, + ] + //1 сентября, квест + , + 299 => ['name' => 'Ядовитые язвы', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 300 => ['name' => 'Элементарный заряд', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 301 => ['name' => 'Темное ранение', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 302 => ['name' => 'Подлечиться', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 303 => ['name' => 'Шкура поглощения', 'act' => 2, 'type_of' => 4] + , + 304 => ['name' => 'Особенное проклятье!', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] + , + 305 => ['name' => 'Кровожадность', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + ]; + + //Сохраняем лог в архик + public function saveLogs($id, $type) + { + if ($type == 'all') { + $type = ''; + mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID) . ''); + } else { + mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID - 5) . ''); + } + mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ' . $type . ''); + mysql_query('DELETE FROM `battle_stat` WHERE `battle` < "' . ($this->info['id'] - 100) . '" '); + mysql_query('DELETE FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" '); + //mysql_query('OPTIMIZE TABLE `battle_logs`'); + //mysql_query('OPTIMIZE TABLE `battle_stat`'); + //mysql_query('OPTIMIZE TABLE `battle_actions`'); + } + + public function hphe($uid, $hp, $false_t7 = false) + { + global $u; + if (!isset($this->stats[$this->uids[$uid]])) { + echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!'; + } else { + $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']); + $hpall = $this->stats[$this->uids[$uid]]['hpAll']; + if ($hp > 0) { + //Хиляем + if ($hpnow + $hp > $hpall) { + $hpli = $hpnow + $hp - $hpall; + $hp -= $hpli; + } + if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) { + $hp = 0; + } else { + $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']); + } + //Отнимаем тактику + if ($false_t7 == false) { + if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) { + $hp = 0; + $this->users[$this->uids[$uid]]['tactic7'] = 0; + $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; + } else { + $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2); + if ($gdhh == 0) { + $gdhh = 0.01; + } + + $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100); + + $this->users[$this->uids[$uid]]['tactic7'] = round(($this->users[$this->uids[$uid]]['tactic7'] - $gdhh), + 2); + if ($this->users[$this->uids[$uid]]['tactic7'] < 0) { + $this->users[$this->uids[$uid]]['tactic7'] = 0; + } + $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; + if ($gdhd < 100) { + $hp = floor($hp / 100 * $gdhd); + } + } + } + } elseif ($hp < 0) { + //Отнимаемф + if ($hpnow + $hp < 0) { + $hpli = $hpnow + $hp; + $hp += -($hpli); + } + } + + if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) { + $hp = 0; + } + + $this->stats[$this->uids[$uid]]['last_hp'] = -$hp; + mysql_query('UPDATE `stats` SET + `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", + `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '" + WHERE `id` = "' . $uid . '" LIMIT 1'); + } + + return floor($hp); + } + + public function deleffm($pid, $uid, $id) + { + if ($id > 0) { + if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . mysql_real_escape_string($id) . '" AND `v1` = "priem" AND `v2` != "0" LIMIT 1')) { + echo '[*Ошибка удаления прием[' . $id . ',' . $pid . ',' . $uid . ']]'; + } + } else { + if (!mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `v1` = "priem" AND `v2` = "' . $pid . '"')) { + } + } + //echo '['.$id.','.$pid.','.$uid.']'; + } + + + public $e, //Ошибка (текст) + $cached = false, //Кэширование данных + $expCoef = 0, # % опыта в бою + $aBexp = 0, //Добавочный опыт в боях + $mainStatus = 1, //Отображаем главное окно (1 - можно бить, 2 - ожидаем ход противника, 3 - Проиграли. Ожидаем завершения поединка) + $info = [], //Информация о поединке + $users = [], //Информация о пользователях в этом бою + $stats = [], //Информация о статах пользователей в этом бою + $uids = [], //Список пользователей и их id в stats или users пример id пользователя = 555 , то $uids[555] выдаст его порядковый номер в массиве users \ stats + $atacks = [], //Список ударов в этом бою (действующих) + $ga = [], //Список uid кто нанес удар и по кому $ga[ {id кто ударил} ][ {id кого ударил} ] + $ag = [], //Список uid кто нанес удар и по кому $ga[ {id кого ударили} ][ {id кто ударил} ] + $na = 1, //возможность использовать удар + $np = 1, //возможность использовать приемы + $nm = 1, //возможность использовать заклятия + $hodID = 0, + $stnZbVs = 0, + $bots = [], // ID ботов + $iBots = [], // i бота + $stnZb = [], + $uAtc = [ + 'id' => 0, + 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], + 'b' => 0, + ], //Если игрок нанес удар + $lg_itm = [ + 0 => [ + 'грудью', + 'ребром руки', + 'лбом', + 'кулаком', + 'ногой', + 'левой ногой', + 'правой ногой', + 'коленом', + ], + 1 => ['ножом', 'тыльной стороной лезвия ножа', 'рукоятью ножа', 'лезвием ножа'], + 2 => ['сучковатой палкой', 'поленом', 'тяжелой дубиной', 'дубиной', 'рукоятью молота'], + 3 => ['секирой', 'топором', 'лезвием секиры', 'алебардой', 'тяжелым держаком', 'длинной секирой'], + 4 => [ + 'ножнами', + 'гардой', + 'мечом', + 'лезвием меча', + 'рукоятью меча', + 'тупым лезвием', + 'острой стороной меча', + 'огромным мечом', + ], + 5 => ['сучковатой палкой', 'посохом', 'тяжелой тростью', 'корявым посохом', 'основанием посоха'], + 22 => ['костылем'], + ], // Чем лупили + $lg_zon = [ + 1 => [ + 'в нос', + 'в глаз', + 'в челюсть', + 'по переносице', + 'в кадык', + 'по затылку', + 'в правый глаз', + 'в левый глаз', + 'в скулу', + ], + 2 => ['в грудь', 'в корпус', 'в солнечное сплетение', 'в сердце', 'в область лопаток'], + 3 => ['в бок', 'по желудку', 'по левой руке', 'по правой руке'], + 4 => ['по <вырезано цензурой>', 'в пах', 'в промежность', 'по левой ягодице', 'по правой ягодице'], + 5 => ['по ногам', 'в область правой пятки', 'в область левой пятки', 'по коленной чашечке', 'по икрам'], + ]; // Куда лупили + public $is = [], $items = []; + + //Очистка кэша для ... + public $uclearc = [], $ucleari = []; + + public function clear_cache($uid) + { + if ($uid > 0 && !isset($this->uclearc[$uid])) { + $this->uclearc[$uid] = true; + $this->ucleari[] = $uid; + } + } + + public function clear_cache_start() + { + $i = 0; + while ($i < count($this->ucleari)) { + mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($this->ucleari[$i]) . '"'); + $i++; + } + } + + //Проверка урон приемов над защитными + public function testYronPriemAttack($pid, $u1, $u2, $hp) + { + //Игрок 1 бьет по Игроку 2 при помощи приема № pid на hp ед. здоровья + + /* + Полная защита + */ + //Получаем приемы и смотрим когда какой действует + $eff = $this->stats[$this->uids[$u2]]['effects']; + $j = 0; + while ($j <= count($eff)) { + if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { + // id прием $eff[$j]['v2'] + if ($eff[$j]['v2'] == 140 || $eff[$j]['v2'] == 211 || $eff[$j]['v2'] == 45) { //|| $eff[$j]['v2'] == 45 + //Приемы от которых урон = 1 , то есть выдаем 0 + $hp['y'] = -1; + $hp['r'] = 1; + $hp['k'] = 2; + $hp['m_y'] = 1; + $hp['m_k'] = 2; + } + } + $j++; + } + unset($eff); + + return $hp; + } + + //Расчет маг.крита + public function magKrit($l2, $t) + { + $r = 0; + $r = $l2 * 2 - 7; + if ($r > $t) { + //магический промах (серый удар, в 2 раза меньше) 6% + //250 ед. защиты от магии дает 1% шанса увернуться от магии + //$r = -1; , промах -- + $r = 0; + } else { + //каждая владелка дает 3% шанс крита + $r = ceil($t * 0.75); + if ($r > 30) { + $r = 30; + } + if (rand(0, 10000) < $r * 100) { + //крит удар + $r = 1; + } else { + $r = 0; + } + } + return $r; + } + + + //Обновление НР + public function hpRef() + { + } + + //Расчет опыта + public function testExp($y, $s1, $s2, $id1, $id2) + { + global $u, $c; + + + //ТУТ таблица умножения оыта + $oplevel = [ // Максимум для каждого уровня. + 0 => 1, + 1 => 1, + 2 => 1, + 3 => 1, + 4 => 2, + 5 => 2, + 6 => 2, + 7 => 2, + 8 => 3, + 9 => 4, + 10 => 5, + 11 => 6, + 12 => 7, + 13 => 50, + 14 => 75, + ]; + + if ($y < 0) { + $y = 0; + } + if ($s2['hpNow'] < 0) { + //echo '[f]'; + $y = 0; + } + if ($s2['hpNow'] < $y) { + //echo '[d]'; + $y = $s2['hpNow']; + } + if ($y < 0) { /*echo '[r]';*/ + $y = 0; + } + // + // $addExp = 0+(($y/$s2['hpAll'])*100); + $addExp = 0 + ($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]); + if ($s2['hpAll'] - $y <= 0) { + //echo '[a]'; + $addExp = 100; + } + + //if($this->users[$this->uids[$s2['id']]]['host_reg'] == 'real_bot_user') { + // $addExp = floor($addExp*0.76); + //} + + if ($addExp < 0) { + $addExp = 0; + } + if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') { + //$doexp = mysql_fetch_array(mysql_query('SELECT SUM(`items_main`.`price1`) FROM `items_users`,`items_main` WHERE `items_users`.`inOdet` > 0 AND `items_main`.`inSlot` < 50 AND `items_users`.`uid` = "'.$id2.'" AND `items_users`.`delete` = 0 AND `items_main`.`id` = `items_users`.`item_id` ORDER BY `items_main`.`inSlot` ASC LIMIT 50')); + //if($doexp[0]>0) { + // $doexp = floor($doexp[0]/15); + //}else{ + // $doexp = 0; + //} + //$doexp = floor(($this->users[$this->uids[$id2]]['btl_cof']-$this->users[$this->uids[$id1]]['btl_cof']*0.80)/5); + /*if( $this->users[$this->uids[$id2]]['btl_cof'] > $this->users[$this->uids[$s2['id']]]['level']*350 ) { + //Артник + $doexp = floor($this->users[$this->uids[$s2['id']]]['level']*350 + ($this->users[$this->uids[$id2]]['btl_cof']/20)); + }else{ + //Не артник + $doexp = floor(($this->users[$this->uids[$id2]]['btl_cof'])); + }*/ + + if ($doexp < 0) { + $doexp = 0; + } + //$addExp = $addExp*(1+($s2['levels']['expBtlMax']+$s2['irka'])+($doexp*1.01/10))/100; + /* + $bmxx = $s2['levels']['expBtlMax']; + + if ($s2['levels']['bprice'] == 0) + { + $bmxx = round( $bmxx * $s2['prckr']); + } + else + { + $bmxx = round( $bmxx * ( $s2['prckr'] / $s2['levels']['bprice'] ) ); + } + + if( $bmxx < $s2['levels']['expBtlMax'] / 2 ) { + $bmxx = round($s2['levels']['expBtlMax']/5); + } + + if( $this->info['type'] == 1 ) { + $addExp = $addExp*($bmxx/10)/100; + }else{ + $xty = 0; + + // $xty = ($s2['reting']-$s1['reting']/2); + // if( $xty < 0 ) { + // $xty = 0; + // } + + $addExp = $addExp*(($bmxx+$xty))/100; + }*/ + + + //echo '(Базовый опыт: '.$s2['levels']['expBtlMax'].')'; + // + if ($this->info['razdel'] != 5 && $c['exp_limit_many'] == true) { + $texp = mysql_fetch_array(mysql_query('SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = "' . $id1 . '" AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = "' . $id2 . '" AND `b`.`team` != `a`.`team` AND `b`.`time` > "' . (time() - 86400) . '" ) LIMIT 1')); + $texp = $texp[0]; + // + if ($texp > 5) { + $addExp = $addExp * 0.00; + } elseif ($texp > 4) { + $addExp = $addExp * 0.50; + } elseif ($texp > 3) { + $addExp = $addExp * 0.75; + } elseif ($texp > 2) { + $addExp = $addExp * 1.00; + } elseif ($texp > 1) { + $addExp = $addExp * 1.00; + } else { + $addExp = $addExp * 1.00; + } + } + // + if ($this->users[$this->uids[$s2['id']]]['bot'] > 0) { + //$addExp = round($addExp/5); + } + unset($doexp); + } else { + $addExp = 0; + } + + /* + if($s1['level'] > $s2['level']){ + $minProc = 100 - 33*( $s1['level']-$s2['level'] ); + if($minProc < 1) { + $minProc = 1; + } + $addExp = round($addExp/100*$minProc); + } + */ + + if ($this->users[$this->uids[$s2['id']]]['bot_id'] == 0 && $this->stats[$this->uids[$s2['id']]]['itmslvl'] == 0) { + //$addExp = 0; + } + + if ($this->info['typeBattle'] == 9) { + //Нападение + //за 8 и ниже не дают опыт + /*if( $this->users[$this->uids[$s1['id']]]['level'] > $this->users[$this->uids[$s2['id']]]['level'] ) { + if( $this->users[$this->uids[$s2['id']]]['level'] <= 8 ) { + $addExp = 0; + } + }*/ + } + + return $addExp; + } + + //Добавляем опыт \ нанесенный урон + public function takeExp($id, $y, $id1, $id2, $mgregen = false, $nobattle_uron = false) + { + global $u; + if (isset($this->users[$this->uids[$id]])) { + $s1 = $this->stats[$this->uids[$id1]]; + $s2 = $this->stats[$this->uids[$id2]]; + if ($id1 != $id2) { + $e = $this->testExp($y, $s1, $s2, $id1, $id2); + } else { + $e = 0; + } + /* + if( $this->users[$this->uids[$id1]]['level'] > $this->users[$this->uids[$id2]]['level'] ) { + $rez = $this->users[$this->uids[$id1]]['level']-$this->users[$this->uids[$id2]]['level']; + $e = round($e/100*(21-$rez*3)); + if( $e < 0 ) { + $e = 0; + } + }*/ + + if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1) { + $dun_limitForLevel = [ // Максимум для каждого уровня. + 4 => 750, + 5 => 1500, + 6 => 3500, + 7 => 8000, + 8 => 25000, + 9 => 50000, + 10 => 75000, + 11 => 125000, + 12 => 250000, + 13 => 500000, + 14 => 750000, + ]; + $dun_expFactor = [ // Максимум для каждого уровня. + 4 => 5, + 5 => 5, + 6 => 5, + 7 => 5, + 8 => 5, + 9 => 3, + 10 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 14 => 1, + ]; + + if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) { + $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']]; + } + if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит + $dun_exp = []; // Текущий лимит опыта игрока в подземельях. + $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$this->uids[$id1]]['id'] . '" LIMIT 1')); + $rep = explode(',', $rep['dungeonexp']); + foreach ($rep as $key => $val) { + $val = explode('=', $val); + if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { + $dun_exp[(int)$val[0]] = (int)$val[1]; + } // текущий лимит опыта в подземке + } + unset($rep); + + if (!isset($dun_exp[$this->info['dungeon']])) { + $dun_exp[$this->info['dungeon']] = 0; + } + if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // Если лимит не задан, опыт не даем. + $e = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] + ) { // Если лимит уже достигнут, опыт не даем. + $e = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']] + ) { // Если текущая репутация не достигла лимита. + if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { + // Если опыта набрано достаточно, для достижения лимита. + $e = abs($e - abs($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']]))); + $dun_exp[$this->info['dungeon']] += $e; + } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) { + // Если опыта недостаточно, для достижения лимита. + $e = $e; + $dun_exp[$this->info['dungeon']] += $e; + } else { + $e = 0; + } + } else { // В любой непонятной ситуцаии. + $e = 0; + } + } else { + $e = $e; + } // Опыт в пещерах. + if ($this->info['dungeon'] == 102 && (int)$this->users[$this->uids[$id1]]['bot_id'] == 0) { + $e = floor($e * 0.002); + } + } + /* + if( (int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1 ) { + if($this->users[$this->uids[$id1]]['level'] >= 7 ) { + $itmsCfc = ($s1['itmsCfc']+$s2['itmsCfc'])/26; + $itmsCfc = round($itmsCfc,5); + $e = $e*$itmsCfc; + } + }*/ + + $this->users[$this->uids[$id1]]['battle_exp'] += floor($e);//round($e,5); + //echo '[['.$id1.']+'.$e.']'; + // + if ($mgregen == false && $nobattle_uron == false) { + $this->users[$this->uids[$id1]]['battle_yron'] += floor($y); + if ($this->stats[$this->uids[$id1]]['notactic'] != 1) { + if ($s2['hpAll'] <= 1000) { + if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), + 10); + } else { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), + 10) / 3; + } + } else { + if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10); + } else { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10) / 3; + } + } + } + } + + //if($y != 0) { + // $this->users[$this->uids[$id1]]['tactic6'] = -$y; + //} + //if($u->info['admin'] > 0 ) { + // echo '['.$id1.' ударил '.$id2.' и получил +'.$y.' к нанесенному урону и +'.$e.' опыта]'; + //} + + $upd = mysql_query('UPDATE `stats` SET `last_hp` = "' . $this->users[$this->uids[$id1]]['last_hp'] . '",`tactic6` = "' . $this->users[$this->uids[$id1]]['tactic6'] . '",`battle_yron` = "' . $this->users[$this->uids[$id1]]['battle_yron'] . '",`battle_exp` = "' . $this->users[$this->uids[$id1]]['battle_exp'] . '" WHERE `id` = "' . ((int)$id1) . '" LIMIT 1'); + if (!$upd) { + echo '[не удача при использовании приема]'; + } else { + $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; + $this->clear_cache($id1); + $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + if ($id1 == $u->info['id']) { + $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; + $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron']; + $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic']; + $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic']; + } + } + unset($s1, $s2); + } + } + + //Добавляем нанесенный урон + public function takeYronNow($uid, $y) + { + global $u; + if (!is_numeric($y) || !is_numeric($uid)) { + return; + } + (int)$y = floor($y); + $this->users[$this->uids[$uid]]['battle_yron'] += $y; + $this->stats[$this->uids[$uid]]['battle_yron'] += $y; + if ($uid == $u->info['id']) { + $u->info['battle_yron'] += $y; + $u->stats['battle_yron'] += $y; + } + mysql_query("UPDATE stats SET battle_yron = battle_yron + $y WHERE id = " . $uid); + } + + //JS информация о игроке + public function myInfo($id, $t) + { + global $c, $u; + if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) { + if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) { + //Всегда обновляем + $this->users[$this->uids[$id]] = mysql_fetch_array(mysql_query('SELECT + + `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1')); + $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true); + $this->stats[$this->uids[$id]]['items'] = $this->stats[$this->uids[$id]]['items']; + $this->stats[$this->uids[$id]]['effects'] = $this->stats[$this->uids[$id]]['effects']; + /* + $ur = $this->users[$this->uids[$id]]; + $st = $this->stats[$this->uids[$id]]; + $itm = $this->stats[$this->uids[$id]]['items']; + $eff = $this->stats[$this->uids[$id]]['effects']; + */ + } + + //ssecho '['.$id.' -> '.$this->users[$this->uids[$id]]['last_hp'].']'; + + $ur = $this->users[$this->uids[$id]]; + $st = $this->stats[$this->uids[$id]]; + $itm = $this->stats[$this->uids[$id]]['items']; + $eff = $this->stats[$this->uids[$id]]['effects']; + $ef = ''; + $i = 0; + //effs_hide.gif + if ($u->info['seff'] < 1) { + //$ef .= '
'; + $ef .= '
Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
'; + + while ($i != -1) { + $nseef = 0; + if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) { + if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) { + $nseef = 1; + if ($eff[$i]['v1'] == 'priem') { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + } + if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) { + $nseef = 0; + } + } + } + + if (isset($eff[$i]) && $eff[$i] != 'delete') { + if ($nseef == 0) { + $ei = '' . $eff[$i]['name'] . ''; + if ($eff[$i]['x'] > 1) { + //$ei .= ' [x'.$eff[$i]['x'].'] '; + $ei .= ' x' . $eff[$i]['x'] . ' '; + } + if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) { + $ei .= ' (Эликсир)'; + } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) { + $ei .= ' (Заклятие)'; + } elseif ($eff[$i]['type1'] == 14) { + $ei .= ' (Прием)'; + } elseif ($eff[$i]['type1'] == 15) { + $ei .= ' (Изучение)'; + } elseif ($eff[$i]['type1'] == 17) { + $ei .= ' (Проклятие)'; + } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) { + $ei .= ' (Травма)'; + } elseif ($eff[$i]['type1'] == 20) { + $ei .= ' (Пристрастие)'; + } elseif ($eff[$i]['type1'] == 22) { + $ei .= ' (Ожидание)'; + } else { + $ei .= ' (Эффект)'; + } + $ei .= '
'; + + $out = ''; + $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']); + if ($eff[$i]['timeAce'] == 0) { + $time_still += $eff[$i]['timeUse']; + } + $time_still -= time(); + if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) { + if ($eff[$i]['type1'] != 13) { + /*$tmp = floor($time_still/2592000); + $id=0; + if ($tmp > 0) { + $id++; + if ($id<3) {$out .= $tmp." мес. ";} + $time_still = $time_still-$tmp*2592000; + } + $tmp = floor($time_still/604800); + if ($tmp > 0) { + $id++; + if ($id<3) {$out .= $tmp." нед. ";} + $time_still = $time_still-$tmp*604800; + } + $tmp = floor($time_still/86400); + if ($tmp > 0) { + $id++; + if ($id<3) {$out .= $tmp." дн. ";} + $time_still = $time_still-$tmp*86400; + } + $tmp = floor($time_still/3600); + if ($tmp > 0) { + $id++; + if ($id<3) {$out .= $tmp." ч. ";} + $time_still = $time_still-$tmp*3600; + } + $tmp = floor($time_still/60); + if ($tmp > 0) { + $id++; + if ($id<3) {$out .= $tmp." мин. ";} + } + if($out=='') + { + $out = $time_still.' сек.'; + }*/ + $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; + } + } else { + if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) { + $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; + //$ei .= 'Зарядов: '.$out.'
'; + } elseif ($eff[$i]['hod'] >= 0) { + $ei .= 'Зарядов: ' . $eff[$i]['hod'] . ''; + } + } + + if ($eff[$i]['user_use'] != '') { + if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') { + $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . ''; + } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') { + $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . ''; + } + } + + //Действие эффекта + $tr = ''; + $ti = $u->items['add']; + $x = 0; + $ed = $u->lookStats($eff[$i]['data']); + while ($x < count($ti)) { + $n = $ti[$x]; + if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') { + $z = ''; + if ($ed['add_' . $n] > 0) { + $z = '+'; + } + $tr .= '
' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n]; + } + $x++; + } + + if ($ed['add_mib1'] != 0) { + if ($ed['add_mab1'] != 0) { + $tr .= '
Броня головы: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . ''; + } else { + $m1l = $ed['add_mib1']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
Броня головы: ' . $m1l . ''; + } + } + if ($ed['add_mib2'] != 0) { + if ($ed['add_mab2'] != 0) { + $tr .= '
Броня корпуса: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . ''; + } else { + $m1l = $ed['add_mib2']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
Броня корпуса: ' . $m1l . ''; + } + } + if ($ed['add_mib3'] != 0) { + if ($ed['add_mab3'] != 0) { + $tr .= '
Броня пояса: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . ''; + } else { + $m1l = $ed['add_mib3']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
Броня пояса: ' . $m1l . ''; + } + } + if ($ed['add_mib4'] != 0) { + if ($ed['add_mab4'] != 0) { + $tr .= '
Броня ног: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . ''; + } else { + $m1l = $ed['add_mib4']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
Броня ног: ' . $m1l . ''; + } + } + + $efix = 0; + if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) { + $efix = $ed['add_pog2']; + } + if (isset($ed['add_pog'])) { + $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog'] . ' ед. урона'; + } + if (isset($ed['add_pog2'])) { + $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog2'] . ' ед. урона (' . $ed['add_pog2p'] . '%)'; + } + + if ($tr != '') { + $ei .= $tr; + } + if ($eff[$i]['info'] != '') { + $ei .= '
Информация:
' . $eff[$i]['info']; + } + + //$ef .= ''; + $ef .= '
'; + unset($efix); + } + } elseif ($eff[$i] != 'delete') { + $i = -2; + } + $i++; + } + } else { + $ef .= '
Развернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
'; + } + if ($st['itmslvl'] == 0 && $ur['bot_id'] == 0) { + //$ef .= '
Легкое вооружение (Эффект)
Осталось: Бесконечно\">
'; + } + + $ca = ''; + if ($ur['clan'] > 0) { + $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $ur['clan'] . '" LIMIT 1')); + if (isset($cl['id'])) { + $ca = ''; + } + } + if ($ur['align'] > 0) { + $ca = '' . $ca; + } + if ($ur['login2'] == '') { + $ur['login2'] = $ur['login']; + } + if (floor($st['hpNow']) > $st['hpAll']) { + $st['hpNow'] = $st['hpAll']; + } + if (floor($st['mpNow']) > $st['mpAll']) { + $st['mpNow'] = $st['mpAll']; + } + $stsua = '' . $ur['login2'] . ''; + $stsua .= '
Сила: ' . $st['s1']; + $stsua .= '
Ловкость: ' . $st['s2']; + $stsua .= '
Интуиция: ' . $st['s3']; + $stsua .= '
Выносливость: ' . $st['s4']; + if ($st['s5'] != 0) { + $stsua .= '
Интелект: ' . $st['s5']; + } + if ($st['s6'] != 0) { + $stsua .= '
Мудрость: ' . $st['s6']; + } + if ($st['s7'] != 0) { + $stsua .= '
Духовность: ' . $st['s7']; + } + if ($u->info['admin'] > 0) { + if (isset($ur['align']) && $ur['align'] == 9) { + $align = $ur['align']; + } else { + $align = $ur['align']; + } + } + $tp_img = [ + 1 => 4, + 2 => 5, + 14 => 6, + 3 => 7, + 5 => 8, + 7 => 9, + 17 => 10, + 16 => 11, + 13 => 12, + 10 => 13, + 9 => 14, + 8 => 15, + 11 => 17, //кольцо 2 + 12 => 18 //кольцо 3 + ]; + $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor($st['hpNow']) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor($st['mpAll']) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();'; + $i = 0; + while ($i < count($itm)) { + // + if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) { + $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]]; + } + //генерируем предметы + $ttl = '' . $itm[$i]['name'] . ''; + $td = $u->lookStats($itm[$i]['data']); + $lvar = ''; + if ($td['add_hpAll'] > 0) { + if ($td['add_hpAll'] > 0) { + $td['add_hpAll'] = '+' . $td['add_hpAll']; + } + $lvar .= '
Уровень жизни: ' . $td['add_hpAll'] . ''; + } + if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) { + $lvar .= '
Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']) . ''; + } + if ($td['add_mab1'] > 0) { + if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { + $m1l = '+'; + if ($td['add_mab1'] < 0) { + $m1l = ''; + } + $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; + } else { + $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; + } + } + if ($td['add_mab2'] > 0) { + if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) { + $m1l = '+'; + if ($td['add_mab2'] < 0) { + $m1l = ''; + } + $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; + } else { + $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; + } + } + if ($td['add_mab3'] > 0) { + if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) { + $m1l = '+'; + if ($td['add_mab3'] < 0) { + $m1l = ''; + } + $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; + } else { + $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; + } + } + if ($td['add_mab4'] > 0) { + if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) { + $m1l = '+'; + if ($td['add_mab4'] < 0) { + $m1l = ''; + } + $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; + } else { + $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; + } + } + if ($itm[$i]['iznosMAX'] > 0) { + if ($itm[$i]['iznosMAXi'] == 999999999) { + $lvar .= '
Долговечность: неразрушимо'; + } else { + $lvar .= '
Долговечность: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']); + } + } + $ttl .= $lvar; + $ccv = ''; + + if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') { + if ($itm[$i]['magic_inc'] == '') { + $itm[$i]['magic_inc'] = $itm[$i]['magic_inci']; + } + $mgi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $itm[$i]['magic_inc'] . '" AND `type1` = "12345" LIMIT 1')); + if (isset($mgi['id2'])) { + $mgilog = ''; + $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);'; + } + } + + $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");'; + $i++; + } + + return $info; + } else { + return false; + } + } + + //Проверка на выживших + public function testUsersLive() + { + $r = false; + $tl = 0; + $i = 0; + $j = 0; + while ($i < count($this->uids)) { + if ($this->stats[$i]['id'] > 0) { + if (floor($this->stats[$i]['hpNow']) < 1) { + $this->stats[$i]['hpNow'] = 0; + } + $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); + if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { + $tml[$this->users[$i]['team']] = 1; + $tmv[$j] = $this->users[$i]['team']; + $tl++; + } + } + $i++; + } + if ($tl > 1) { + $r = true; + } + return $r; + } + + //Мини лог + public function miniLogAdd($user, $text) + { + $txt = $text; + $vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time() . '||time2=' . time() . '||s1=' . $user['sex'] . '||t1=' . $user['team'] . '||login1=' . $user['login'] . '||'; + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + 1), + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $mas1['text'] = $txt; + $this->add_log($mas1); + } + + //Проверяем завершение боя + public function testFinish() + { + global $u; + // + mysql_query('START TRANSACTION;'); + // + $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` = -1 LIMIT 1 FOR UPDATE')); + //mysql_query('UPDATE `battle` SET `testfinish` = "'.$u->info['id'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); + // + mysql_query('COMMIT;'); + // + if ($this->info['team_win'] == -1 && isset($test['id'])) { + $hp = []; + $tml = []; + $tmv = []; + $tl = 0; + $i = 0; + $j = 0; + while ($i < count($this->uids)) { + if ($this->stats[$i]['id'] > 0) { + if (floor($this->stats[$i]['hpNow']) < 1) { + $this->stats[$i]['hpNow'] = 0; + } + $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); + if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { + $tml[$this->users[$i]['team']] = 1; + $tmv[$j] = $this->users[$i]['team']; + $tl++; + } + } + $i++; + } + + if ($tl <= 1) { + //Доп.проверка + $tmHpNow = []; + $tmNow = []; + $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`u`.`battle`,`s`.`team`,`s`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if (!isset($tmHpNow[$pl['team']])) { + $tmHpNow[$pl['team']] = 0; + $tmNow[] = $pl['team']; + } + $hpTm = floor($pl['hpNow']); + if ($hpTm < 0) { + $hpTm = 0; + } + if ($hpTm > 0) { + $tmHpNow[$pl['team']] += $pl['hpNow']; + } + } + $gdj = 0; + $i = 0; + while ($i < count($tmNow)) { + if (isset($tmNow[$i])) { + $j = $tmNow[$i]; + if ($tmHpNow[$j] > 0) { + $gdj++; + } + } + $i++; + } + if ($gdj > 1) { + $tl = $gdj; + echo 'Поединок может завершиться не корректно... (Сообщите Администрации об этом)'; + } + } + + if ($tl <= 1) { + //завершаем поединок, кто-то один победил, либо ничья + + $i = 0; + $tmwin = 0; + while ($i < count($tmv)) { + if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { + $tmwin = $tmv[$i]; + } + $i++; + } + + if ($this->info['izlom'] == 0) { + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + unset($this->users, $this->stats, $this->uids, $this->bots, $this->iBots); + $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC'); + $ir = 0; + $bi = 0; + $this->users = null; + $this->stats = null; + $this->uids = null; + $this->bots = null; + $this->iBots = null; + while ($pl = mysql_fetch_array($trl)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$ir] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$ir] = $u->getStats($pl, 0, 0, false, false, true); + $ir++; + } + } + } elseif (!isset($this->uids[$u->info['id']])) { + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $this->info['id'] . '" LIMIT 1'); + $pl = mysql_fetch_array($trl); + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[count($this->users)] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[count($this->bots)] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + } + //записываем статы + $this->stats[count($this->stats)] = $u->getStats($pl, 0, 0, false, false, true); + } + } + + + if ($this->info['izlom'] > 0 && $tmwin == 1) { + // выкидываем ботов из боя + $i = 0; + $dlt = ''; + $dlt2 = ''; + $sp = mysql_query('SELECT `users`.`id`,`stats`.`bot`,`stats`.`team` FROM `users`,`stats` WHERE `users`.`battle` = "' . $this->info['id'] . '" AND `stats`.`id` = `users`.`id` LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['bot'] == 1 && $pl['team'] != $u->info['team']) { + $dlt .= ' `id`="' . $pl['id'] . '" OR'; + $dlt2 .= ' `uid`="' . $pl['id'] . '" OR'; + $i++; + } + } + + if ($i > 0) { + $dlt = trim($dlt, 'OR'); + $dlt2 = trim($dlt2, 'OR'); + mysql_query('DELETE FROM `users` WHERE ' . $dlt . ' LIMIT ' . $i); + mysql_query('DELETE FROM `stats` WHERE ' . $dlt . ' LIMIT ' . $i); + mysql_query('DELETE FROM `items_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); + mysql_query('DELETE FROM `eff_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); + } + + unset($i, $dlt, $dlt2); + + $j = 0; + $k = 0; + $obr = 0; + + //Это излом, добавляем еще ботов + if ($this->get_chanse(20) == true) { + //Уникальные монстры + if ($this->info['izlomLvl'] == 8) { + $bots = [ + 'Валентайский Охотник', + 'Шипокрыл Хаоса', + 'Шипокрыл', + 'Лик Хаоса', + 'Фанатик Хаоса', + ]; + //$bots = array( 'Валентайский Охотник' ); + } + $logins_bot = []; + // + echo '
Приближается нечто...
'; + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + round($this->info['izlomRoundSee'])); + if (isset($id['id']) && $bot != false) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + $u->addAction(time(), 'win_bot_' . $id['id'], '', $this->users[$i]['id']); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } else { + //Обычные монстры + if ($this->info['izlomLvl'] == 8) { + $bots = [ + 'Литейщик', + 'Проклятие Глубин', + 'Пустынник Маньяк', + 'Пустынник Убийца', + 'Рабочий Мглы', + 'Смотритель Мглы', + 'Сторож Мглы', + ]; + } + $logins_bot = []; + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + ($this->info['izlomRoundSee'] * 2)); + if (isset($id['id']) && $bot != false) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot != false) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + // + if (rand(0, 100) < 70) { + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot != false) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } + //Каждые 10 вол = +1 монстр + $irb = floor($this->info['izlomRoundSee'] / 10); + while ($irb > 0) { + // + if (rand(0, 100) < 20) { + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot != false) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } + $irb--; + } + } + // + unset($logins_bot); + // + // + // + /*if( true == false ) { + $mz = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `izlom` WHERE `izlom` = "'.$this->info['izlom'].'" AND `level` = "'.$this->info['izlomLvl'].'" LIMIT 50')); + $mz = $mz[0]; + $pz = $this->info['izlomRound']+rand(1,3); + if($pz/$mz>1){ + $zz = floor($pz/$mz); + $pz = $pz-($zz*$mz); + } + $iz = mysql_fetch_array(mysql_query('SELECT * FROM `izlom` WHERE `izlom` = "'.$this->info['izlom'].'" AND `level` = "'.$this->info['izlomLvl'].'" AND `round` = "'.$pz.'" LIMIT 1')); + $i = 0; $bots = $iz['bots']; $bots = explode('|',$bots); $j = 0; $k = 0; $obr = 0; + $logins_bot = array(); + while($i0) + { + $k = $u->addNewbot($bots[$i],NULL,NULL,$logins_bot); + if($k!=false) + { + $logins_bot = $k['logins_bot']; + $upd = mysql_query('UPDATE `users` SET `battle` = "'.$this->info['id'].'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); + if($upd) + { + $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); + if($upd) + { + $j++; if(rand(0,10000) < 1500){ $obr++; } + } + } + } + } + $i++; + } + unset($logins_bot); + }*/ + // + // + // + if ($j == 0) { + //конец излома + $this->finishBattle($tml, $tmv, null, $tl); + $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); + } else { + $this->info['izlomRound'] = $iz['round']; + mysql_query('UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; + $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; + $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; + $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; + $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; + + $mas = [ + 'text' => '', + 'time' => time(), + 'vars' => '', + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + 1), + 'vars' => $vLog, + 'type' => 1, + ]; + if ($u->info['sex'] == 1) { + $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' воспользовалась приемом "Передышка".'; + } else { + $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' воспользовался приемом "Передышка".'; + } + if ($u->stats['hpNow'] < $u->stats['hpAll']) { + $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); + if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { + $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); + } + $mas['text'] .= ' +' . $hpSks . ''; + } else { + $hpSks = 0; + $mas['text'] .= ' --'; + } + $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; + $this->add_log($mas); + + mysql_query('UPDATE `stats` SET `hpNow` = "' . ($u->info['hpNow'] + ($u->stats['hpAll'] * ((rand(15, + 25)) / 100))) . '",`mpNow` = "' . ($u->info['mpNow'] + ($u->stats['mpAll'] * 0.25)) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + } else { + //завершаем бой + $this->finishBattle($tml, $tmv, null, $tl); + if ($this->info['izlom'] > 0) { + $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); + } + } + if (isset($fin1)) { + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '","Касание Хаоса","nofastfinisheff=1","' . time() . '")'); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "','Вы создали предмет "Образец"x" . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) . "','" . time() . "','6','0')"); + $i01 = 1; + while ($i01 <= (($this->info['izlomObr'] - $this->info['izlomObrNow'])) * 7) { + $u->addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); + $i01++; + } + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")'); + unset($fin1); + } + } + } else { + mysql_query('START TRANSACTION;'); + $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`, `testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1 FOR UPDATE')); + mysql_query('COMMIT;'); + if (isset($test['id'])) { + $this->finishBattle(null, null, 10, $tl); + } + } + // + //mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); + } + + //завершение поединка + public function finishBattle($t, $v, $nl, $tl) + { + global $magic, $u, $q, $c; + mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE'); + $frtu = false; + $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`,`testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1;')); + if ($test['testfinish'] != -1) { //$frtu == false + $trtt = mysql_query('UPDATE `battle` SET `testfinish` = "-1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + $relbf = $this->info['team_win']; + if ($nl != 10) { + $i = 0; + $dnr = 0; + if ($this->info['team_win'] == -1) { + $this->info['team_win'] = 0; + while ($i < count($v)) { + if ($v[$i] >= 1 && $t[$v[$i]] > 0) { + $this->info['team_win'] = $v[$i]; + } + $i++; + } + } + } + + + //данные о игроках в бою + $t = mysql_query('SELECT `u`.`stopexp`,`u`.`twink`,`u`.`city`,`u`.`room`,`u`.`no_ip`,`u`.`pass`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + $i = 0; + $bi = 0; + while ($pl = mysql_fetch_array($t)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$i] = $pl; + $this->uids[$pl['id']] = $i; + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$i] = $u->getStats($pl, 0, 0, false, false, true); + $i++; + } + unset($pl, $t); + + if ($this->info['time_over'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `time_over` = "0" LIMIT 1')); + if (isset($tststrt['id'])) { + if ($this->info['inTurnir'] == 0 || $this->info['type'] == 500) { + mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `battle_stat` SET `team_win` = "' . $this->info['team_win'] . '" WHERE `battle_id` = "' . $this->info['id'] . '"'); + //Заносим данные о завершении боя + $i = 0; + $vl = ''; + $vtvl = ''; + $relu = 0; + while ($i < count($this->users)) { + /*if( $this->user[$i]['clon'] == 0 && $this->user[$i]['bot'] == 0 ) { + $relu++; + }*/ + $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; + if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) { + $vtvl .= '' . $this->users[$i]['login'] . ', '; + } + $i++; + } + + $this->info['players_c'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` NOT LIKE "%(зверь%" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->info['players_c'] = $this->info['players_c'][0]; + + mysql_query('UPDATE `battle` SET `players_c` = "' . $this->info['players_c'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + + if ($vtvl != '') { + $vtvl = rtrim($vtvl, ', '); + $vtvl = str_replace('"', '\\\\\"', $vtvl); + $this->hodID++; + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'Бой закончен, победа за ' . $vtvl . '.'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } else { + $this->info['players_cc'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` > 0 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); + $this->info['players_cc'] = $this->info['players_cc'][0]; + $this->info['players_cc2'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` >= 1 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); + $this->info['players_cc2'] = $this->info['players_cc2'][0]; + $inf_test = ', users: ' . $this->info['players_cc'] . ' and ' . $this->info['players_cc2'] . ''; + $this->hodID++; + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'Бой закончен, ничья.'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + + $this->saveLogs($this->info['id'], 'all'); + //$this->hodID++; + + if ($this->info['type'] == 99) { + //$this->hodID++; + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'И победители стали калечить проигравших...'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + $i = 0; + $vtvl = ''; + $tr_nm = [ + 1 => 'легкую', + 2 => 'среднюю', + 3 => 'тяжелую', + 4 => 'неизлечимую', + ]; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->info['team_win']) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); + if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { + if ($this->info['smert'] == 1) { + $tr_tp = 4; + } else { + $tr_tp = rand(1, 3); + } + if (isset($tr_pl['id'])) { + $tr_tp = rand(($tr_pl['v1'] + 1), 3); + } + if ($this->users[$i]['sex'] == 1) { + $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение: ' . $tr_nm[$tr_tp] . ' травму.
' . $vtvl; + } else { + $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение: ' . $tr_nm[$tr_tp] . ' травму.
' . $vtvl; + } + $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); + } + } + $i++; + } + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + + if ($vl != '') { + $vl = rtrim($vl, ','); + mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ' . $vl . ''); + } + + mysql_query('INSERT INTO `battle_end` (`battle_id`,`city`,`time`,`team_win`) VALUES ("' . $this->info['id'] . '","' . $this->info['city'] . '","' . $this->info['time_start'] . '","' . $this->info['team_win'] . '")'); + } + + + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + //$vtvl = ''; + //$ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.$mass['time'].'","'.$mass['battle'].'","'.$mass['id_hod'].'","'.$vtvl.'","'.$mass['vars'].'","'.$mass['zona1'].'","'.$mass['zonb1'].'","'.$mass['zona2'].'","'.$mass['zonb2'].'","'.$mass['type'].'")'); + $i = 0; + $vtvl = ''; + $tr_nm = [ + 1 => 'легкую', + 2 => 'среднюю', + 3 => 'тяжелую', + 4 => 'неизлечимую', + ]; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->info['team_win'] && $this->info['team_win'] > 0) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 292 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" LIMIT 1')); + + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + + if (isset($tr_pl['id'])) { + if (rand(0, 100) < $tr_pl['data']) { + $tr_tp = rand(1, 3); + if (isset($tr_pl['id'])) { + $tr_tp = rand(($tr_pl['v1'] + 1), 3); + } + if ($this->users[$i]['sex'] == 1) { + $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
' . $vtvl; + } else { + $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
' . $vtvl; + } + $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); + } + } + } + $i++; + } + if ($vtvl != '') { + if ($this->info['type'] != 99) { + $vtvl2 = 'И победители стали калечить проигравших...'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + + //Турнир БС + if ($this->info['inTurnir'] > 0 && $this->info['dungeon'] != 15 && $u->info['room'] != 413) { + $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->info['inTurnir'] . '" LIMIT 1')); + $i = 0; + $j = 0; + while ($i < count($this->users)) { + if ($this->stats[$i]['hpNow'] < 1 && $this->users[$i]['clone'] == 0 && $this->stats[$i]['clone'] == 0) { + //Удаляем из БС + //echo '['.$this->users[$i]['login'].']'; + //Добавляем в лог БС + if ($this->users[$i]['sex'] == 0) { + $text .= '{u1} повержен и выбывает из турнира'; + } else { + $text .= '{u1} повержена и выбывает из турнира'; + } + //Выкидываем предметы с персонажа + $spik = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` ="0"'); + while ($plik = mysql_fetch_array($spik)) { + /* + БС-1 + mysql_query('INSERT INTO `bs_items` (`x`,`y`,`bid`,`count`,`item_id`) VALUES ( + "'.$this->users[$i]['x'].'","'.$this->users[$i]['y'].'","'.$bs['id'].'","'.$bs['count'].'","'.$plik['item_id'].'" + )'); + */ + mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $plik['item_id'] . '","' . (time() - 600) . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '" + )'); + } + unset($spik, $plik); + // + $usrreal = ''; + $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $this->users[$i]['login'] . '" AND `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (!isset($usr_real['id'])) { + $usr_real = $this->users[$i]; + } + if (isset($usr_real['id'])) { + $usrreal = ''; + if ($usr_real['align'] > 0) { + $usrreal .= ''; + } + if ($usr_real['clan'] > 0) { + $usrreal .= ''; + } + $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + $text = str_replace('{u1}', $usrreal, $text); + mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", + "' . round($bs['money'] * 0.85, 2) . '","' . $i . '" + )'); + // + //Удаление клона + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + //Обновление персонажа + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `login` = "' . $this->users[$i]['login'] . '" OR `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //Обновляем заявку + mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `inBot` = "' . $this->users[$i]['id'] . '" AND `off` = "0" LIMIT 1'); + unset($text, $usrreal, $usr_real); + if ($this->users[$i]['pass'] != 'bstowerbot') { + $bs['users']--; + $bs['users_finish']++; + } else { + $bs['arhiv']--; + } + $j++; + } + $i++; + } + if ($j > 0) { + mysql_query('UPDATE `bs_turnirs` SET `arhiv` = "' . $bs['arhiv'] . '",`users` = "' . $bs['users'] . '",`users_finish` = "' . $bs['users_finish'] . '" WHERE `id` = "' . $bs['id'] . '" LIMIT 1'); + } + + unset($bs, $j); + } + + //Награда за события + if ($this->info['type'] == 500 && isset($tststrt['id'])) { + //Предметы которые выпадают в центр + + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['no_ip'] == 'trupojor') { + $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (isset($mon['id'])) { + if ($this->info['team_win'] == 0) { + //Ничья + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + $mon['nich_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + } elseif ($this->info['team_win'] != $this->users[$i]['team']) { + //Выиграли + $j = 0; + $usrwin = ''; + while ($j < count($this->users)) { + if ($this->users[$j]['no_ip'] != 'trupojor' && $this->users[$j]['bot'] == 0) { + if ($this->stats[$j]['hpNow'] > 0) { + $usrwin .= ', '; + if ($this->users[$j]['align'] > 0) { + $usrwin .= 'users[$j]['align'] . '.gif >'; + } + if ($this->users[$j]['clan'] > 0) { + $usrwin .= 'users[$j]['clan'] . '.gif >'; + } + $usrwin .= '' . $this->users[$j]['login'] . ' [' . $this->users[$j]['level'] . ']users[$j]['id'] . ' >'; + } + } + $j++; + } + if ($usrwin != '') { + $usrwin = ltrim($usrwin, ', '); + } else { + $usrwin = 'Команда героев'; + } + + + mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + /*$truptime=mysql_fetch_array(mysql_query('SELECT `s`.`id` , `s`.`res_x` FROM `stats` AS `s` WHERE `s`.`id` IN (SELECT `u`.`id` FROM `users` AS `u` WHERE `u`.`no_ip` = "trupojor") ORDER BY `s`.`res_x` DESC LIMIT 1')); + $truptimelast=$truptime['res_x']+2700; + if ($truptimelast > (time()+10080) || $truptimelast < time() ) + { + $truptimelast=time()+10080; + }*/ + // if ($this->users[$i]['level']>9) + // { + $truptimelast = time() + rand(1800, 3600); + //} + // else + // {$truptimelast=time()+10080;} + + + mysql_query('UPDATE `stats` SET `res_x` = "' . $truptimelast . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + str_replace('{u}', $usrwin, + $mon['win_text']))) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + unset($usrwin); + } else { + //Проиграли + if ($mon['win_back'] == 1) { + mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + $mon['lose_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + } + } + } + $i++; + } + } + } + + // выкидываем ботов из боя + $i = 0; + $botsi = 0; + if (isset($tststrt['id'])) { + while ($i < count($this->users)) { + //Тут выкидываем юзеров из Призавого хаота + if ($this->info['type'] == 33) { + $plde = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (isset($plde['mail']) && $plde['mail'] == "haot@new-combats.com") { + $pld = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + + if (isset($pld['id'])) { + if ($this->users[$i]['battle_yron'] >= 500) { + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $pld['battle_text'] .= ' За Героическое Сражение вы получаете Реликвия Ангела (x5). '; + mysql_query('UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); + + + if ($this->users[$i]['team'] == $this->info['team_win']) { + if (rand(1, 100) <= 5) { + $u->addItem(10020, $pld['id'], ''); + $pld['battle_text'] .= ' и Жетон Успеха. '; + } + } + } else { + $pld['battle_text'] .= ' Вы ничего не получили. Нужно набить больше 500 урона урона .'; + } + + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $pld['city'] . "','" . $pld['room'] . "','','" . $pld['login'] . "','" . $pld['battle_text'] . "','-1','6','0')"); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + } + + unset ($plde, $pld); + } + + if ($this->users[$i]['bot'] == 1) { + $botsi++; + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } elseif ($this->users[$i]['bot'] == 2) { + $this->users[$i]['battle'] = 0; + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`timeGo` = "'.time().'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } elseif ($this->users[$i]['bot'] > 0) { + $this->users[$i]['battle'] = 0; + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } + if ($this->users[$i]['clone'] > 0 && $this->users[$i]['bot'] > 0 && isset($this->users[$this->uids[$this->users[$i]['clone']]]['id']) && $this->users[$this->uids[$this->users[$i]['clone']]]['team'] != $this->users[$i]['team']) { + //Добавляем что клон побежден + if ($this->users[$this->uids[$this->users[$i]['clone']]]['team'] == $this->info['team_win']) { + $u->addAction(time(), 'win_bot_clone', '', $this->users[$i]['clone']); + } elseif ($this->info['team_win'] == 0) { + $u->addAction(time(), 'nich_bot_clone', '', $this->users[$i]['clone']); + } else { + $u->addAction(time(), 'lose_bot_clone', '', $this->users[$i]['clone']); + } + } elseif ($this->users[$i]['bot'] > 0 && $this->users[$i]['bot_id'] > 0) { + //Добавляем что бота победили + $j = 0; + while ($j < count($this->users)) { + if ($this->users[$j]['bot'] == 0 && $this->users[$j]['team'] != $this->users[$i]['team']) { + if ($this->users[$j]['team'] == $this->info['team_win']) { // if($this->users[$j]['team']==$this->info['team_win']){ + $u->addAction(time(), 'win_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + // + mysql_query('UPDATE `dialog_act` SET `now` = `now` + 1 WHERE `uid` = "' . $this->users[$j]['id'] . '" AND + ( `btl_bot` LIKE "' . $this->users[$i]['bot_id'] . '!%" OR `btl_bot` LIKE "%!' . $this->users[$i]['bot_id'] . '!%" ) + AND `val` != 1 + LIMIT 1'); + // + } elseif ($this->info['team_win'] == 0) { + $u->addAction(time(), 'nich_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + } else { + $u->addAction(time(), 'lose_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + } + } + $j++; + } + } + $i++; + } + } + + $botss = []; + if (true == true) { + if ($nl != 10) { + //Из бота падают предметы + if ($this->info['dungeon'] > 0) { + if ($this->info['team_win'] == $u->info['team'] && $this->info['dungeon'] == 102) { + $j1 = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->info['dn_id'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1')); + if (isset($j1['id'])) { + mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $j1['id'] . '" LIMIT 1'); + //Выпадает шмотка + mysql_query('INSERT INTO `laba_obj` (`use`,`lib`,`time`,`type`,`x`,`y`,`vars`) VALUES ( + "0","' . $j1['lib'] . '","' . time() . '","6","' . $j1['x'] . '","' . $j1['y'] . '","' . (0 + $botsi) . '" + )'); + } + } elseif ($this->info['team_win'] == $u->info['team']) { + //выйграли люди, выкидываем предметы из мобов + $j1 = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->info['y'] . '" LIMIT 100'); + while ($tbot = mysql_fetch_array($j1)) { + $j2 = 0; + while ($j2 < $tbot['colvo']) { + if (isset($tbot['id2'])) { + $tbot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $tbot['id_bot'] . '" LIMIT 1')); + $itms = explode('|', $tbot2['p_items']); + $tii = 0; + $testdrop = 0; + while ($tii < count($itms) && $testdrop == 0) { + $itmz = explode('=', $itms[$tii]); + if ($itmz[0] > 0) { + if (isset($itmz[2]) && $itmz[2] != '') { // $itmz[2] == quest888 + $questDrop = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%' . $itmz[2] . '%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); + } + if (isset($questDrop['id'])) { // Если квест есть, предмет имеет шанс выпасть + } elseif (isset($itmz[2]) && $itmz[2] != '') { + $itmz[1] = 0; + } // Если предмет квестовый, а квеста у игрока нет, то предмет выпадет с вероятностью 0 + unset($questDrop); + + //Добавляем этот предмет в зону Х и У + if ($itmz[1] * 100000 >= rand(1, 10000000)) { + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz[0] . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + if (!isset($questDrop['id'])) { + $testdrop = 1; //ТУТ drop-drop //quest + } + } + } + $tii++; + } + } + $j2++; + } + // + //Квест 1-15 сентября, + if (date('m') == 9 && date('d') < 15) { + if ($this->get_chanse(99) == true) { + //Не выпало + } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 101) { + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmz = [ + rand(4745, 4751), + 100, + ]; + // + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz[0] . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + } + } + // + //Странички саныча, + + if (rand(1, 100) <= 99) { + //Не выпало + } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 3 || + $this->info['dungeon'] == 101 || $this->info['dungeon'] == 16 || + $this->info['dungeon'] == 9 || $this->info['dungeon'] == 10 || + $this->info['dungeon'] == 13 || $this->info['dungeon'] == 106) { + $tou = 0; //какому юзеру предназначено + // выделяем случайного юзера из команды + $itmz = rand(3143, 3192); + // + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + } + } + # mysql_query('UPDATE `dungeon_bots` SET `delete` = "'.time().'" WHERE `dn` = "'.$this->info['dn_id'].'" AND `for_dn` = "0" AND `x` = "'.$this->info['x'].'" AND `y`= "'.$this->info['y'].'" AND `delete` = "0" '); + mysql_query('UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" '); + } else { + //выкидываем всех игроков в клетку RESTART + $dnr = 1; + if ($this->info['dungeon'] != 102) { + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `y`= "' . $this->info['y'] . '"'); + } + } + } + } + + $gm = []; + $gms = []; + $bm = []; + $bms = []; + + //Квестовый раздел + //Квестовый раздел + + //завершаем поединок + $i = $this->uids[$u->info['id']]; + + if ($this->info['team_win'] >= 0) { + //Выходные +100% опыта + /* + if(date('w') == 0 || date('w') == 6) { + $this->stats[$i]['exp'] += 100; + } + */ + + /*if( date('d.m') == '15.05' ) { + //Оналйн 40 чел (54, но стабильный 40) + //$this->stats[$i]['exp'] += 100; + }elseif( date('d.m') == '13.06' ) { + //Ддос атака + //$this->stats[$i]['exp'] += 100; + }*/ + + if ($this->stats[$i]['pbe'] > 0) { + //Бонус покупателя + $this->expCoef += $this->stats[$i]['pbe']; + } + + if ($this->info['razdel'] == 5) { + if ($c['m'] >= 6 && $c['m'] <= 8) { + //Летний период + $this->expCoef += 5; + } elseif ($c['w'] == 0 || $c['w'] == 6) { + //Выходные дни + $this->expCoef += 5; + } + } + + $this->stats[$i]['exp'] += $this->expCoef; + + $this->stats[$i]['exp'] += $this->aBexp * $c['exp']; + + if ($this->stats[$i]['os4'] > 0) { + $this->stats[$i]['exp'] += $this->stats[$i]['os4']; + } + + /*if($this->stats[$i]['silver']>0) { + $this->stats[$i]['exp'] += 5*$this->stats[$i]['silver']; + if($this->stats[$i]['bonusexp'] > 1) { // Для покупки опыта (получает максимум) + $this->stats[$i]['exp'] += 1000*$this->stats[$i]['bonusexp']; + } + //if($this->stats[$i]['speeden']>20) { // Для восстановления энергии (получает максимум) + //$this->stats[$i]['enNow'] += $this->stats[$i]['speeden']; + + //$upd2 = mysql_query('UPDATE `stats` SET `enNow` = "'.$this->users[$i]['enNow'].'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + //} + }*/ + + $act01 = 0; + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] + ($this->users[$i]['battle_exp'] / 100 * (1 + $this->info['addExp'] + $this->stats[$i]['exp']))); + + if ($this->info['type'] == 564) { + //Бой с копией + $this->users[$i]['battle_exp'] = 0; + } + + if ($this->info['dungeon'] == 104) { + $this->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->uids) - 1); + } elseif ($this->info['dungeon'] > 0 && $this->users[$i]['dnow'] != 0 && $this->info['dungeon'] != 1 && $this->users[$i]['team'] == $this->info['team_win']) { + $dun_limitForLevel = [ + 4 => 750, + 5 => 1500, + 6 => 3500, + 7 => 8000, + 8 => 25000, + 9 => 50000, + 10 => 75000, + 11 => 100000, + 12 => 100000, + 13 => 100000, + 14 => 100000, + ]; + // Максимум для каждого уровня. + + if ($this->users[$i]['battle_exp'] > 0) { + $dun_exp = []; // Текущий лимит опыта игрока в подземельях. + $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + $rep = explode(',', $rep['dungeonexp']); + foreach ($rep as $key => $val) { + $val = explode('=', $val); // текущий лимит опыта в подземке + if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { + $dun_exp[(int)$val[0]] = (int)$val[1]; + } + } + unset($rep); + } + + if (!isset($dun_exp[$this->info['dungeon']])) { + $dun_exp[$this->info['dungeon']] = 0; + } + + if (!isset($dun_limitForLevel[(int)$this->users[$i]['level']])) { // Если лимит не задан, опыт не даем. + $this->users[$i]['battle_exp'] = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$i]['level']] + ) { // Если лимит уже достигнут, опыт не даем. + $this->users[$i]['battle_exp'] = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_limitForLevel[(int)$this->users[$i]['level']] > $dun_exp[$this->info['dungeon']] + ) { // Если текущая репутация не достигла лимита. + if (($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->users[$i]['level']]) { + // Если опыта набрано достаточно, для достижения лимита. + $this->users[$i]['battle_exp'] = abs($this->users[$i]['battle_exp'] - abs($dun_limitForLevel[(int)$this->users[$i]['level']] - ($this->users[$i]['battle_exp'] + $dun_exp[$this->info['dungeon']]))); + $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; + } elseif ($dun_limitForLevel[(int)$this->users[$i]['level']] > ($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp'])) { + // Если опыта недостаточно, для достижения лимита. + $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']; + $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; + } else { + $this->users[$i]['battle_exp'] = 0; + } + } else { // В любой непонятной ситуцаии. + $this->users[$i]['battle_exp'] = 0; + } + + + if ($this->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->info['dungeon']]) && $dun_exp[$this->info['dungeon']] > 0) { + $dunexp = []; + foreach ($dun_exp as $key => $val) { + $dunexp[$key] = $key . '=' . $val; // текущий лимит опыта в подземке + } + $dun_exp = implode(",", $dunexp); + mysql_query('UPDATE `rep` SET `dungeonexp` = "' . $dun_exp . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + unset($dunexp, $dun_exp); + } + unset($dun_limitForLevel); + } + + $sinf = ''; + if ($c['exp_mega'] == true) { + $this->users[$i]['battle_exp'] += floor($this->users[$i]['battle_exp'] / 100 * $c['exp_mega_val'][$this->users[$i]['level']]); + } + + /*if( $this->users[$i]['level'] < 8 ) { + $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*10; + }elseif( $this->users[$i]['level'] < 9 ) { + //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*2; + }*/ + + if ($this->info['team_win'] == 0 && $this->info['type'] != 564) { + //ничья + if ($this->info['razdel'] == 5) { + //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( + //"'.$this->users[$i]['id'].'","'.time().'","10")'); + } + //$sinf .= ' ничья '; + if ($this->users[$i]['level'] <= 1) { + $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] * 0.50); + } else { + //$this->users[$i]['battle_exp'] = 0; + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); + } + $this->users[$i]['nich'] += 1; + // + mysql_query('UPDATE `users` SET `swin` = 0, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + // + } elseif ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['type'] != 564) { + //выйграл + if ($this->info['razdel'] == 5) { + //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( + //"'.$this->users[$i]['id'].'","'.time().'","30")'); + } + //$sinf .= ' выиграли '; + $gm[$i] = $this->info['money']; + + $gms[$i] = $this->info['money3']; + + $this->users[$i]['win'] += 1; + $act01 = 1; + // + mysql_query('UPDATE `users` SET `swin` = `swin` + 1, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + // + } elseif ($this->info['type'] != 564) { + //проиграл + if ($this->info['razdel'] == 5) { + //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( + //"'.$this->users[$i]['id'].'","'.time().'","10")'); + } + //$sinf .= ' проиграли '; + if ($this->users[$i]['level'] <= 1) { + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.33); + } else { + //$this->users[$i]['battle_exp'] = 0; + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); + } + $bm[$i] = $this->info['money']; + + $bms[$i] = $this->info['money3']; + + $this->users[$i]['lose'] += 1; + + mysql_query('UPDATE `users` SET `swin` = 0, `slose` = `slose` + 1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + // + $act01 = 2; + } + if ($this->users[$i]['level'] < 4) { + //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*3; + } + //$sinf .= ' '.$this->info['id'].'-'.$this->info['team_win'].'-'.$relbf.'-'.$this->users[$i]['team'].'-'.$tl .' '; + // + //Рассчитываем кол-во выигрышных сумм и кто сколько получил (для екр.) + if ($this->info['money3'] > 0 && isset($gms[$i]) && $this->info['type'] != 564) { + $mn = [ + 'l' => 0, //сколько проигравших игроков + 'w' => 0, //сколько выигрывших игроков + 'm' => 0 //сумма выигрыша (общая) + ]; + if ($act01 == 1) { + $mn['l'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` != "' . $this->users[$i]['team'] . '" LIMIT 1')); + $mn['l'] = $mn['l'][0]; + $mn['w'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` = "' . $this->users[$i]['team'] . '" LIMIT 1')); + $mn['w'] = $mn['w'][0]; + $mn['m'] = round(($mn['l'] * $this->info['money3']) / 100 * 87, 2); + $gms[$i] = round(($mn['m'] / $mn['w']), 2); + } + } + // + //заносим данные в БД + //Поломка предметов + if ($act01 == 1) { + //победа + if ($this->users[$i]['dnow'] == 0) { + if ($this->users[$i]['hpNow'] < 1) { + $lom = 0.05; + } + } + } elseif ($act01 == 2) { + //поражение + $lom = 0.55; + } else { + //ничья + $lom = 0.05; + } + //$lom = round($lom*2.75,2); + $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)]; + if ($this->info['type'] == 564) { + $lom = 0; + } + if ($this->stats[$i]['silver'] >= 4) { + $lom = 0; + } + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW`+' . $lom . ' WHERE `inOdet` < "18" AND `inOdet` > "0" AND `uid` = "' . $this->users[$i]['id'] . '" AND `inOdet`!="0" AND `inOdet`!=' . $nlom[0] . ' AND `inOdet`!=' . $nlom[1] . ' AND `inOdet`!=' . $nlom[2] . ' AND `inOdet`!=' . $nlom[3] . ' LIMIT 18'); + + $prc = ''; + if ($this->users[$i]['align'] == 2) { + $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] / 2); + } + if ($this->users[$i]['animal'] > 0) { + $ulan = $u->testAction('`uid` = "' . $this->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->info['id'] . '" LIMIT 1', + 1); + if (isset($ulan['id']) && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['level'] > $ulan['vals']) { + $a004 = mysql_fetch_array(mysql_query('SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); + //33% от опыта переходит зверю, но не более максимума + $aexp = (round($this->users[$i]['battle_exp'] / 100 * 33)); + if ($aexp > $a004['max_exp']) { + $aexp = $a004['max_exp']; + } + unset($ulan); + // + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat` + ) VALUES ( + '1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "' + ,'Ваш питомец "" . $a004['name'] . "" получил опыт: " . $aexp . "','-1','6','0')"); + // + $upd = mysql_query('UPDATE `users_animal` SET `exp` = `exp` + ' . $aexp . ' WHERE `id` = "' . $this->users[$i]['animal'] . '" AND `level` < ' . $this->users[$i]['level'] . ' LIMIT 1'); + if ($upd) { + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 100 * 67); + $this->info['addExp'] -= 33.333; + } + } + } + + $prsusers = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" LIMIT 1')); + unset($prsusers); + $btlstatus = $this->typeBattle($prsusers[0]); + if ($this->info['smert'] == 1) { + $btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; + } + // + if ($this->stats[$i]['clanpos'] > 0) { + if ($this->stats[$i]['clanpos'] == 1) { + $this->info['addExp'] += 0; + } elseif ($this->stats[$i]['clanpos'] == 2) { + $this->info['addExp'] += 0; + } elseif ($this->stats[$i]['clanpos'] == 3) { + $this->info['addExp'] += 0; + } + } + + unset($r1); + //Статусная битва + if ($btlstatus[0] > 0) { + if ($this->info['type'] == 99) { + $this->info['addExp'] += $btlstatus[1]; + } else { + $this->info['addExp'] += $btlstatus[0]; + } + } + + if ($this->users[$i]['align'] == 2 || $this->users[$i]['haos'] > time()) { + $this->stats[$i]['exp'] = -($this->info['addExp'] + 50); + } + if ($this->info['addExp'] + $this->stats[$i]['exp'] != 0) { + $prc = ' (' . (100 + $this->info['addExp'] + $this->stats[$i]['exp']) . '%)'; + } + if ($this->info['money'] > 0) { + if (isset($gm[$i])) { + $prc .= ' Вы выйграли ' . $gm[$i] . ' кр. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж выйграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money'] += $gm[$i]; + } elseif (isset($bm[$i])) { + $prc .= ' Вы заплатили ' . $bm[$i] . ' кр. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж проиграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money'] -= $bm[$i]; + } + } + // + if ($c['money_haot'] == true && $this->users[$i]['exp'] <= 200000000) { + if ($act01 == 1 && $this->info['razdel'] == 5 && $this->users[$i]['level'] >= 8) { + //Сколько нужно опыта набить + $trexp = [ + 8 => 1200, + 9 => 3000, + 10 => 4500, + 11 => 12000, + 12 => 20000, + 13 => 30000, + 14 => 30000, + 15 => 30000, + 16 => 30000, + 17 => 30000, + 18 => 30000, + 19 => 30000, + 20 => 30000, + 21 => 30000, + ]; + $trexp = $trexp[$this->users[$i]['level']]; + + //Какая цена фулла должна быть + $trmn = [ + 8 => 1000, + 9 => 3000, + 10 => 2500, + 11 => 3000, + 12 => 3000, + 13 => 3000, + 14 => 3000, + 15 => 3000, + 16 => 3000, + 17 => 3000, + 18 => 3000, + 19 => 3000, + 20 => 3000, + 21 => 3000, + ]; + $trmn = $trmn[$this->users[$i]['level']]; + + //Сколько екр дается + $admn = [ + 8 => 0.05, //0.05 + 9 => 0.065, //0.065 + 10 => 0.075, //0.075 + 11 => 0.085, //0.085 + 12 => 0.1, //0.1 + 13 => 0.1, + 14 => 0.1, + 15 => 0.1, + 16 => 0.1, + 17 => 0.1, + 18 => 0.1, + 19 => 0.1, + 20 => 0.1, + 21 => 0.1, + ]; + $admn = $admn[$this->users[$i]['level']]; + + if ($c['m'] >= 6 && $c['m'] <= 8) { + //Летний период + if ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { + //Выходные дни + $admn = $admn * 2; + } + } elseif ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { + //Выходные дни + $admn = $admn * 2; + } + if ($this->users[$i]['battle_exp'] < $trexp) { + //недостаточно опыта набито за бой + $prc .= ', Награда 0 ЕКР за этот бой (Мало опыта набили).'; + //}elseif( $this->stats[$i]['prckr'] < $trmn ) { + //недостаточно стоимость кр вещей + //$prc .= ', Награда 0 ЕКР за этот бой (У вас дешевый комплект).'; + } elseif ($admn > 0) { + if ($this->info['type'] != 33) { + $prc .= ', Награда ' . $admn . ' ЕКР за этот бой.'; + } + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж получил ' . $admn . ' ЕКР (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money2'] += $admn; + } + + //$bnsv = 0.50; + /* + if( $this->info['otmorozok_use'] > 0 ) { + $bnsv += 1; + } + if( $c['w'] == 0 || $c['w'] == 6 ) { + $bnsv += 0.50; + } + $admnb = round($bnsv+(($this->stats[$i]['prckr']/100)*$c['money_haot_proc']),2); + if($act01!=1) { + $admnb = round($admnb/10,2); + } + */ + /*$admnb = 0; + // + if( $admnb >= 0.01 ) { + $adexp = array( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 3000, + 9 => 5000, + 10 => 8000, + 11 => 12000, + 12 => 20000, + 13 => 30000, + 14 => 30000, + 15 => 30000, + 16 => 30000, + 17 => 30000, + 18 => 30000, + 19 => 30000, + 20 => 30000, + 21 => 30000 + ); + $adexp = $adexp[$this->users[$i]['level']]; + if( $adexp > 0 && $adexp > ) { + if($act01!=1) { + $adexp = round($adexp/10); + } + //$uzrbtl = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "'.$this->info['id'].'" AND `login` NOT LIKE "%(%)&" AND `align` != "" LIMIT 1')); + //$uzrbtl = $uzrbtl[0]; + if( $this->users[$i]['battle_exp'] < $adexp ) { + //Нет награды т.к. не набрали минимального опыта + $prc .= ', Награда 0 ЕКР за этот бой, набивайте больше урона.'; + }else{ + $prc .= ', Награда '.$admnb.' ЕКР за этот бой.'; + $u->addDelo(4,$this->users[$i]['id'],'"System.battle": Персонаж получил '.$admnb.' ЕКР (В бою №'.$this->info['id'].').',time(),$this->info['city'],'System.battle',0,0); + $this->users[$i]['money2'] += $admnb; + } + } + // + $minpsh = 0; + if($act01==1){ + //победа + $minpsh = 25; + }elseif($act01==2){ + //поражение + $minpsh = 15; + }else{ + //ничья + $minpsh = 15; + } + if( $c['w'] == 0 || $c['w'] == 6 ) { + $minpsh += 10; + } + if( $minpsh > 0 ) { + mysql_query('UPDATE `actions` SET `time` = `time` - "'.($minpsh*60).'" WHERE `vars` LIKE "psh0" AND `uid` = "'.$this->users[$i]['id'].'"'); + $prc .= ', Задержка посещение пещер уменьшена на '.$minpsh.' минут.'; + } + // + */ + } + } + // + if ($this->info['money3'] > 0) { + if (isset($gms[$i])) { + $prc .= ' Вы выйграли ' . $gms[$i] . ' $. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж выйграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money3'] += $gms[$i]; + mysql_query('UPDATE `users` SET `money3` = `money3` + "' . $gms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } elseif (isset($bms[$i])) { + $prc .= ' Вы заплатили ' . $bms[$i] . ' $. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж проиграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money3'] -= $bms[$i]; + mysql_query('UPDATE `users` SET `money3` = `money3` - "' . $bms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + } + /*if($this->info['kingfight']==1 && $this->info['type'] != 564 ) { + //Призовой поединок + if($this->info['team_win'] == 0) { + + }elseif($this->users[$i]['team'] == $this->info['team_win']){ + $bnks = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$this->users[$i]['id'].'" ORDER BY `useNow` DESC LIMIT 1')); + if(isset($bnks['id'])) { + $bnks['msn'] = round($this->user[$i]['level']/50,2); + $bnks['msn'] = 0.15; + mysql_query('UPDATE `bank` SET `money2` = `money2` + "'.mysql_real_escape_string($bnks['msn']).'" WHERE `id` = "'.$bnks['id'].'" LIMIT 1'); + $prc .= ' Вы получили приз: '.$bnks['msn'].' екр., банк №'.$bnks['id'].''; + + } + unset($bnks); + } + }*/ + + /* + 7ур - 10800 + 8ур - 36000 + 9ур - 56000 + 10ур - 86000 + if($this->users[$i]['battle_exp'] > (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755) { + $this->users[$i]['battle_exp'] = (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755; + } + */ + + //$lime = array(8=>18000,9=>28000,10=>84000,11=>150000); + $lime = [ + 8 => 18000, + 9 => 28000, + 10 => 84000, + 11 => 100, + 12 => 100, + 13 => 100, + 14 => 100, + 15 => 100, + 16 => 100, + 17 => 100, + 18 => 100, + 19 => 100, + 20 => 100, + 21 => 100, + ]; + + if ($this->users[$i]['level'] < 8) { + $lime = 5400; + } else { + $lime = $lime[$this->users[$i]['level']]; + } + + if ($this->stats[$i]['silver'] >= 5) { + $lime += round($lime); + } + + /*if( $this->stats[$i]['silver'] > 0 ) { + $lime += floor($lime/100*(10*$this->stats[$i]['silver'])); + }*/ + + if ($this->users[$i]['stopexp'] == 1) { + $lime = 0; + $this->users[$i]['battle_exp'] = 0; + } + + if ($lime < $this->users[$i]['battle_exp'] && $c['limitedexp'] == true) { + $this->users[$i]['battle_exp'] = $lime; + } + // + /*if( $this->users[$i]['battle_exp'] > 100 && $this->info[$i]['level'] == 6 ) { + $this->users[$i]['battle_exp'] = 100; + }*/ + // + unset($lime); + + + //if(100+$this->info['addExp']+$this->stats[$i]['exp'] > 1000) { + //$prc .= ' (Великая Битва)'; + //} + + if ($btlstatus[0] > 0) { + if ($this->info['type'] == 99) { + $prc .= ' (' . $btlstatus[3] . ')'; + } else { + $prc .= ' (' . $btlstatus[2] . ')'; + } + } + + if ($this->info['dungeon'] == 1 && $this->users[$i]['team'] == $this->info['team_win']) { + //канализация лимит + $rep = mysql_fetch_array(mysql_query('SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if ($rep['dl' . $this->info['dungeon']] > 0) { + $this->users[$i]['battle_exp'] += 3 * count($this->users); + if ($rep['dl' . $this->info['dungeon']] > $this->users[$i]['battle_exp']) { + $rep['dl' . $this->info['dungeon']] -= $this->users[$i]['battle_exp']; + } else { + $this->users[$i]['battle_exp'] = $rep['dl' . $this->info['dungeon']]; + $rep['dl' . $this->info['dungeon']] = 0; + } + mysql_query('UPDATE `rep` SET `dl' . $this->info['dungeon'] . '` = "' . $rep['dl' . $this->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'); + } else { + $this->users[$i]['battle_exp'] = 0; + } + } + + if ($this->users[$i]['battle_exp'] < 1) { + $this->users[$i]['battle_exp'] = 0; + } + + if ($this->users[$i]['battle_exp'] < 1 && $this->users[$i]['twink'] == 0) { + if ($this->info['money'] == 0 && $this->info['money3'] == 0 && $this->info['kingfight'] == 0 && (!isset($admnb) || $admnb == 0)) { + $prc = ''; + } + } + + if ($this->user[$i]['host_reg'] == 'real_bot_user') { + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 3); + } + + if ($sinf != '') { + $sinf = ' ( ' . $sinf . ' )'; + } + + /*if( $this->users[$i]['level'] >= 8 ) { + if( $this->users[$i]['battle_exp'] > 1000 ) { + $this->users[$i]['battle_exp'] = 1000; + } + }*/ + //--------------Лимит 8-9-------------- + + + if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) { + $this->users[$i]['battle_exp'] = 23000; + }; + // if ($this->users[$i]['level']==9 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/3);}; + if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) { + $this->users[$i]['battle_exp'] = 31000; + }; + // if ($this->users[$i]['level']==10 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; + if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) { + $this->users[$i]['battle_exp'] = 52000; + }; + // if ($this->users[$i]['level']==11 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; + if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) { + $this->users[$i]['battle_exp'] = 75000; + }; + //------------------------------------- + + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] = 'Бой закончен. Всего вами нанесено урона: ' . floor($this->users[$i]['battle_yron']) . ' HP. Получено опыта: ' . (0 + $this->users[$i]['battle_exp']) . '' . $prc . '.' . $sinf; //stats + } + + /*Выпадение зубов в конце боя */ + if ($c['nolevel'] == true) { + $rex95 = substr($this->users[$i]['exp'], -1); + if ($this->users[$i]['money4'] < 1000 && $this->users[$i]['exp'] == 12499) { + $rex95 = 6; + $rex95 = 5; + } + } else { + $rex95 = 5; + } + + + //echo '['.$rex95.']'; + if ($c['zuby'] == true && $this->info['dungeon'] == 0 && ($this->info['clone'] == 0 || $this->users[$i]['level'] < 5) && $rex95 != 9 && $this->info['type'] != 564) { + if ($this->users[$i]['align'] != 2 && $this->users[$i]['level'] >= 0 && $this->users[$i]['level'] < 8 && $this->users[$i]['battle_exp'] > 0) { + $rzb = 0; + + if ($this->get_chanse(50) == true) { + $rzb += rand(1, 3); + } else { + if ($this->users[$i]['battle_exp'] > 15) { + $rzb += 1; + } + } + + $chzbs = 100; + + if ($this->stats[$i]['silver'] > 0) { + $chzbs = 150; + } + + if ($this->users[$i]['battle_exp'] > 9) { + if ($this->users[$i]['level'] > 1) { + //Нормальный зуб + if ($this->get_chanse(25 / 100 * $chzbs) == true) { + $rzb += 10; + } + } elseif ($this->users[$i]['level'] == 1) { + if ($this->get_chanse(30 / 100 * $chzbs) == true) { + $rzb += 10; + } + } + + if ($this->users[$i]['level'] > 3) { + if ($this->get_chanse(5 / 100 * $chzbs) == true) { + $rzb += 100; + } + } + } + + if ($this->users[$i]['team'] == $this->info['team_win']) { + //выиграли + if ($this->users[$i]['level'] < 8) { + $rzb += 1; + } + } elseif ($this->users[$i]['team'] == 0) { + //ничья + if ($this->get_chanse(25 / 100 * $chzbs) == true && $this->users[$i]['battle_exp'] > 2) { + $rzb = rand(0, 1); + } else { + $rzb = 0; + } + } else { + //проиграли + if ($this->users[$i]['level'] >= 1) { + $rzb = 0; + } else { + if ($this->users[$i]['battle_exp'] < 3) { + $rzb = 0; + } elseif ($this->user[$i]['lose'] > $this->user[$i]['win']) { + if ($this->get_chanse(5 / 100 * $chzbs) == true) { + $rzb = rand(0, 1); + } else { + $rzb = 0; + } + } elseif ($this->get_chanse(10 / 100 * $chzbs) == true) { + $rzb = rand(0, 1); + } + } + $rzb = 0; + } + + if ($rex95 == 6 /*|| $this->users[$i]['exp'] == 12499 */) { + if ($this->users[$i]['battle_exp'] > 10) { + $rzb = rand(0, 1); + } else { + $rzb = 0; + } + } + + if ($rzb > 0 && rand(0, 1000) <= 500) { + $rzb = rand(1, 3); + } + if ($rzb > 0) { + if ($this->stats[$i]['silver'] >= 5) { + $rzb = $rzb * 2; + } + mysql_query('UPDATE `users` SET `money4` = `money4` + "' . $rzb . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + $this->users[$i]['battle_text'] .= ' Вы получили ' . $u->zuby($rzb, + 1) . ' за этот бой.'; + } + } + } + + if ($this->info['priz'] > 0) { + //Призовой хаот + /* + [4754] + 2-3 лвл = 1 жетон + 4-5 лвл = 1 жетона + 6-7 лвл = 2 жетонов + 8-9 лвл = 3 жетонов + В случаи победы (х3) + + */ + if ($this->info['type'] == 33)//ТУТ приз хаот дроп + { + /* + $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$this->users[$i]['id'].'" LIMIT 1')); + if (isset($pld['id'])) + { + $u->addItem(4754,$pld['id'],''); + $u->addItem(4754,$pld['id'],''); + $u->addItem(4754,$pld['id'],''); + $u->addItem(4754,$pld['id'],''); + $u->addItem(4754,$pld['id'],''); + $this->users[$i]['battle_text'] .= ' За Героическое Сражение вы получаете Реликвия Ангела (x5). '; + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "'.$pld['id'].'" LIMIT 1'); + mysql_query('DELETE FROM `users` WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$this->users[$i]['id'].'" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$this->users[$i]['id'].'" LIMIT 100'); + } + + if($this->users[$i]['team']==$this->info['team_win'] && isset($pld['id'])) + { + if(rand(1,100)<=5) + { + $u->addItem(10020,$pld['id'],''); + $this->users[$i]['battle_text'] .= ' и Жетон Успеха. '; + } + + } + */ + } else { + $tmon = [ + 2 => 1, + 3 => 1, + 4 => 1, + 5 => 1, + 6 => 1, + 7 => 2, + 8 => 3, + 9 => 3, + 10 => 5, + 11 => 5, + ]; + $tmon = $tmon[$this->users[$i]['level']]; + // + $tmonc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "' . $this->users[$i]['id'] . '" ) AND `priz` > 0 AND `time_start` > "' . strtotime(date('d.m.Y')) . '"')); + $tmonc = $tmonc[0]; + // + if ($this->users[$i]['team'] == $this->info['team_win']) { + //При выигрыше увеличиваем + if ($tmonc < 1) { + $tmonc = 1; + } elseif ($tmonc > 96) { + $tmonc = 96; + } + $tmon = ($tmon * $tmonc); + } + // + $tmoni = 1; + while ($tmoni <= floor($tmon / 2)) { + $u->addItem(4754, $this->users[$i]['id'], ''); // + $tmoni++; + } + // + $this->users[$i]['battle_text'] .= ' За призовой хаот вы получаете Призовой Жетон (x' . floor($tmon / 2) . '). (Чем больше призовых хаотов вы примите за сутки, тем больше будет выдаваться жетонов при победе! Призовых хаотов посещено сегодня ' . ($tmonc) . '/96 )'; + // + unset($tmon, $tmoni); + } + } + //Снижение времени Право на подвиг Титул за победу в хаоте + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['team'] == $this->info['team_win']) { + //ТУТ2 + $u->repexp_add($this->users[$i]['id'], 2); //Репутация за поб в хаоте +2 + $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); + if (isset($check['id'])) { + $urcheck = 10000; + if ($this->users[$i]['level'] == 8) { + $urcheck = 3000; + } elseif ($this->users[$i]['level'] == 9) { + $urcheck = 7000; + } elseif ($this->users[$i]['level'] == 10) { + $urcheck = 12000; + } elseif ($this->users[$i]['level'] >= 11) { + $urcheck = 18000; + } + + if ($this->users[$i]['battle_yron'] >= $urcheck) { + //UPDATE `eff_users` SET `timeUse` = '1555700000' WHERE `eff_users`.`id` = 31912807; + mysql_query('UPDATE `eff_users` SET `timeUse` = `timeUse` - 300 WHERE `id_eff`=478 AND `delete` = 0 AND `uid` =' . $this->users[$i]['id'] . ' LIMIT 1'); + $this->users[$i]['battle_text'] .= ' За победу в хаоте и нанесение урона в ' . $urcheck . ' и более вы получаете -5 мин. к праву на подвиг!'; + } + } + mysql_query('UPDATE `users_achiv` SET `vx`= `vx`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); // + + } + //Награда за клан вар + if ($this->info['dungeon'] == 0 && $this->info['type'] == 250 && $this->users[$i]['team'] == $this->info['team_win']) { + mysql_query('UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + if (date('w') == 0 || date('w') == 6 || date('w') == 4) { + $u->repexp_add($this->users[$i]['id'], 25); //Клановые войны(победа) 25 + } + } + //Награда за клан вар + if ($this->info['dungeon'] == 0 && $this->info['type'] == 99 && $this->users[$i]['team'] == $this->info['team_win']) { + if (date('w') == 0 || date('w') == 6 || date('w') == 5) { + $u->repexp_add($this->users[$i]['id'], 10); //Кровавые войны(победа) 10 + } + } + + //Новая выдача на трупожора + if ($this->info['dungeon'] == 0 && $this->info['type'] == 500 && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['no_ip'] != 'trupojor' && $this->users[$i]['bot'] == 0) { + if ($this->users[$i]['level'] > 9) { + $mid = 903093; + } else { + $mid = 89489; + } + $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $mid . '" LIMIT 1')); + + if ($this->users[$i]['battle_yron'] >= 2000) { + $ritem = rand(1, 100); + if ($ritem <= 20) { + $mon['win_itm'] = '4459@1'; + } elseif ($ritem <= 40) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 60) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 80) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } elseif ($this->users[$i]['battle_yron'] >= 1500) { + $ritem = rand(1, 100); + if ($ritem <= 20) { + $mon['win_itm'] = '4459@1'; + } elseif ($ritem <= 40) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 60) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 80) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } elseif ($this->users[$i]['battle_yron'] >= 1000) { + $ritem = rand(1, 100); + if ($ritem <= 25) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 50) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 75) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } else { + $mon['win_itm'] = '4392@1'; + $timewait = 0; + } + if ($this->users[$i]['battle_yron'] > 0) { + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '","Право на подвиг","pravonapodvig=1","' . time() . '")'); + } + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")'); + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'); + $ritem = rand(1, 1000); + if ($ritem == 555) { + $mon['win_itm'] = $mon['win_itm'] . ',5022@1'; + } + // + $this->addGlobalItems($mid, $this->users[$i]['id'], $mon['win_itm'], $mon['win_eff'], + $mon['win_ico'], 1, $mon['win_money1'], $mon['win_money2']); //$mon['win_exp'] + + } + + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $u->info['battle_yron'] >= 2000) //$u->info['battle_yron'] + { + //Реликвия Ангела ang_g + if ($this->users[$i]['team'] == $this->info['team_win']) { + //При выигрыше увеличиваем + $tmoni = 2; + } else { + $tmoni = 1; + } + + // + $tmon = $tmoni; + $effblago = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `delete` = 0 AND `id_eff`= 414 LIMIT 1')); + if (isset ($effblago['id'])) { + $limitg = 50; + } else { + $limitg = 25; + } + while ($tmoni >= 1) { + if ($u->info['ang_g'] < $limitg) { + $u->addItem(4754, $this->users[$i]['id'], ''); + mysql_query('UPDATE `users` SET `ang_g`=`ang_g`+1 WHERE `id` =' . $this->users[$i]['id'] . ''); + } else { + $tmon--; + } + $tmoni--; + } + + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] .= ' За хаот вы получаете Реликвия Ангела (' . $tmon . '). Всего [' . ($u->info['ang_g'] + $tmon) . '/' . $limitg . '] в день. '; + } + unset($tmon, $tmoni, $effblago, $limitg); + } + + + if ($this->info['razdel'] == 5 || $this->info['razdel'] == 4) { + if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) { + //Хэллоуин 4504 + $this->users[$i]['battle_text'] .= ' Вы получаете Тыква (x1).'; + $u->addItem(4504, $this->users[$i]['id'], '|sudba=1'); + } + } + + + //Добавляем воинственность + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['exp'] >= 1500 /*($this->users[$i]['exp'] < 12499 || $this->users[$i]['exp'] > 12500)*/ + ) { + if ($this->users[$i]['battle_exp'] > 100 * $this->users[$i]['level']) { + $rzbvo = $this->users[$i]['battle_exp'] * 6 / 1000; + + if ($this->users[$i]['level'] == 8) { + if ($rzbvo >= 100) { + $rzbvo = 100; + } + } + if ($this->users[$i]['level'] == 9) { + if ($rzbvo >= 150) { + $rzbvo = 150; + } + } + if ($this->users[$i]['level'] == 10) { + if ($rzbvo >= 200) { + $rzbvo = 200; + } + } + if ($this->users[$i]['level'] == 11) { + if ($rzbvo >= 250) { + $rzbvo = 250; + } + } + if ($this->users[$i]['level'] == 12) { + if ($rzbvo >= 250) { + $rzbvo = 250; + } + } + + + /*if( $this->info['players_c'] > 4 ) { + $rzbvo = 2*$this->info['players_c']; + }*/ + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] .= ' Вы получили ' . $rzbvo . ' воинственности за этот бой.'; + } + mysql_query('UPDATE `rep` SET `rep3` = `rep3` + "' . $rzbvo . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")'); + } + } + + if ($this->stats[$i]['hpNow'] >= 1) { + $this->stats[$i]['test_heal'] = mysql_fetch_array(mysql_query('SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->stats[$i]['test_heal'] = $this->stats[$i]['test_heal'][0]; + $this->stats[$i]['test_start'] = mysql_fetch_array(mysql_query('SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->stats[$i]['test_start'] = $this->stats[$i]['test_start']['hpStart']; + // + $this->stats[$i]['hpNow'] = ($this->stats[$i]['test_start'] - $this->stats[$i]['test_heal']); + if ($this->stats[$i]['hpNow'] < 1) { + $this->stats[$i]['hpNow'] = 1; + } + } else { + $this->stats[$i]['hpNow'] = 0; + } + /* + $this->stats[$i]['test_heal'] = ($this->stats[$i]['hpNow']-$this->stats[$i]['hpAll']) + $this->stats[$i]['test_heal']; + if($this->users[$i]['team']==$this->info['team_win']){ + //Обновляем НР после хила + $this->stats[$i]['hpNow'] -= $this->stats[$i]['test_heal']; + $this->users[$i]['hpNow'] = $this->stats[$i]['hpNow']; + if(floor($this->stats[$i]['hpNow']) < 0) { + $this->stats[$i]['hpNow'] = 0; + } + }else{ + $this->stats[$i]['hpNow'] = 0; + } + */ + unset($this->stats[$i]['test_heal']); + + $this->users[$i]['last_b'] = $this->info['id']; //stats + $this->users[$i]['last_a'] = $act01; + $this->users[$i]['battle'] = -1; //users + $this->users[$i]['battle_yron'] = 0; //stats + + $this->users[$i]['exp'] += $this->users[$i]['battle_exp']; //users + + /*if($this->stats[$i]['speeden']>2) { // Для восстановления энергии (получает максимум) + $this->users[$i]['enNow']+= $this->stats[$i]['enNow']; //users + $upd2 = mysql_query('UPDATE `stats` SET `enNow` = "'.$this->users[$i]['enNow'].'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + }*/ + //Добавляем клан опыт (Все кроме пещер) + + if ($this->users[$i]['clan'] > 0) { + $cpr = 1; + if ($this->info['typeBattle'] == 9) { + $cpr = 25; + } elseif ($this->info['typeBattle'] == 50) { + $cpr = 65; + } + if ($this->stats[$i]['silver'] >= 5) { + $cpr = floor($cpr / 100 * 150); + } + mysql_query('UPDATE `clan` SET `exp` = `exp` + "' . round($this->users[$i]['battle_exp'] / 100 * $cpr) . '" WHERE `id` = "' . $this->users[$i]['clan'] . '" LIMIT 1'); + } + + $this->users[$i]['battle_exp'] = 0; //stats + + if ($this->users[$i]['team'] == $this->info['team_win']) { + mysql_query('UPDATE `rep` SET `n_capitalcity` = `n_capitalcity` + ' . $this->users[$i]['bn_capitalcity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_demonscity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_suncity'] . ' WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + + //репутация + $this->users[$i]['bn_demonscity'] = 0; + $this->users[$i]['bn_capitalcity'] = 0; + $this->users[$i]['bn_suncity'] = 0; + //завершение эффектов с финишем + $spe = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `file_finish` != "" AND `v1` = "priem" LIMIT 30'); + while ($ple = mysql_fetch_array($spe)) { + if (file_exists('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php')) { + require('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php'); + } + } + //обновляем данные + mysql_query('DELETE FROM `eff_users` WHERE `v1` = "priem" AND `uid` = "' . $this->users[$i]['id'] . '" LIMIT 50'); + if ($dnr == 1) { + if ($this->users[$i]['room'] == 370) { + $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "dielaba" LIMIT 1')); + $dies = $dies[0]; + mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","dielaba","" + )'); + } else { + $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "die" LIMIT 1')); + $dies = $dies[0]; + mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","die","" + )'); + } + if ($dies < 2 || $this->info['dungeon'] == 15) { + // + $tshbn = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 AND `item_id` = "4910" LIMIT 1')); + if (isset($tshbn['id'])) { + //выбрасываем шайбу + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $tshbn['id'] . '" LIMIT 1'); + // + mysql_query('INSERT INTO `dungeon_obj` ( + `name`,`dn`,`x`,`y`,`img`,`delete`,`action`,`for_dn`, + `type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date` + ) VALUES ( + "Шайба","' . $this->info['dn_id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","shaiba.png","0","fileact:15/shaiba","0", + "0","120","220","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}" + )'); + // + } + //телепортируем в рестарт (координата 0х0) + $this->users[$i]['x'] = $this->users[$i]['res_x']; + $this->users[$i]['y'] = $this->users[$i]['res_y']; + $this->users[$i]['s'] = $this->users[$i]['res_s']; + $r_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `room` WHERE `id` = "' . (int)$this->users[$i]['room'] . '" LIMIT 1')); + if ($this->users[$i]['room'] == 370) { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в начале лабиринта'; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в начале лабиринта'; + } + } else { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в комнате "' . $r_n['name'] . '"'; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в комнате "' . $r_n['name'] . '"'; + } + } + } elseif ($this->info['dungeon'] == 102) { + $nld = ''; + $lab = mysql_fetch_array(mysql_query('SELECT `id`,`users` FROM `laba_now` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if ($lab['users'] < 2) { + //Удаляем подземелье + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //удаляем все предметы которые пропадают после выхода из пещеры + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")'); + if ($this->users[$i]['login'] != '') { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; + } + } + } else { + $tinf = mysql_fetch_array(mysql_query('SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1')); + $nld = ''; + if ($tinf['uid'] == $this->users[$i]['id']) { + $tinf = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($tinf['id'])) { + $tinf = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $tinf['id'] . '" LIMIT 1')); + $nld .= ', новым лидером становится "' . $tinf['login'] . '"'; + mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1'); + } + } + $rooms = [ + 374 => 372, //ПТП (Кэпитал сити) + 189 => 188, //Водосток (Кэпитал сити) + 392 => 393, //Шахты (Кэпитал сити) + + 398 => 397, //Шахты (Ангелс сити) + 243 => 395, //Водосток (Ангелс сити) + 360 => 242, //Бездна (Ангелс сити) + + 19 => 293 //Катакомбы + ]; + // $n_rm = $rooms[$this->users[$i]['room']]; + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `room` = "321" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //удаляем все предметы которые пропадают после выхода из пещеры + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['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 ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; + } + } + if ($rtxt != '') { + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + } + } + + mysql_query('UPDATE `users` SET `login2` = "" WHERE `battle` = "' . $this->info['id'] . '"'); + $upd = mysql_query('UPDATE `users` SET `login2` = "", `money` = "' . $this->users[$i]['money'] . '", `money2` = "' . $this->users[$i]['money2'] . '",`win` = "' . $this->users[$i]['win'] . '",`lose` = "' . $this->users[$i]['lose'] . '",`nich` = "' . $this->users[$i]['nich'] . '",`battle` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + if ($u->info['id'] == $this->users[$i]['id']) { + $u->info['battle_text'] = $this->users[$i]['battle_text']; + } + + $upd2 = mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + if ($this->info['turnir'] == 0) { + //пишем в чат + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "','" . $this->users[$i]['battle_text'] . "','-1','6','0')"); + } else { + mysql_query('UPDATE `turnirs` SET `winner` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['turnir'] . '" LIMIT 1'); + } + //завершаем сам бой + $upd3 = mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + + //Если это БС (старая версия) + /*$tinf = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "'.$this->info['dn_id'].'" LIMIT 1')); + if(isset($tinf['id']) && $tinf['bsid']>0) + { + $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "'.$u->info['city'].'" AND `id` = "'.$tinf['bsid'].'" AND `time_start` = "'.$tinf['time_start'].'" LIMIT 1')); + if(isset($bs['id'])) + { + $u->bsfinish($bs,$this->users,$this->info); + } + }*/ + // Жрать хочет + if ($this->users[$i]['animal'] > 0) { + $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); + if (isset($a['id'])) { + if ($a['eda'] < 1) { + $u->send('', $this->users[$i]['room'], $this->users[$i]['city'], '', + $this->users[$i]['login'], '' . $a['name'] . ' нуждается в еде...', + time(), 6, 0, 0, 0, 1); + } + } + } + mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + //mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'"'); + $this->saveLogs($this->info['id'], 'all'); + if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) { + echo ''; + } + } else { + //echo 'Поединок завершился, но вы поймали баг с 0-ым опытом, сообщите Администрации!'; + } + } + //unlink($lock_file); + mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } else { + sleep(2); + mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } + mysql_query('UNLOCK TABLES'); + } + + //Выдаем предметы + //$this->addGlobalItems($this->user[$i]['id'],$this->user[$j]['id'],$mon['win_itm'],$mon['win_eff'],$mon['win_ico'],$mon['win_exp'],$mon['win_money'],$mon['win_money2']); + public $ainm = []; + + public function addGlobalItems($bid, $uid, $itm, $eff, $ico, $exp, $cr, $ecr) + { + global $u; + // + //Выпадение дропа на ЦП + if ($bid == 1008) { + //Старый Новый Год + $jit = 0; + $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); + $iit = floor($iit[0] / 20); + $iit = rand(1, $iit); + while ($jit < $iit) { + if (rand(0, 100) < 50) { + $svtk = [ + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1461, + 1462, + 1463, + 4037, + 4038, + 4039, + 4040, + 911, + 1172, + 1173, + 2142, + 2141, + 2143, + 2870, + 2144, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + ]; + $svtk = $svtk[rand(0, count($svtk) - 1)]; + if ($svtk == 1000) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + ),( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + ),( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + ),( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + ),( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + ),( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + } + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "' . $svtk . '", + "|nosale=1|srok=259200", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + } + $jit++; + } + unset($svtk); + } elseif ($bid == 1007) { + //Хэллоуин, Тыквоголовый CAPITAL CITY + $jit = 0; + $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); + $iit = floor($iit[0] / 20); + $iit = rand(1, $iit); + while ($jit < $iit) { + if (rand(0, 100) < 50) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4504", + "", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + } + $jit++; + } + } elseif ($bid == 1006) { + //Трупожор CAPITAL CITY + if (rand(0, 100) < 10) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4451", + "srok=86400", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + } + } elseif ($bid == 1000) { + //Трупожор CAPITAL CITY + //if( rand(0,100) < 10 ) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4460", + "srok=2592000", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + //} + } elseif ($bid == 1001) { + //Трупожор CAPITAL CITY + //if( rand(0,100) < 10 ) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4461", + "srok=2592000", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + //} + } elseif ($bid == 1002) { + //Трупожор CAPITAL CITY + //if( rand(0,100) < 10 ) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4462", + "srok=2592000", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + //} + } elseif ($bid == 1003) { + //Трупожор CAPITAL CITY + //if( rand(0,100) < 10 ) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4463", + "srok=2592000", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + //} + } elseif ($bid == 1004) { + //Трупожор CAPITAL CITY + //if( rand(0,100) < 10 ) { + mysql_query('INSERT INTO `items_local` + ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES + ( + "' . $this->users[$this->uids[$uid]]['room'] . '", + "' . time() . '", + "4459", + "srok=2592000", + "' . $this->users[$this->uids[$uid]]['login'] . '", + "1" + )'); + //} + } + // + if ($exp >= 0) { + $this->users[$this->uids[$uid]]['battle_exp'] += round($exp * $this->users[$this->uids[$uid]]['battle_yron'] / $this->stats[$this->uids[$bid]]['hpAll']); + mysql_query('UPDATE `stats` SET `battle_exp` = "' . mysql_real_escape_string($this->users[$this->uids[$uid]]['battle_exp']) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); + } + // + if ($cr != '' && $cr > 0) { + if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { + mysql_query('UPDATE `users` SET `money` = (`money` + ' . mysql_real_escape_string($cr) . ') WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили кредиты: " . mysql_real_escape_string($cr) . " кр.','-1','6','0')"); + } + } + // + if ($ecr != '' && $ecr > 0) { + if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { + $this->users[$this->uids[$uid]]['money2'] += $ecr; + //$sleptime=rand(1,20); + //usleep($sleptime*100000); + $resulttp = mysql_query('UPDATE `users` SET `money2` = (`money2` + ' . mysql_real_escape_string($ecr) . ') WHERE `id` = "' . $this->users[$this->uids[$uid]]['id'] . '" LIMIT 1'); + if (!$resulttp) { + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Трупожор был пуст!!!','-1','6','0')"); + $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], + '"System.battle": (В бою трупожор), ПУСТ!!! ', time(), + $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); + } else { + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили Евро-кредиты: " . mysql_real_escape_string($ecr) . " екр.','-1','6','0')"); + $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], + '"System.battle": Персонаж получил ' . $ecr . ' ЕКР (В бою трупожор), сейчас: ' . $this->users[$this->uids[$uid]]['money2'] . ' ЕКР', + time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); + } + } + } + // + if ($ico != '') { + /* + 0(тип, 1 - значок, 2 - подвиг)@ + 1(время в минутах)@ + 2(название картинки)@ + 3(название)@ + 4(требует остаться в живых 0 или 1, либо игрок умер -1)@ + 5(требует набить с ботам урона в % Например 0.001)@ + 6(действия например: add_s1=5|add_hpAll=50)@ + 7(Требует другой значок, название картинки)@ + 8(плюсует значок 0 или 1)@ + 9(удаляем прошлый значок 0 or 1) + */ + $i = 0; + $txt = ''; + $ico = explode('#', $ico); + while ($i < count($ico)) { + $ico_e = explode('@', $ico[$i]); + if (isset($ico_e[3])) { + // + $add = 1; + if ($ico_e[4] == 1 && floor($this->stats[$this->uids[$uid]]['hpNow']) < 1) { + $add = 0; + } + if ($add == 1) { + $ins = false; + if ($ico_e[8] == 0) { + $ins = true; + if ($ico_e[9] == 1) { + mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); + } + } else { + $old_ico = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0) AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '" LIMIT 1')); + if (!isset($old_ico['id'])) { + $ins = true; + } else { + if ($old_ico['id'] > 0) { + $txt .= ', "' . $ico_e[3] . ' (Обновление)"'; + mysql_query('UPDATE `users_ico` SET `x` = `x` + 1,`endTime` = "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '" WHERE `id` = "' . $old_ico['id'] . '" LIMIT 1'); + } else { + $ins = true; + } + } + unset($old_ico); + } + if ($ins == true) { + if ($ico_e[9] == 1) { + mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); + } + mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`type`,`bonus`) VALUES ( + "' . mysql_real_escape_string($uid) . '", + "' . time() . '", + "' . mysql_real_escape_string($ico_e[3]) . '", + "' . mysql_real_escape_string($ico_e[2]) . '", + "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '", + "' . mysql_real_escape_string($ico_e[0]) . '", + "' . mysql_real_escape_string($ico_e[6]) . '" + )'); + $txt .= ', "' . $ico_e[3] . '"'; + } + } + // + } + $i++; + } + if ($txt != '') { + $txt = ltrim($txt, ', '); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы совершили подвиг: " . mysql_real_escape_string($txt) . "','-1','6','0')"); + } + } + // + if ($itm != '') { + $i = 0; + $txt = ''; + $itm = explode(',', $itm); + while ($i < count($itm)) { + $itm_e = explode('@', $itm[$i]); + if ($itm_e[0] > 0) { + $j = 0; + while ($j < $itm_e[1]) { + $u->addItem($itm_e[0], $uid, '|' . $itm_e[2]); + $j++; + } + if (!isset($this->ainm[$itm_e[0]])) { + $this->ainm[$itm_e[0]] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($itm_e[0]) . '" LIMIT 1')); + } + if (isset($this->ainm[$itm_e[0]]['id'])) { + //Добавляем текст о добавлении предмета + $txt .= ', ' . $this->ainm[$itm_e[0]]['name'] . ''; + if ($itm_e[1] > 1) { + $txt .= ' (x' . $itm_e[1] . ')'; + } + } + } + $i++; + } + if ($txt != '') { + $txt = ltrim($txt, ', '); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили предметы: " . mysql_real_escape_string($txt) . "','-1','6','0')"); + } + } + // + } + + //Проводим удар + public function addNewAtack() + { + global $u; + if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) { + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) { + /*$us = $this->stats[$this->uids[$u->info['id']]]; + $i = 1; $no = 0; + if($us['weapon1']!=1 && $us['weapon2']==1) + { + $uz['zona'] += 1; + } + while($i<=$uz['zona']) + { + if($this->uAtc['a'][$i]==0) + { + $no = 1; + } + $i++; + }*/ + $us = $this->stats[$this->uids[$u->info['id']]]; + $i = 1; + $no = 0; + + while ($i <= $us['zona']) { + if ($this->uAtc['a'][$i] == 0) { + $no = 1; + } + $i++; + } + + + if ($this->uAtc['b'] == 0) { + $no = 1; + } + + + if ($no == 0) { + //наносим удар + if ($u->info['enemy'] > 0) { + if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { + //наносим новый удар + $a = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; + $b = $this->uAtc['b']; + mysql_query('DELETE FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((`uid2` = "' . $u->info['id'] . '" AND `uid1` = "' . $u->info['enemy'] . '") OR (`uid1` = "' . $u->info['id'] . '" AND `uid2` = "' . $u->info['enemy'] . '")) LIMIT 2'); + $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $u->info['id'] . '","' . $u->info['enemy'] . '","' . $a . '","' . $b . '")'); + if (!$d) { + $this->e = 'Не удалось нанести удар по противнику...'; + } else { + $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); + } + } + } else { + //отвечаем на удар противника + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { + if (isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) { + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; + $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); + } + } + } + } else { + //ожидание хода противника (нет подходящего противника) + + } + } else { + $this->e = 'Выберите зоны удара и блока'; + } + } else { + $this->e = 'Для вас поединок закончен, ожидайте пока завершат другие...'; + } + } else { + //уже ударили противника, ожидание хода + + } + } + + //Запускаем магические предметы, если в них что-то встроено + public function magicItems($uid1, $uid2, $end) + { + global $u, $priem, $c, $code; + if (isset($this->stats[$this->uids[$uid1]])) { + $i = 0; + while ($i < count($this->stats[$this->uids[$uid1]]['items'])) { + $itm = $this->stats[$this->uids[$uid1]]['items'][$i]; + if (isset($itm['id'])) { + $e = $u->lookStats($itm['data']); + if (isset($e['bm_a1'])) { + if ($end > 0) { + if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php')) { + require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php'); + } + } else { + if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php')) { + require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php'); + } + } + } + } + $i++; + } + unset($itm); + } + } + + //Поглощение урона + public function testPog($uid, $yr) + { + //$yr = round($yr*1.25); + $yr2 = $yr; + if ($yr > 0) { + $testmana = false; + global $u, $priem; + $i = 0; + $ypg22 = 0; + while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { + $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], + 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + if (isset($dt3['add_pog2mp'])) { + $priem->minMana($uid, round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])); + } + $j['y'] -= $yr2; // осталось для поглощения + if (isset($dt3['add_pog2p'])) { + $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); + //echo '[Поглощаем: '.($dt3['add_pog2p']).'% за '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP]'; + } + unset($dt3); + if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { + $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { + //удаляем прием + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); + $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], + $this->users[$this->uids[$uid]], 4, $uid); + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; + } + unset($dt2); + $yr2 = -($j['y']); + $j['y'] = 0; + } + + $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', + 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); + if ($upd) { + } + $i++; + } + } + return $yr2; + } + + public $rehodeff = []; + + //Поглощение урона + public $poglast = []; + + public function testPogB($uid, $yr, $pliid, $test = 0) + { + //$yr = round($yr*1.25); + $yr2 = $yr; + $checktuman = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . '" + AND (`v2` = 273 OR `v2` = 286 OR `v2` = 287 OR `v2` = 288) + AND `delete` =0 LIMIT 1')); //проверка на туманный образ + //if ( !isset($checktuman['id'])) + if ($yr > 0 && !isset($checktuman['id'])) { + $testmana = false; + global $u, $priem; + $i = 0; + $ypg22 = 0; + while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { + $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; + if ($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] == $pliid || $test == 1) { + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], + 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + // + $dt30 = 0; + $dt30 = floor($j['y'] / $yr2 * 100); + // + //echo '['.$j['y'].'|'.$dt3['add_pog2'].'|'.$yr2.' -> '.$dt30.'/'.$dt3['add_pog2p'].'] '; + // + if ($dt30 < $dt3['add_pog2p']) { + $dt3['add_pog2p'] = $dt30; + } + // + unset($dt30); + // + if (isset($dt3['add_pog2mp'])) { + if ((round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) > $this->stats[$this->uids[$uid]]['mpNow']) { + //не хватило маны, считаем сколько хватит % от поглощенного урона + $j['yhj'] = $this->stats[$this->uids[$uid]]['mpNow'] / (round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) * 100; + $j['yhj'] = floor($j['yhj']); //Сколько % мы можем поглотить + $dt3['add_pog2p'] = floor($dt3['add_pog2p'] / 100 * $j['yhj']); + //echo '[!]'; + } + if ($test == 1) { + $priem->minMana($uid, round(round($yr2 / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); + } + } + if (!isset($this->poglast[$uid])) { + $this->poglast[$uid] = 0; + } + $this->poglast[$uid] += $yr2; + if ($test == 1) { + //$j['y'] -= $this->poglast[$uid]; // осталось для поглощения + $j['y'] -= round($this->poglast[$uid] / 100 * $dt3['add_pog2p']); + $priem->minMana($uid, + round(round($this->poglast[$uid] / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); + } + if (isset($dt3['add_pog2p'])) { + $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); + //echo '[Поглощаем: '.($dt3['add_pog2p']).'% ( '.$yr2/100*$dt3['add_pog2p'].' от '.$yr2.' ед. ) за '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP , остаток МР: '.$this->stats[$this->uids[$uid]]['mpNow'].']'; + } + //unset($dt3); + if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { + $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { + //удаляем прием + //Добавляем в лог + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); + $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], + $this->users[$this->uids[$uid]], 4, $uid); + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; + } + unset($dt2); + //$yr2 += -($j['y']); + $j['y'] = 0; + } + $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; + if (isset($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'])) { + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', + 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + //echo '['.$j['id'].'!'.$this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['id'].']'; + $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); + } + if ($upd) { + //echo '['.$j['y'].'->'.$yr2.']'; + //echo $this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['data']; + } + if ($j['y'] - $this->poglast[$uid] + $yr2 < 0) { + //echo '['.$yr.']'; + $yr -= $yr + ($j['y'] - $this->poglast[$uid] + $yr2); + //echo '['.$this->poglast[$uid].','.$yr2.','.$j['y'].']'; + $yr2 = $yr; + $i = count($this->stats[$this->uids[$uid]]['set_pog2']) + 1; + } + } + $i++; + } + } + unset($checktuman); + return $yr2; + } + + + //Проверка как бьем + public function testHowRazmen($id) + { + $r = [ + 1 => 0, + 2 => 0, + ]; + if (isset($this->atacks[$id])) { + if ($this->atacks[$id]['out1'] > 0 && $this->atacks[$id]['out2'] > 0) { + //игрок 1 пропустил ход + if ($this->atacks[$id]['out1'] == 100) { + //на магию + $r[1] = -2; + } else { + //время + $r[1] = -1; + } + //игрок 2 пропустил ход + if ($this->atacks[$id]['out2'] == 100) { + //на магию + $r[2] = -2; + } else { + //время + $r[2] = -1; + } + } elseif ($this->atacks[$id]['out1'] > 0) { + //игрок 1 пропустил ход + if ($this->atacks[$id]['out1'] == 100) { + //Пропустил ход на магию + $r[1] = -2; + } else { + //Пропустил ход по тайму + $r[1] = -1; + } + //игрок 2 бьет + $r[2] = 1; + } elseif ($this->atacks[$id]['out2'] > 0) { + //игрок 2 пропустил ход + if ($this->atacks[$id]['out2'] == 100) { + //Пропустил ход на магию + $r[2] = -2; + } else { + //Пропустил ход по тайму + $r[2] = -1; + } + //игрок 1 бьет + $r[1] = 1; + } else { + //размен игрок 1 бьет по игрок 2 , и игрок 2 бьет по игрок 1 + $r[1] = 1; + $r[2] = 1; + } + } + return $r; + } + + //Тестируем удары и т.д + public function newRazmen($id, $at = null) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->atacks[$id]['out1'] == 0) { + $at[1] = $this->usersTestAtack($id, $uid1, $uid2); + } else { + //echo '['. $this->users[$this->uids[$uid1]]['login'] .' пропустил ход]'; + $at[1] = [0]; + } + if ($this->atacks[$id]['out2'] == 0) { + $at[2] = $this->usersTestAtack($id, $uid2, $uid1); + } else { + //echo '['. $this->users[$this->uids[$uid2]]['login'] .' пропустил ход]'; + $at[2] = [0]; + } + + return $at; + } + + //Игрок1 наносит удар Игрок2 + public function usersTestAtack($id, $uid1, $uid2) + { + $r = []; + $block = [ + 0, + 0, + 0, + 0, + 0, + 0, + ]; + + //Проверка блоков + $i = 1; + if ($uid1 == $this->atacks[$id]['uid1']) { + $a = 2; + $j = $this->atacks[$id]['b2']; + $atack = [ + 0, + $this->atacks[$id]['a1'][0], + $this->atacks[$id]['a1'][1], + $this->atacks[$id]['a1'][2], + $this->atacks[$id]['a1'][3], + $this->atacks[$id]['a1'][4], + ]; + } elseif ($uid2 == $this->atacks[$id]['uid1']) { + $a = 1; + $j = $this->atacks[$id]['b1']; + $atack = [ + 0, + $this->atacks[$id]['a2'][0], + $this->atacks[$id]['a2'][1], + $this->atacks[$id]['a2'][2], + $this->atacks[$id]['a2'][3], + $this->atacks[$id]['a2'][4], + ]; + } + if ($this->atacks[$id]['out' . $a] == 0) { + while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { + //echo '{'.$j.'}'; + $block[$j] = 1; + $j++; + if ($j > 5 || $j < 1) { + $j = 1; + } + $i++; + } + } + //Проверка ударов + $i = 1; + while ($i <= $this->stats[$this->uids[$uid1]]['zona']) { + if (!isset($atack[$i]) || $atack[$i] == 0) { + $atack[$i] = rand(1, 5); + } + if ($atack[$i] > 0) { + if ($block[$atack[$i]] == 1) { + //удар был заблокирован + // КУДА БИЛ , ТИП УДАРА + $r['atack'][] = [$atack[$i], 3, 0]; + } else { + //Удар прошел + // КУДА БИЛ , ТИП УДАРА + $r['atack'][] = [$atack[$i], 1, 0]; + } + } + $i++; + } + return $r; + } + + //Проверка зоны и блока + public function testRazmenblock1($id, $uid1, $uid2, $atack) + { + $r = false; + //Проверка блоков + $i = 1; + if ($uid1 == $this->atacks[$id]['uid1']) { + $j = $this->atacks[$id]['b2']; + } elseif ($uid2 == $this->atacks[$id]['uid1']) { + $j = $this->atacks[$id]['b1']; + } + if ($this->atacks[$id]['out2'] == 0) { + while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { + //echo '{'.$j.'}'; + $block[$j] = 1; + $j++; + if ($j > 5 || $j < 1) { + $j = 1; + } + $i++; + } + } + //Проверка ударов + if ($atack > 0) { + if ($block[$atack] == 1) { + //удар был заблокирован + // КУДА БИЛ , ТИП УДАРА + $r = true; + } else { + //Удар прошел + // КУДА БИЛ , ТИП УДАРА + $r = false; + } + } + return $r; + } + + //Первичный расчет мф. эффектов (пример) + public function firstRazmen($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Расчет уворота Цели от Атакующего + + + $i++; + } + + return $at; + } + + //Проверка ухода удара в игрока + public function yhod_user($uid1, $uid2, $type) + { + // 1 - кто бьет . 2 - в кого бьют . тип + //Удал летит прямо в противника + if ($this->import_user == 0) { + $r = $uid1; + $rand_user = false; + if ($type == 2) { + //Случайный персонаж из своей команды (в том числе игрок) + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type == 4) { + //Случайный персонаж, любой + $i = 0; + while ($i < count($this->users)) { + //if( $this->users[$i]['team'] == $this->users[$this->uids[$uid1]]['team'] ) { + $rand_user[] = $this->users[$i]['id']; + //} + $i++; + } + } elseif ($type == 5) { + //Случайный персонаж, любой (кроме игрока) + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team'] && $uid2 != $this->users[$i]['id']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type == 6) { + //Случайный персонаж из команды противника + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->users[$this->uids[$uid2]]['team']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type > 100) { + //Удар идет в конкретного игрока + if (!isset($this->users[$this->uids[$type]]) || $this->users[$this->uids[$type]]['id'] != $type) { + $r = $uid2; + } else { + $r = $type; + } + } + if ($rand_user != false && count($rand_user) > 0) { + $r = $rand_user[rand(0, (count($rand_user) - 1))]; + } + $this->import_user = $r; + } else { + $r = $this->import_user; + } + return $r; + } + + //Расчет уворота игроков + public function mf1Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + global $u; + + if ($pat == true) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Расчет уворота Цели (u2) от Атакующего (u1) + //print_r( $at[$i] ); + $j = 0; + $wp01 = 3; + $k01 = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp01 = 3; + $k01 = 1; + } else { + //Правая рука + if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { + $wp01 = 14; + } else { + if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { + $wp01 = 3; + } else { + //нет оружия + + $wp01 = 3; + } + } + $k01 = 0; + } + $witm01 = 0; + $witm_type01 = 0; + if ($wp01 > 0) { + $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; + $witm_data01 = $u->lookStats($witm01['data']); + //$r['wt'] = $witm['type']; + } + // + if ($at[$a]['atack'][$j][2] == $v) { + //if( $wp01 > 0 && $witm01['type'] == 20 ) { + // $tyv = $this->mfs( 2 , array( 'mf' => $this->stats[$this->uids[$u2]]['m4']*1.25 , 'amf' => $this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5'] ) ); + //}else{ + $tyv = $this->mfs(2, [ + 'u1' => $u1, + 'u2' => $u2, + 'mf' => $this->stats[$this->uids[$u2]]['m4'], + 'amf' => (int)$this->stats[$this->uids[$u2]]['m15'], + 'smf' => ($this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5']), + 'asmf' => $this->stats[$this->uids[$u1]]['m21'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']); + //} + if ($tyv == 1 && $this->atacks[$id]['out' . $b] == 0) { + //увернулся, гад :) + $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); + if (!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] <= 0) { + $at[$a]['atack'][$j][1] = 2; + } else { + $this->stats[$this->uids[$u1]]['nopryh']--; + $this->stats[$this->uids[$u1]]['nopryh_act']++; + } + } + } + $j++; + } + + $i++; + } + unset($witm01, $witm_type01, $wp01, $k01); + + if (isset($pat) && $pat != false) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + //Расчет крита игроков + public function mf2Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + global $u; + + if ($pat == true) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Расчет крита Атакующего (u1) по Цели (u2) + //print_r( $at[$i] ); + $j = 0; + $wp01 = 0; + $k01 = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j <= 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp01 = 3; + $k01 = 1; + } else { + //Правая рука + if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { + $wp01 = 14; + } else { + if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { + $wp01 = 3; + } else { + //нет оружия + $wp01 = 3; + } + } + $k01 = 0; + } + $witm01 = 0; + $witm_type01 = 0; + if ($wp01 > 0) { + $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; + $witm_data01 = $u->lookStats($witm01['data']); + //$r['wt'] = $witm['type']; + } + // + //if( $at[$a]['atack'][$j][2] == $v ) { + if ($this->mfs(1, [ + 'u1' => $u1, + 'u2' => $u2, + 'mf' => $this->stats[$this->uids[$u1]]['m1'] + $witm_data01['sv_m1'], + 'amf' => $this->stats[$this->uids[$u1]]['m14'], + 'smf' => $this->stats[$this->uids[$u2]]['m2'], + 'aamf1' => (int)$this->stats[$this->uids[$u2]]['enemy_am1'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { + //кританул, гад :) + if ($at[$a]['atack'][$j][1] == 3) { + //в блок + $at[$a]['atack'][$j][1] = 4; //Тут тест + } elseif ($at[$a]['atack'][$j][1] != 2 && $at[$a]['atack'][$j][1] != 6 && $at[$a]['atack'][$j][1] != 7 && $at[$a]['atack'][$j][1] != 8) { + //обычный крит + $at[$a]['atack'][$j][1] = 5; + } else { + $at[$a]['atack'][$j][1] = 1; + } + } + //} + $j++; + } + + $i++; + } + unset($witm01, $witm_type01, $k01, $wp01); + + if (isset($pat) && $pat != false) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + //Расчет парирования игроков + public function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + if ($pat == true) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Расчет парирования Цели (u2) от Атакующего (u1) + //print_r( $at[$i] ); + $j = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ((!isset($this->stats[$this->uids[$u2]]['no_pr1']) || $this->stats[$this->uids[$u2]]['no_pr1'] == 0) && $at[$a]['atack'][$j][2] == $v) { + if ($this->mfs(3, [ + 'u1' => $u1, + 'u2' => $u2, + '1' => $this->stats[$this->uids[$u2]]['m7'], + '2' => $this->stats[$this->uids[$u1]]['m7'], + ], $this->users[$this->uids[$u1]]['level'], + $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { + //Парировал, гад :) + $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); + if ((!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0) && $this->stats[$this->uids[$u1]]['nopryh_act'] < 1) { + $at[$a]['atack'][$j][1] = 6; + $this->stats[$this->uids[$u1]]['nopryh']--; + $this->stats[$this->uids[$u1]]['nopryh_act']++; + } + } + } + $j++; + } + + $i++; + } + + if (isset($pat) && $pat != false) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + //Расчет блока щитом игроков + public function mf4Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + if ($pat == true) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) { + //Расчет блока щитом Цели (u2) от Атакующего (u1) + //print_r( $at[$i] ); + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($at[$a]['atack'][$j][2] == $v) { + if ($this->mfs(5, + ($this->stats[$this->uids[$u2]]['m8'] / 2 + $this->stats[$this->uids[$u2]]['m18']), + $this->users[$this->uids[$u1]]['level'], + $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { + //блокировал щитом, гад :) + /*if( !isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0 ) {*/ + $at[$a]['atack'][$j][1] = 7; + // $this->stats[$this->uids[$u1]]['nopryh']--; + // $this->stats[$this->uids[$u1]]['nopryh_act']++; + // } + } + } + $j++; + } + } + $i++; + } + + if (isset($pat) && $pat != false) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + //Расчет контрудара игроков + public function mf5Razmen($id, $at, $v, $rjd = 0) + { + global $u; + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Расчет контрудара Цели (u2) по Атакующему (u1) + //print_r( $at[$i] ); + $j = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($at[$a]['atack'][$j][2] == $v) { + if ($at[$a]['atack'][$j][1] == 2) { + if ($this->mfs(6, [ + 'u1' => $u1, + 'u2' => $u2, + 'a' => $this->stats[$this->uids[$u2]]['m6'], + 'b' => $this->stats[$this->uids[$u1]]['m6'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { + //контрудар, гад :) + $at[$a]['atack'][$j][1] = 8; + $rnd_a = rand(1, 5); + $rjd = count($at[$b]['atack']); + if ($this->testRazmenblock1($id, $u2, $u1, $rnd_a) == false) { + $at[$b]['atack'][] = [$rnd_a, 1, 0, 1]; // 3 , 0 , 1 + //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 + } else { + $at[$b]['atack'][] = [$rnd_a, 3, 0, 1]; // 3 , 0 , 1 + //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 + } + $at = $this->contrRestart($id, $at, 1, $rjd); + } + } + } + $j++; + } + + $i++; + } + + return $at; + } + + //Просмотр (для админов) + public function seeRazmen($id, $at) + { + $r = ''; + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + if (!isset($at[$a]['atack'])) { + $r .= 'u1 пропустил свой ход'; + } else { + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + if ($at[$a]['atack'][$j][1] == 1) { + //u1 ударил обычным ударом u2 + $r .= 'u1 ударил обычным ударом u2'; + } elseif ($at[$a]['atack'][$j][1] == 2) { + //u2 увернулся от u1 + $r .= 'u2 увернулся от u1'; + } elseif ($at[$a]['atack'][$j][1] == 3) { + //u2 заблокировал удар u1 + $r .= 'u2 заблокировал удар u1'; + } elseif ($at[$a]['atack'][$j][1] == 4) { + //u1 пробил блок u2 критом + $r .= 'u1 пробил блок u2 критом'; + } elseif ($at[$a]['atack'][$j][1] == 5) { + //u1 ударил критическим ударом u2 + $r .= 'u1 ударил критическим ударом u2'; + } elseif ($at[$a]['atack'][$j][1] == 6) { + //u2 парировал удар u1 + $r .= 'u2 парировал удар u1'; + } elseif ($at[$a]['atack'][$j][1] == 7) { + //u2 блокировал щитом удар u1 + $r .= 'u2 блокировал щитом удар u1'; + } elseif ($at[$a]['atack'][$j][1] == 8) { + //u2 увернулся от удара u1 и нанес по нему контрудар + $r .= 'u2 увернулся от удара u1 и нанес по нему контрудар'; + } + if ($at[$a]['atack'][$j][3] == 1) { + $r .= ' (контрудар)'; + } + if (isset($at[$a]['atack'][$j]['yron'])) { + $r .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; + if ($at[$a]['atack'][$j]['yron']['w'] == 3) { + $r .= ' (правая рука)'; + } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { + $r .= ' (левая рука)'; + } + } + if (isset($at[$a]['atack'][$j]['yron']['hp'])) { + $r .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; + } + $r .= ',
'; + $j++; + } + } + + $r = str_replace('u1', '' . $this->users[$this->uids[$u1]]['login'] . '', $r); + $r = str_replace('u2', '' . $this->users[$this->uids[$u2]]['login'] . '', $r); + + $r .= '|
'; + $i++; + } + + return $r; + } + + //Выделение из лог текста + public function addlt($a, $id, $s, $rnd = null) + { + global $log_text; + if ($rnd === null) { + $rnd = rand(0, (count($log_text[$s][$id]) - 1)); + } + return '{' . $a . 'x' . $id . 'x' . $rnd . '}'; + } + + //Добавляем статистику + public function addNewStat($stat) + { + if (isset($stat[1])) { + mysql_query('INSERT INTO `battle_stat` + ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( + "' . $this->info['id'] . '", + "' . $stat[1]['uid1'] . '", + "' . $stat[1]['uid2'] . '", + "' . $stat[1]['time'] . '", + "' . $stat[1]['type'] . '", + "' . $stat[1]['a'] . '", + "' . $stat[1]['b'] . '", + "' . $stat[1]['ma'] . '", + "' . $stat[1]['mb'] . '", + "' . $stat[1]['type_a'] . '", + "' . $stat[1]['type_b'] . '", + "' . $stat[1]['yrn'] . '", + "' . $stat[1]['yrn_krit'] . '", + "' . $stat[1]['tm1'] . '", + "' . $stat[1]['tm2'] . '" + )'); + } + if (isset($stat[2])) { + mysql_query('INSERT INTO `battle_stat` + ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( + "' . $this->info['id'] . '", + "' . $stat[2]['uid1'] . '", + "' . $stat[2]['uid2'] . '", + "' . $stat[2]['time'] . '", + "' . $stat[2]['type'] . '", + "' . $stat[2]['a'] . '", + "' . $stat[2]['b'] . '", + "' . $stat[1]['ma'] . '", + "' . $stat[2]['mb'] . '", + "' . $stat[2]['type_a'] . '", + "' . $stat[2]['type_b'] . '", + "' . $stat[2]['yrn'] . '", + "' . $stat[2]['yrn_krit'] . '", + "' . $stat[2]['tm1'] . '", + "' . $stat[2]['tm2'] . '" + )'); + } + } + + public $prlog = []; + + //Добавляем статистику ударов + public function asr($u1, $u2, $type) + { + mysql_query('INSERT INTO `battle_static` ( + `uid1`,`uid2`,`hod`,`type`,`time`,`bid` + ) VALUES ( + "' . $u1 . '","' . $u2 . '","' . $this->hodID . '","' . $type . '","' . time() . '","' . $this->info['id'] . '" + )'); + } + + //Добавляем размены в лог + public function addlogRazmen($id, $at) + { + global $u; + + $r = ''; + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $this->hodID++; + + $dies = [ + 1 => 0, + 2 => 0, + ]; + + //массив для статистики + $stat = [ + 1 => [ + 'uid1' => 0, + 'uid2' => 0, + 'time' => time(), + 'type' => 0, + 'a' => '00000', + 'b' => '0', + 'type_a' => '', + 'type_b' => '0', + 'yrn' => 0, + 'yrn_krit' => 0, + 'ma' => 0, + 'mb' => 0, + 'tm1' => 0, + 'tm2' => 0, + ], + 2 => [ + 'uid1' => 0, + 'uid2' => 0, + 'time' => time(), + 'type' => 0, + 'a' => '00000', + 'b' => '0', + 'type_a' => '', + 'type_b' => '0', + 'yrn' => 0, + 'yrn_krit' => 0, + 'ma' => 0, + 'mb' => 0, + 'tm1' => 0, + 'tm2' => 0, + ], + ]; + + //if( $u->info['admin'] > 0 ) { + //echo '[a: '.count($at[1]['atack']).'/'.count($at['p'][1]['atack']).', b: '.count($at[2]['atack']).'/'.count($at['p'][2]['atack']).']'; + //} + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + if ($this->stats[$this->uids[$u1]]['yhod'] > 0) { + //$u1 = $u2; + } elseif ($this->stats[$this->uids[$u2]]['yhod'] > 0) { + $u2 = $this->yhod_user($u1, $u2, $this->stats[$this->uids[$u2]]['yhod']); + } + + $s1 = $this->users[$this->uids[$u1]]['sex']; + $s2 = $this->users[$this->uids[$u2]]['sex']; + + $stat[$a]['uid1'] = $u1; + $stat[$a]['uid2'] = $u2; + $stat[$a]['ma'] = $this->stats[$this->uids[$u1]]['zona']; + $stat[$a]['mb'] = $this->stats[$this->uids[$u1]]['zonb']; + $stat[$a]['tm1'] = $this->users[$this->uids[$u1]]['team']; + $stat[$a]['tm2'] = $this->users[$this->uids[$u2]]['team']; + $stat[$a]['a'] = $this->atacks[$id]['a' . $a]; + $stat[$a]['b'] = $this->atacks[$id]['b' . $a]; + + $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s' . $a . '=' . $s1 . '||s' . $b . '=' . $s2 . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; + + $mas = [ + 'text' => '', + 'time' => time(), + 'vars' => '', + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'vars' => $vLog, + 'type' => 1, + ]; + + if (!isset($at[$a]['atack'])) { //ТУТ тест пропуска + if ($this->atacks[$id]['tpo' . $a] == 2) { + $mas['text'] .= '{u1} потратил свой ход на магию.'; + } else { + // + if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + mysql_query('INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES ( + "' . $this->info['id'] . '","' . $u1 . '","' . $u2 . '","' . time() . '","1" + )'); + } + // + if (isset($u1)) { + $mas['text'] .= '{u1} пропустил свой ход.'; + //Проверка сброс туманок + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1'); + } + } + $mas['text'] = '{tm1} ' . $mas['text']; + $this->add_log($mas); + } else { + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + // + $mas['text'] = ''; + // + $wt = [ + 21 => 4, + 22 => 5, + 20 => 2, + 28 => 2, + 19 => 3, + 18 => 1, + 26 => 22, + ]; + $par = [ + 'zona' => '{zn2_' . $at[$a]['atack'][$j][0] . '} ', + 'kyda' => $this->lg_zon[$at[$a]['atack'][$j][0]][rand(0, + (count($this->lg_zon[$at[$a]['atack'][$j][0]]) - 1))], + 'chem' => $this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]][rand(0, + (count($this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]]) - 1))], + ]; + // + $this->atacks[$id]['uid_' . $u1 . '_t' . $at[$a]['atack'][$j][1]]++; + // + // + $this->asr($u1, $u2, $at[$a]['atack'][$j][1]); + // + if ($at[$a]['atack'][$j][1] == 1) { + //u1 ударил обычным ударом u2 + $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, + 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, + $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, + null) . ' ' . $this->addlt(1, 7, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 2) { + //u2 увернулся от u1 + $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, + 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, + null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 3) { + //u2 заблокировал удар u1 + $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, + 9, $s1, null) . ' {u2} ' . $this->addlt($b, 10, $s2, + null) . ' ' . $this->addlt(1, 7, 0, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 4) { + //u1 пробил блок u2 критом + if (isset($at[$a]['atack'][$j]['yron']['t'])) { + $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, + null) . '' . $this->addlt($b, 2, $s2, null) . '' . $this->addlt($a, 3, $s1, + null) . ' {u1} ' . $this->addlt($a, 4, $s1, null) . '' . $this->addlt($a, 5, $s1, + null) . ', пробив блок, ' . $this->addlt($a, 6, $s1, + null) . ' ' . $this->addlt(1, 7, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } + } elseif ($at[$a]['atack'][$j][1] == 5) { + //u1 ударил критическим ударом u2 + $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, + 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, + $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, + null) . ' ' . $this->addlt(1, 7, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 6) { + //u2 парировал удар u1 + $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, + 9, $s1, + null) . ' {u2} неожиданно парировал ' . $this->addlt(1, + 7, 0, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 7) { + //u2 блокировал щитом удар u1 + $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, + 9, $s1, + null) . ' {u2}, воспользовавшись своим щитом, ' . $this->addlt($b, + 10, $s2, null) . ' ' . $this->addlt(1, 7, 0, $s1, + $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 8) { + //u2 увернулся от удара u1 и нанес по нему контрудар + $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, + 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, + null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . ' и нанес контрудар. '; + } + + $stat[$a]['type_a'] .= '' . $at[$a]['atack'][$j][1] . ''; + if ((!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && isset($at[$a]['atack'][$j]['yron']['travma']) && $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && floor($at[$a]['atack'][$j]['yron']['hp']) <= 0) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u2 . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); + if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { + //263 + if (isset($tr_pl['id'])) { + $at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3); + } + $tr_pl2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = "' . $u2 . '" AND `delete` = "0" AND `name` LIKE "%Защита от травм%" LIMIT 1')); + if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) { + $mas['text'] = rtrim($mas['text'], '. '); + $mas['text'] .= ', нанеся противнику '; + if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { + $mas['text'] .= 'Легкую'; + $this->addTravm($u2, 1, rand(3, 5)); + } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) { + $mas['text'] .= 'Среднюю'; + $this->addTravm($u2, 2, rand(3, 5)); + } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) { + $mas['text'] .= 'Тяжелую'; + $this->addTravm($u2, 3, rand(3, 5)); + } + $mas['text'] .= ' травму. '; + } + } + unset($tr_pl); + } + if ($at[$a]['atack'][$j]['yron']['pb'] == 1 && isset($at[$a]['atack'][$j]['yron']['hp'])) { + $mas['text'] = rtrim($mas['text'], '. '); + $mas['text'] .= ' пробив броню. '; + } + if ($at[$a]['atack'][$j][3] == 1) { + $mas['text'] .= '(контрудар) '; + } + if (isset($at[$a]['atack'][$j]['yron'])) { + if ($at[$a]['atack'][$j]['yron']['w'] == 3) { + $mas['textWP'] = '(правая рука)'; + } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { + $mas['textWP'] = '(левая рука)'; + } else { + $mas['textWP'] = '(непонятно чем)'; + } + if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 || $at[$a]['atack'][$j][1] == 1) { + if ($at[$a]['atack'][$j]['yron']['y'] < 1) { + $at[$a]['atack'][$j]['yron']['r'] = '--'; + } + } + if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { + $stat[$a]['yrn_krit'] += -$at[$a]['atack'][$j]['yron']['r']; + //$stat[$a]['yrn_krit'] += $at[$a]['atack'][$j]['yron']['k']; + $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; + } else { + $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; + } + $stat[$a]['yrn'] += -$at[$a]['atack'][$j]['yron']['r']; + } + if (isset($at[$a]['atack'][$j]['yron']['hp'])) { + if ($this->users[$this->uids[$u2]]['align'] == 9) { + $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hp'] / ($at[$a]['atack'][$j]['yron']['hpAll'] / 100); + $at[$a]['atack'][$j]['yron']['hpAll'] = '100%'; + } + $mas['text'] .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; + } + // + if ($mas['text'] != '') { + $mas['text'] = '{tm1} ' . $mas['text']; + } + /* + '.$mass['time'].'", + "'.$mass['battle'].'", + "'.$mass['id_hod'].'", + "'.$mass['text'].'", + "'.$mass['vars'].'", + "'.$mass['zona1'].'", + "'.$mass['zonb1'].'", + "'.$mass['zona2'].'", + "'.$mass['zonb2'].'", + "'.$mass['type'].' + */ + // + if (count($at[$a]['atack'][$j]['yron']['plog']) > 0) { + $il = 0; + while ($il <= count($at[$a]['atack'][$j]['yron']['plog'])) { + if (isset($at[$a]['atack'][$j]['yron']['plog'][$il])) { + eval($at[$a]['atack'][$j]['yron']['plog'][$il]); + } + $il++; + } + } + $this->add_log($mas); + $j++; + } + } + $i++; + } + + //Добавляем статистику + записываем в баттл_юзерс НР игроков + $this->addNewStat($stat); + + //Вывод в лог смерти персонажа + if (floor($this->stats[$this->uids[$u1]]['hpNow']) < 1) { + $dies[1] = 1; + } + if (floor($this->stats[$this->uids[$u2]]['hpNow']) < 1) { + $dies[2] = 1; + } + if ($dies[1] > 0 || $dies[2] > 0) { + $s1 = $this->users[$this->uids[$u1]]['sex']; + $s2 = $this->users[$this->uids[$u2]]['sex']; + + $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; + + $mas = [ + 'text' => '', + 'time' => time(), + 'vars' => '', + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'vars' => $vLog, + 'type' => 1, + ]; + + $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; + $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; + + if ($this->info['typeBattle'] == 99) { + if ($btlstatus[0] == 0) { + //Кровавые бои обычные + $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; + if ($this->info['razdel'] == 5) { + //не хаот + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } else { + //хаот + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + } elseif ($btlstatus[0] == 25) { + //Кровавая битва + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 50) { + //Кровавая резня + $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 75) { + //Кровавая сеча + $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 100) { + //Кровавое побоище + $rtngwin = [6, 12, 24, 48, 98, 196, 392, 784, 1568]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 150) { + //Судный день + $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } + } else { + if ($btlstatus[0] == 0) { + //Обычный поединок + $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; + if ($this->info['razdel'] == 5) { + //не хаот + $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; + } else { + //хаот + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + } elseif ($btlstatus[0] == 25) { + //великая битва + $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 50) { + //величайшая битва + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 75) { + //историческая битва сеча + $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 100) { + //эпохальная битва + $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 150) { + //судный день + $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } + } + + if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) { + //Пещерные бои не считаются и Изломы тоже, ну и Турниры + $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) { + //Клановая война + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256]; + } + + /* + $btlstatus if( $x < 50000 ) { + //Обычный бой + }elseif( $x >= 50000 && $x < 100000 ) { + $r = array(25,50,'Великая Битва','Кровавая Битва'); + }elseif( $x < 150000 ) { + $r = array(50,75,'Величайшая Битва','Кровавая Резня'); + }elseif( $x < 200000 ) { + $r = array(75,100,'Историческая Битва','Кровавая Сеча'); + }elseif( $x < 250000 ) { + $r = array(100,125,'Эпохальная Битва','Кровавое Побоище'); + }elseif( $x >= 250000 ) { + $r = array(150,150,'Судный День','Судный День'); + } + */ + + if ($dies[1] == 1) { + if ($this->info['dn_id'] > 0) { + //не дается репутация + } else { + if ($this->users[$this->uids[$u1]]['level'] >= 4) { + $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; + $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; + } + } + //Персонаж 1 погиб от рук персонаж 2 + $this->spaCheck($this->users[$this->uids[$u1]]['id']); + } + if ($dies[2] == 1) { + if ($this->info['dn_id'] > 0) { + //не дается репутация + } else { + if ($this->users[$this->uids[$u1]]['level'] >= 4) { + $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; + $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; + } + } + //Персонаж 2 погиб от рук персонаж 1 + $this->spaCheck($this->stats[$this->uids[$u2]]['id']); + } + //Записываем рейтинг + // + if ($this->info['type'] != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + // + if ($this->users[$this->uids[$u2]]['bot'] == 0) { + mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( + "' . $u1 . '","' . time() . '","' . $rtng1 . '","' . $this->users[$this->uids[$u1]]['align'] . '","' . $this->users[$this->uids[$u1]]['clan'] . '")'); + } + unset($rtng); + if ($this->users[$this->uids[$u1]]['bot'] == 0) { + mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( + "' . $u2 . '","' . time() . '","' . $rtng2 . '","' . $this->users[$this->uids[$u2]]['align'] . '","' . $this->users[$this->uids[$u2]]['clan'] . '")'); + } + } + unset($rtng1, $rtng2); + } + + return true; + } + + //Добавляем в лог действия приема + public function priemAddLog($id, $a, $b, $u1, $u2, $prm, $text, $hodID, $tm1 = 0, $tm2 = 0) + { + $time = time(); + if ($tm1 == 0) { + $tm1 = isset($this->atacks[$id]) ? $this->atacks[$id]['time'] : $time; + } + if ($tm2 == 0) { + $tm2 = isset($this->atacks[$id]) ? $this->atacks[$id]['time2'] : $time; + } + $prm = str_replace('=', '^^^^', $prm); + $vLog = + 'prm=' . $prm . + '||at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . + '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . + '||bl1=' . $this->atacks[$id]['b' . $a] . + '||bl2=' . $this->atacks[$id]['b' . $b] . + '||time1=' . $tm1 . + '||time2=' . $tm2 . + '||s' . $a . '=' . $this->users[$this->uids[$u1]]['sex'] . + '||s' . $b . '=' . $this->users[$this->uids[$u2]]['sex'] . + '||t2=' . $this->users[$this->uids[$u2]]['team'] . + '||t1=' . $this->users[$this->uids[$u1]]['team'] . + '||login1=' . $this->users[$this->uids[$u1]]['login2'] . + '||login2=' . $this->users[$this->uids[$u2]]['login2']; + + $mas = [ + 'text' => $text, + 'time' => $time, + 'battle' => $this->info['id'], + 'id_hod' => $hodID, + 'vars' => $vLog, + 'type' => 1, + ]; + $this->add_log($mas); + } + + //Добавляем в лог действия приема (без атаки) + public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm) + { + $vLog = 'prm=' . $prm . '||time1=' . $tm . '||time2=' . $tm . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; + $mas = [ + 'text' => $text, + 'time' => time(), + 'vars' => '', + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + $hodID), + 'vars' => $vLog, + 'type' => 1, + ]; + $this->add_log($mas); + } + + //Считаем контру + public function contrRestart($id, $at, $v, $rjd = 0) + { + // + /*$at['p'] = $at; + //крит + $at = $this->mf2Razmen($id,$at,$v,true); + //блок щитом (если есть щит, конечно) + $at = $this->mf4Razmen($id,$at,$v,true); + //уворот + $at = $this->mf1Razmen($id,$at,$v,true); + //парирование + $at = $this->mf3Razmen($id,$at,$v,true); + //контрудар + //$at = $this->mf5Razmen($id,$at,$v); + //Проверяем урон + $at = $this->yronRazmen($id,$at,true); + //$at = $this->yronRazmen($id,$at); + + $at = $at['p'];*/ + + + //уворот + $at = $this->mf1Razmen($id, $at, $v, true, $rjd); + //парирование + $at = $this->mf3Razmen($id, $at, $v, true, $rjd); + //контрудар + //$at = $this->mf5Razmen($id,$at,$v,true,$rjd); + //блок щитом (если есть щит, конечно) + $at = $this->mf4Razmen($id, $at, $v, true, $rjd); + //Проверяем урон + //$at = $this->yronRazmen($id,$at); + //крит + $at = $this->mf2Razmen($id, $at, $v, true, $rjd); + $at = $this->yronRazmen($id, $at, true, $rjd); + + + return $at; + } + + //Считаем контру + /* public function contrRestart($id,$at,$v) { + // + $at['p'] = $at; + //крит + //$at = $this->mf2Razmen($id,$at,$v,true); + //блок щитом (если есть щит, конечно) + $at = $this->mf4Razmen($id,$at,$v,true); + //уворот + $at = $this->mf1Razmen($id,$at,$v,true); + //парирование + $at = $this->mf3Razmen($id,$at,$v,true); + //контрудар + //$at = $this->mf5Razmen($id,$at,$v); + //Проверяем урон + //$at = $this->yronRazmen($id,$at,true); + $at = $this->yronRazmen($id,$at); + + $at = $at['p']; + + return $at; + } + */ + + //Расчитываем статы для конкретной зоны атаки + public function yronGetrazmenStats($s, $z) + { + global $u; + /* + 1 - шлем + 2 - наручи + 3 - оружие (правая рука) + 4 - рубаха + 5 - броня + 6 - плащ + 7 - пояс + 8 - серьги + 9 - амулет + 10-12 - кольца + 13 - перчатки + 14 - оружие / щит (левая рука) + 16 - поножи + 17 - ботинки + */ + $zi = [ //Предметы влияющие на зоны + 1 => [1, 8, 9, 52], //голова + 2 => [4, 5, 6], //грудь + 3 => [2, 4, 5, 6, 13], //живот + 4 => [7, 16, 10, 11, 12], //пояс + 5 => [17] //ноги + ]; + // + $zi = $zi[$z]; + $i = 0; + // + while ($i < count($zi)) { + // + $t = $u->items['add']; + $ii = 0; + // + while ($ii < count($s['items'])) { + if (isset($s['items'][$ii]) && $s['items'][$ii]['inOdet'] == $zi[$i]) { + $po = $u->lookStats($s['items'][$ii]['data']); + // + $x = 0; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($po['sv_' . $n])) { + $s[$n] += $po['sv_' . $n]; + if ($n == 'za') { + $iii = 1; + while ($iii <= 4) { + $s['za' . $iii] += $po['sv_' . $n]; + $iii++; + } + } elseif ($n == 'zm') { + $iii = 1; + while ($iii <= 4) { + $s['zm' . $iii] += $po['sv_' . $n]; + $iii++; + } + } elseif ($n == 'zma') { + $iii = 1; + while ($iii <= 7) { + $s['zma' . $iii] += $po['sv_' . $n]; + $iii++; + } + } + } + $x++; + } + // + } + $ii++; + } + // + $i++; + } + // + return $s; + } + + //Расчитываем ед. урона + public function yronGetrazmen($uid1, $uid2, $wp, $zona) + { + global $u; + //$oldst1 = $this->stats[$this->uids[$uid1]]; + //$oldst2 = $this->stats[$this->uids[$uid2]]; + //Получаем статы игрока 1 и 2 для конкретной зоны + //$this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid1]] , $zona ); + //$this->stats[$this->uids[$uid2]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid2]] , $zona ); + //$this->a_save_stats($uid1); + //$this->a_save_stats($uid2); + // + //$this->a_testing_stats($uid1,$zona); + //$this->a_testing_stats($uid2,$zona); + // + $r = [ + 'y' => 0, + 'r' => '--', + ]; + //Определяем тип урона + /* + Колющий + Рубящий + Режущий + Дробящий + */ + $witm = 0; + $witm_type = 0; + + if ($wp > 0) { + $witm = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp' . $wp . 'id']]; + $witm_data = $u->lookStats($witm['data']); + $witm_type = $this->weaponTx($witm); + //$r['wt'] = $witm['type']; + } + //$witm_type=1; + if ($witm_type == 0 || $witm_type == 12) { + $witm_type2 = ''; + } else { + $witm_type2 = $witm_type; + } + $r['t'] = $witm_type2; + //Расчет брони + /* + голова + грудь + живот + пояс + ноги + */ + $bron = [ + 1 => [$this->stats[$this->uids[$uid2]]['mib1'], $this->stats[$this->uids[$uid2]]['mab1']], + 2 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], + 3 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], + 4 => [$this->stats[$this->uids[$uid2]]['mib3'], $this->stats[$this->uids[$uid2]]['mab3']], + 5 => [$this->stats[$this->uids[$uid2]]['mib4'], $this->stats[$this->uids[$uid2]]['mab4']], + ]; + // + //Увеличиваем параметры от текущего оружия которым бьем + //$witm_data + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_a' . $iii]) && $witm_data['sv_a' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_a' . $iii]; + } + if (isset($witm_data['sv_mg' . $iii]) && $witm_data['sv_mg' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mg' . $iii]; + } + $iii++; + } + $iii = 1; + while ($iii <= 4) { + if (isset($witm_data['sv_aall']) && $witm_data['sv_aall'] != 0) { + $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_aall']; + } + $iii++; + } + $iii = 1; + while ($iii <= 4) { + if (isset($witm_data['sv_mall']) && $witm_data['sv_mall'] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mall']; + } + $iii++; + } + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_m2all']) && $witm_data['sv_m2all'] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_m2all']; + } + $iii++; + } + + if (isset($witm_data['sv_m3']) && $witm_data['sv_m3'] != 0) { + $this->stats[$this->uids[$uid1]]['m3'] += $witm_data['sv_m3']; + } + + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_pa' . $iii]) && $witm_data['sv_pa' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['pa' . $iii] += $witm_data['sv_pa' . $iii] + $witm_data['sv_m10']; + } + if (isset($witm_data['sv_pm' . $iii]) && $witm_data['sv_pm' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_pm' . $iii] + $witm_data['sv_m11a']; + if ($iii < 5) { + $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_m11']; + } + } + $iii++; + } + // + //мощность + подавление мощности противником + $wAp = 0; + $w3p = 0; + $w14p = 0; + /* + Старая формула, но Гамс попросил поменять где мощность магии добавляется поверх мощности урона + if($witm_type==12) { + //удар кулаком + $wAp += $this->stats[$this->uids[$uid1]]['m10']; + if($this->users[$this->uids[$uid1]]['align']==7) { + $wAp += 15; + } + }elseif($witm_type < 5) { + $wAp += $this->stats[$this->uids[$uid1]]['pa'.$witm_type.''] + $this->stats[$this->uids[$uid1]]['m10'] + $witm_data['sv_pa'.$witm_type.'']; + $wAp -= $this->stats[$this->uids[$uid2]]['antpa'.$witm_type.'']; + }else{ + $wAp += $this->stats[$this->uids[$uid1]]['pm'.($witm_type-4).''] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm'.($witm_type-4).'']; + $wAp -= $this->stats[$this->uids[$uid2]]['antpm'.($witm_type-4).'']; + } + */ + if ($witm_type == 12) { + //удар кулаком + $wAp += $this->stats[$this->uids[$uid1]]['m10']; + if ($this->users[$this->uids[$uid1]]['align'] == 7) { + $wAp += 15; + } + } elseif ($witm_type < 5) { + $wAp += $this->stats[$this->uids[$uid1]]['pa' . $witm_type . '']/* + $this->stats[$this->uids[$uid1]]['m10'] + $witm_data['sv_pa'.$witm_type.'']*/ + ; + $wAp -= $this->stats[$this->uids[$uid2]]['antpa' . $witm_type . '']; + } else { + $wAp += $this->stats[$this->uids[$uid1]]['m10'] + $this->stats[$this->uids[$uid1]]['pm' . ($witm_type - 4) . ''] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm' . ($witm_type - 4) . '']; + $wAp -= $this->stats[$this->uids[$uid2]]['antpm' . ($witm_type - 4) . '']; + } + // + + // + //Владение данным оружием + $vladenie = 0; + + //Пробой брони + $proboi = 0; + $witm_data['m9'] = $this->stats[$this->uids[$uid1]]['m9']; + if (rand(1, 100) < floor($witm_data['m9'] / 2)) { + $proboi = floor($witm_data['m9'] / 2); + $r['pb'] = 1; + } + + + /*if( $this->mfs(4, $witm_data['m9'] , $this->users[$this->uids[$uid1]]['level'] , $this->users[$this->uids[$uid2]]['level']) == 1 ) { + $proboi = $witm_data['m9']; + $r['pb'] = 1; + } + if( $this->mfs(4, $witm_data['add_m9'] , $this->users[$this->uids[$uid1]]['level'] , $this->users[$this->uids[$uid2]]['level']) == 1 ) { + $proboi = $witm_data['add_m9']; + $r['pb'] = 1; + }*/ + + //всегда пробивает на % пробоя у оружия ГАМС (начало) + /*if( $witm_data['sv_m9'] > 0 ) { + $proboi = $witm_data['sv_m9']; + $r['pb'] = 1; + }*/ + //всегда пробивает на % пробоя у оружия ГАМС (конец) + + if ($witm['2h'] > 0) { + //$witm_data['sv_yron_min'] = $witm_data['sv_yron_min']*2; + //$witm_data['sv_yron_max'] = $witm_data['sv_yron_max']*2; + } + + $y = $this->yrn( + //$st1, $st2, $u1, $u2, $level, $level2, $type, $min_yron, $max_yron, $min_bron, $max_bron, + //$vladenie, $power_yron, $power_krit, $zashita, $ozashita, $proboi, $weapom_damage + $this->stats[$this->uids[$uid1]], + $this->stats[$this->uids[$uid2]], + $this->users[$this->uids[$uid1]], + $this->users[$this->uids[$uid2]], + $this->users[$this->uids[$uid1]]['level'], + $this->users[$this->uids[$uid2]]['level'], + // + $witm_type, + $this->stats[$this->uids[$uid1]]['minAtack'], //мин. урон (добавочный) + $this->stats[$this->uids[$uid1]]['maxAtack'], //макс. урон + $bron[$zona][0], //броня мин. + $bron[$zona][1], //броня макс + // + $vladenie, //владения + (($wAp /*+ $w3p + $w14p*/)), //мощность урона + (round($this->stats[$this->uids[$uid1]]['m3'])), //мощность крита + (($this->stats[$this->uids[$uid2]]['za' . $witm_type2]) - $this->stats[$this->uids[$uid1]]['pza']), + //защита от урона + $this->stats[$this->uids[$uid1]]['ozash'], //подавление защиты + $proboi, //пробой брони + 0, //хз + ($witm_data['sv_yron_min'] + $this->stats[$this->uids[$uid1]]['yron_min']), + ($witm_data['sv_yron_max'] + $this->stats[$this->uids[$uid1]]['yron_max']), + $this->stats[$this->uids[$uid2]]['zaproc'], + $this->stats[$this->uids[$uid2]]['zmproc'], + (($this->stats[$this->uids[$uid2]]['zm' . ($witm_type2 - 4)]) - round($this->stats[$this->uids[$uid1]]['pzm'] * 0.8)), + //защита от урона + $this->stats[$this->uids[$uid1]]['omzash'], //подавление защиты + $witm['type'], + $witm + ); + + $r['y'] = round(rand($y['min'] + $proboi, $y['max'] + round($proboi / 2))); + $r['k'] = round(rand($y['Kmin'] + round($proboi / 4), $y['Kmax'] + round($proboi / 8))); + + $r['m_y'] = $y['max']; + $r['m_k'] = $y['Kmax']; + + $r['bRND'] = $y['bRND']; + + $r['w_type'] = $witm_type; + + //Если второе оружие - урон ниже на 50% + $wp1 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp3id']]; + $wp2 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp14id']]; + /*if( $wp == 14 ) { + if( $wp1['level'] >= $wp2['level'] ) { + $r['y'] = floor( $r['y'] * 0.5 ); + $r['k'] = floor( $r['k'] * 0.5 ); + } + }elseif( $wp == 3 ) { + if( $wp2['level'] > $wp1['level'] ) { + $r['y'] = floor( $r['y'] * 0.5 ); + $r['k'] = floor( $r['k'] * 0.5 ); + } + }*/ + + //тип от оружия + if ($witm['type'] == 18) { + $tp = 1; + } elseif ($witm['type'] == 19) { + $tp = 2; + } elseif ($witm['type'] == 20) { + $tp = 3; + } elseif ($witm['type'] == 21) { + $tp = 4; + } else { + //$tp = 0; + } + + if ($tp != $witm_type && $wp > 0) // ТУТ + { + $r['y'] = round($r['y'] / 3); + $r['r'] = round($r['r'] / 3); + $r['k'] = round($r['k'] / 3); + $r['m_k'] = round($r['m_k'] / 3); + $r['m_y'] = round($r['m_y'] / 3); + } + + if (isset($this->stats[$this->uids[$uid2]]['zaproc'])) { + $r['y'] = round($r['y'] - $r['y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['r'] = round($r['r'] - $r['r'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['k'] = round($r['k'] - $r['k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['m_k'] = round($r['m_k'] - $r['m_k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['m_y'] = round($r['m_y'] - $r['m_y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + if ($r['k'] < 1) { + $r['k'] = 2; + } + } + + if ($r['y'] < 1) { + $r['y'] = 1; + } + if ($r['r'] >= 0) { + $r['r'] = -1; + } + if ($r['k'] < 1) { + $r['k'] = 1; + } + if ($r['m_k'] < 1) { + $r['m_k'] = 1; + } + if ($r['m_y'] < 1) { + $r['m_y'] = 1; + } + //$this->a_restart_stats($uid1,1); + //$this->a_testing_stats($uid2,1); + return $r; + } + + //Считаем урон + public function yronRazmen($id, $at, $pat = false, $rjd = 0) + { + if ($pat == true) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $yhod = [1 => 1, 2 => 0]; + //$uid1 = $this->yhod_user($this->atacks[$id]['uid2'],$this->atacks[$id]['uid1'],$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $yhod = [1 => 0, 2 => 1]; + //$uid2 = $this->yhod_user($this->atacks[$id]['uid1'],$this->atacks[$id]['uid2'],$this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Считаем свойства от предметов + + + //Расчет удара (u2) по (u1) + //print_r( $at[$i] ); + $j = 0; + $k = 0; + $wp = 3; + if ($rjd > 0) { + $j = $rjd - 1; + } + //ТУТ + + //$checkhp1=$this->stats[$this->uids[$u2]]['hpNow']; + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp = 3; + $k = 1; + } else { + //Правая рука + if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { + $wp = 14; + } else { + if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { + $wp = 3; + } else { + //нет оружия + $wp = 3; + } + } + $k = 0; + } + if ($wp > 0) { + $witm = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp . 'id']]; + $witm_type = $this->weaponTx($witm); + $at[$a]['atack'][$j]['wt'] = $witm['type']; + } + // + $at[$a]['atack'][$j]['yhod'] = $yhod[$a]; + // + /*if ($checkhp1>0) + {*/ + if (!isset($at[$a]['atack'][$j]['yron']) && ( + $at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5) + ) { + // + //$at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); + $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], + $yhod[$b]); + /*if ($checkhp1 <1) + { + $at[$a]['atack'][$j]['yron']['y']=0; + $at[$a]['atack'][$j]['yron']['k']=0; + }*/ + + + if ($at[$a]['atack'][$j][1] == 4) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k'] / 2); + } elseif ($at[$a]['atack'][$j][1] == 5) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; + } + $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['yron']['w'] = $wp; + if ($at[$a]['atack'][$j]['yron']['y'] < 1) { + $at[$a]['atack'][$j]['yron']['r'] = '--'; + } else { + $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; + } + + /*if( ($at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5)&& $at[$a]['atack'][$j][2] != 3) + { + $checkhp1=$checkhp1-$at[$a]['atack'][$j]['yron']['y']; + }*/ + // + } else { + // + //$at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); + $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], + $yhod[$b]); + /*if ($checkhp1 <1) + { + $at[$a]['atack'][$j]['block']['y']=0; + $at[$a]['atack'][$j]['block']['k']=0; + }*/ + if ($at[$a]['atack'][$j][1] == 4) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k'] / 2); + } elseif ($at[$a]['atack'][$j][1] == 5) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; + } + $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['block']['w'] = $wp; + if ($at[$a]['atack'][$j]['block']['y'] < 1) { + $at[$a]['atack'][$j]['block']['r'] = '--'; + } else { + $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; + } + /* + if( ($at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5)&& $at[$a]['atack'][$j][2] != 3) + { + $checkhp1=$checkhp1-$at[$a]['atack'][$j]['block']['y']; + }*/ + // + } + /*} + else + { + + if( $at[$a]['atack'][$j][1] == 1 || $at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 ) + { + // + $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); + $at[$a]['atack'][$j]['yron']['y']=0; + $at[$a]['atack'][$j]['yron']['k']=0; + if( $at[$a]['atack'][$j][1] == 4 ) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k']/2); + }elseif( $at[$a]['atack'][$j][1] == 5 ) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; + } + $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['yron']['w'] = $wp; + if( $at[$a]['atack'][$j]['yron']['y'] < 1 ) { + $at[$a]['atack'][$j]['yron']['r'] = '--'; + }else{ + $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; + } + // + }else{ + // + $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); + $at[$a]['atack'][$j]['block']['y']=0; + $at[$a]['atack'][$j]['block']['k']=0; + if( $at[$a]['atack'][$j][1] == 4 ) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k']/2); + }elseif( $at[$a]['atack'][$j][1] == 5 ) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; + } + $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['block']['w'] = $wp; + if( $at[$a]['atack'][$j]['block']['y'] < 1 ) { + $at[$a]['atack'][$j]['block']['r'] = '--'; + }else{ + $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; + } + // + } + + + }*/ + $j++; + } + + $i++; + } + + if (isset($pat) && $pat != false) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + //Обновление здоровья + public function updateHealth($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Рассчет дополнительных тактик + if ($this->atacks[$id]['out' . $b] > 0) { + //Игрок ${'u'.$a} получает тактики, возможно + if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m6'] / 5), 20)) { + //выдаем тактику контрудара + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic3']++; + } + } + if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m8'] / 4), 20)) { + //выдаем тактику щита + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic4']++; + } + } + } + + //Расчет удара Цели (u2) по Атакующему (u1) + //print_r( $at[$i] ); + $j = 0; + $k = 0; + $wp = 3; + while ($j < count($at[$a]['atack']) && $j < 8) { + //Добавляем тактики + //$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] + if ($at[$a]['atack'][$j][1] == 1) { + //u1 ударил обычным ударом u2 + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic1']++; + } + //Двуручка + if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic1'] += 2; + } + } + } elseif ($at[$a]['atack'][$j][1] == 2) { + //u2 увернулся от u1 + } elseif ($at[$a]['atack'][$j][1] == 3) { + //u2 заблокировал удар u1 + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic4']++; + } + } elseif ($at[$a]['atack'][$j][1] == 4) { + //u1 пробил блок u2 критом + if (!isset($at[$a]['atack'][$j]['notactic2'])) { + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic2']++; + } + } + $this->users[$this->uids[$u2]]['tactic4']++; //тактика за пробив блок + } elseif ($at[$a]['atack'][$j][1] == 5) { + //u1 ударил критическим ударом u2 + if (!isset($at[$a]['atack'][$j]['notactic2'])) { + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic2'] += 2; + } + //Двуручка + if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic2'] += 1; + } + } + } + } elseif ($at[$a]['atack'][$j][1] == 6) { + //u2 парировал удар u1 + if (!isset($at[$a]['atack'][$j]['notactic5'])) { + if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic5']++; + } + } + } elseif ($at[$a]['atack'][$j][1] == 7) { + //u2 блокировал щитом удар u1 //ТУТ ЩИТ + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic4']++; + } + } elseif ($at[$a]['atack'][$j][1] == 8) { + //u2 увернулся от удара u1 и нанес по нему контрудар + if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic3']++; + } + } + // КУДА БИЛ , ТИП УДАРА + if (isset($at[$a]['atack'][$j]['yron']) && ( + $at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5)) { + // + + if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['y']) { + $at[$a]['atack'][$j]['yron']['y'] = $this->stats[$this->uids[$u2]]['hpNow']; + } + if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['k']) { + $at[$a]['atack'][$j]['yron']['k'] = $this->stats[$this->uids[$u2]]['hpNow']; + } + + if ($at[$a]['atack'][$j]['yron']['y'] < 0) { + $at[$a]['atack'][$j]['yron']['y'] = 1; + $at[$a]['atack'][$j]['yron']['r'] = -1; + $at[$a]['atack'][$j]['yron']['k'] = 1; + } + if ($this->stats[$this->uids[$u2]]['hpNow'] < 1) { + $at[$a]['atack'][$j]['yron']['y'] = 0; + $at[$a]['atack'][$j]['yron']['r'] = -1; + $at[$a]['atack'][$j]['yron']['k'] = 0; + } + + //Добавляем нанесенный урон и опыт + //$this->users[$this->uids[$u1]]['battle_yron'] += $at[$a]['atack'][$j]['yron']['y']; + $this->takeExp($u1, $at[$a]['atack'][$j]['yron']['y'], $u1, $u2); + //Отнимаем НР + $this->stats[$this->uids[$u2]]['hpNow'] -= $at[$a]['atack'][$j]['yron']['y']; + $this->users[$this->uids[$u2]]['last_hp'] = -$at[$a]['atack'][$j]['yron']['y']; + + //echo '['.$u1.' -> '.$u2.']'; + $at[$a]['atack'][$j]['yron']['hp'] = $this->stats[$this->uids[$u2]]['hpNow']; + if ($at[$a]['atack'][$j]['yron']['hp'] < 1) { + $at[$a]['atack'][$j]['yron']['hp'] = 0; + } + $at[$a]['atack'][$j]['yron']['hpAll'] = $this->stats[$this->uids[$u2]]['hpAll']; + if ($at[$a]['atack'][$j]['yron']['hp'] > $at[$a]['atack'][$j]['yron']['hpAll']) { + $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hpAll']; + } + // + //Травмирование + if (rand(0, 100) <= 50) { + if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { + if (!isset($at[$a]['atack'][$j]['yron']['travma']) && rand(0, + 1000) < 500 && $this->users[$this->uids[$u2]]['level'] > 1 && $this->stats[$this->uids[$u1]] > 1) { + $trvm_chns = floor(rand(0, 200) / 10); + if ($trvm_chns > 3 || $trvm_chns < 1) { + $trvm_chns = 0; + } + $at[$a]['atack'][$j]['yron']['travma'] = [$trvm_chns, 'Обыкновенная травма']; + unset($trvm_chns); + } + } + } + } + $j++; + } + + $i++; + } + + return $at; + } + + //Добавляем новую статистику игрока + public function addstatuser($id) + { + if ($id > 0) { + $uid = $id; + $id = $this->uids[$uid]; + mysql_query('INSERT INTO `battle_users` + ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` ) + VALUES + ( + "' . $this->info['id'] . '", + "' . $uid . '", + "' . time() . '","' . $this->users[$id]['login'] . '", + "' . $this->users[$id]['level'] . '", + "' . $this->users[$id]['align'] . '", + "' . $this->users[$id]['clan'] . '", + "' . $this->stats[$id]['hpAll'] . '", + "' . $this->stats[$id]['hp'] . '", + "' . $this->stats[$id]['hpNow'] . '", + "' . $this->users[$id]['team'] . '" + )'); + } + } + + //Проверяем приемы + public function priemsRazmen($id, $at) + { + if ($at == 'fast') { + $uid1 = $id[0]; + $uid2 = $id[1]; + } else { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + } + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + //Получаем приемы и смотрим когда какой действует + $eff = $this->stats[$this->uids[$u1]]['effects']; + $this->stats[$this->uids[$u1]]['u_priem'] = []; + $j = 0; + while ($j <= count($eff)) { + if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { + $this->stats[$this->uids[$u1]]['u_priem'][] = [ + $j, + $eff[$j]['v2'], + $this->prm[$eff[$j]['v2']]['act'], + $eff[$j]['id'], + $this->prm[$eff[$j]['v2']]['type_of'], + $this->prm[$eff[$j]['v2']]['moment'], + $this->prm[$eff[$j]['v2']]['moment_end'], + $this->prm[$eff[$j]['v2']]['type_sec'], + ]; + } + $j++; + } + + $i++; + } + // + } + + //Приемы которые используются моментально + public function priemsRazmenMoment($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + // + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 4) { + if ($this->testPriemVarTrueZash($i, 1, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, + $u1, $u2) == false) { + } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + // + $i++; + } + // + return $at; + } + + //Приемы которые используются моментально (в конце хода) + public function priemsRazmenMomentEnd($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + // + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) { + if ($this->testPriemVarTrueZash($i, 2, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, + $u1, $u2) == false) { + } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + // + $i++; + } + // + return $at; + } + + + //Используем приемы + public function priemsTestRazmen($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //ставка + + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 220 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 237 + || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 286 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 287 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 288 + || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 213) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { + if ($this->testPriemVarTrueZash($i, 3, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, + $u1, $u2) == false) { + } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + + /* + $j = 0; + while( $j <= count( $this->stats[$this->uids[$u2]]['u_priem'] ) ) { + if( $this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4 ) { + if(file_exists('../../_incl_data/class/priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php')) { + $pr_used_this = $u2; + require('priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php'); + if( isset($fx_priem) ) { + $at = $fx_priem($id,$at,$u2,$j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + */ + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + /*$j = 0; + while( $j <= count( $this->stats[$this->uids[$u1]]['u_priem'] ) ) { + if( $this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8 ) { + if(file_exists('../../_incl_data/class/priem/'.$this->stats[$this->uids[$u1]]['u_priem'][$j][1].'.php')) { + $pr_used_this = $u1; + require('priem/'.$this->stats[$this->uids[$u1]]['u_priem'][$j][1].'.php'); + $at = $fx_priem($id,$at,$u1,$j); + unset(${'fx_priem'}); + } + } + $j++; + }*/ + + $i++; + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + $i++; + } + + return $at; + } + + //Повторная проверка приемов + public function priemsRestartRazmen($id, $at) + { + if (isset($at['p'])) { + // + //Проверка + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + /* + Если возникнут проблемы с приемами, придется переписать алгоритм, сейчас он выглядит так: + Цикл 1. Проверяем пользователя + Цикл 2 внутри Цикла 1. Проверяем приемы поторые пользователь использовал + Придется сделать: + Цикл 1. Проверяем пользователя + Цикл 2 внутри Цикла 1. Проверяем приемы уворота + Цикл 3. Проверяем пользователя + Цикл 4 внутри Цикла 3. Проверяем приемы крита + и т.д. + */ + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } else { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { + if ($this->testPriemVarTrueZash($i, 4, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, + $u1, $u2) == false) { + } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u2, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u2, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + $i++; + } + // + $at = $at['p']; + unset($at['p']); + } + return $at; + } + + //Проверка действия приема + public function testPriemVarTrueZash($i, $id, $pid, $a, $b, $u1, $u2) + { + $r = true; + //echo '['.$pid.','.$i.','.$a.','.$b.']'; + $g = [ + 45 => ['221' => true], + ]; + if (isset($g[$pid])) { + //echo 1; + if ($g[$pid][$i . $a . $b] == true) { + $r = true; + } else { + // $r = false; + } + } + return $r; + } + + //Проверка урона приемов + public $um_priem = []; + + /** + * Трогать очень осторожно. Этот шайтан как-то проверяет приёмы на враге + * и рассчитывает урон учитывая и эти приёмы тоже. + * @param $uid1 + * @param $uid2 + * @param $priem + * @param $yron + * @param $profil + * @param $stabil + * @param $test + * @param $inlog + * @return float|int|mixed + */ + public function testYronPriem($uid1, $uid2, $priem, $yron, $profil, $stabil, $test = false, $inlog = 0) + { + /* + profil = { + -1 - урон оружием + -2 - урон магией + 0 - неизвестно + 1-4 - профильный оружия + 5-12 - профильный магия + } + stabil - урон не подвержен мощностям и т.д + */ + //Проверка + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + + //Проверяем приемы защиты игрока $u1 на урон игрока $u2 + //Получаем приемы и смотрим когда какой действует + if (!isset($this->stats[$this->uids[$u2]]['u_priem'])) { + $eff = $this->stats[$this->uids[$u2]]['effects']; + $j = 0; + while ($j <= count($eff)) { + if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { + $this->stats[$this->uids[$u2]]['u_priem'][] = [ + $j, + $eff[$j]['v2'], + $this->prm[$eff[$j]['v2']]['act'], + $eff[$j]['id'], + $this->prm[$eff[$j]['v2']]['type_of'], + $this->prm[$eff[$j]['v2']]['moment'], + ]; + } + $j++; + } + unset($eff); + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $yron = $fx_moment($u2, $u1, $j, $yron, $profil); + unset(${'fx_moment'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + $j++; + } + + //Прочие приемы (влияет на урон от моментальных приемов) + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][7] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this_seven = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment_seven)) { + $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment_seven'}); + } + } + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 180) { + // Переохлаждение (снижает урон на 10%). Пан или пропал. + $x = mysql_fetch_row(mysql_query('select x from eff_users where v2 = 180 and uid = ' . $u1)); + $yron = 0.1 * $x[0]; + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + + $j++; + } + + if ($this->stats[$this->uids[$u2]]['zaproc'] > 0) { + $yron = round($yron - $yron * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + if ($yron < 1) { + $yron = 1; + } + } + //var_dump($this->stats[$this->uids[$u2]]['u_priem']); + return $yron; + } + + //Опыт + набитый урон за удар приемом\магией + public function priemYronSave($u1, $u2, $yron, $type) + { + //$type 0 - урон , 1 - хил + + $this->testUserInfoBattle($u1); + $this->testUserInfoBattle($u2); + + if (isset($this->uids[$u1])) { + if ($this->stats[$this->uids[$u2]]['hpAll'] <= 1000) { + $adt6 = round(0.1 * (floor($yron) / $this->stats[$this->uids[$u2]]['hpAll'] * 100), 10); + } else { + $adt6 = round(0.1 * (floor($yron) / 1000 * 100), 10); + } + + if ($yron > $this->stats[$this->uids[$u2]]['hpNow']) { + $yron = $this->stats[$this->uids[$u2]]['hpNow']; + } + + if ($yron > 0) { + $this->users[$this->uids[$u1]]['battle_yron'] += $yron; + $this->users[$this->uids[$u1]]['battle_exp'] += round(1 * $this->testExp($yron, + $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2)); + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic6'] += $adt6; + $this->stats[$this->uids[$u1]]['tactic6'] += $adt6; + } else { + $this->users[$this->uids[$u1]]['tactic6'] += $adt6 / 3; + $this->stats[$this->uids[$u1]]['tactic6'] += $adt6 / 3; + } + } else { + $adt6 = 0; + } + // + $this->users[$this->uids[$u2]]['last_hp'] = -$yron; + // + mysql_query('UPDATE `stats` SET + `tactic6` = `tactic6` + "' . $adt6 . '", + `battle_yron` = `battle_yron` + "' . $yron . '", + `battle_exp` = `battle_exp` + "' . round($this->testExp($yron, $this->stats[$this->uids[$u1]], + $this->stats[$this->uids[$u2]], $u1, $u2)) . '" + WHERE `id` = "' . $u1 . '" LIMIT 1'); + // + mysql_query('UPDATE `stats` SET + `last_hp` = "' . $this->users[$this->uids[$u2]]['last_hp'] . '" + WHERE `id` = "' . $u2 . '" LIMIT 1'); + } + $this->addNewStat( + [ + 1 => [ + 'battle' => $this->info['id'], + 'uid1' => $this->users[$this->uids[$u1]]['id'], + 'uid2' => $this->users[$this->uids[$u2]]['id'], + 'time' => time(), + 'type' => 0, + 'a' => '10000', + 'b' => 0, + 'type_a' => 1, + 'type_b' => 0, + 'ma' => 1, + 'mb' => 1, + 'yrn' => $yron, + 'yrn_krit' => 0, + 'tm1' => $this->users[$this->uids[$u1]]['team'], + 'tm2' => $this->users[$this->uids[$u2]]['team'], + ], + ] + ); + } + + //Наносим удар между игроками + public $restart_stats_data = []; + + public function a_restart_stats($uid1, $glob) + { + if ($uid1 > 0 && isset($this->restart_stats_data[$uid1])) { + $this->stats[$this->uids[$uid1]] = $this->restart_stats_data[$uid1]; + if ($glob == 1) { + unset($this->restart_stats_data[$uid1]); + } + } + } + + public function a_save_stats($uid1) + { + if ($uid1 > 0) { + $this->restart_stats_data[$uid1] = $this->stats[$this->uids[$uid1]]; + } + } + + public function a_testing_stats($uid1, $zona) + { + //$this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid1]] , $zona ); + if ($uid1 > 0) { + $this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats($this->stats[$this->uids[$uid1]], $zona); + } + } + + public $import_atack = []; + public $contr = []; + public $import_user = 0; + + public function startAtack($id) + { + global $c, $u, $log_text, $priem; + // + $this->prlog = []; + // + $this->inport_user = 0; + // + $vrm = [ + 'uid1' => $this->atacks[$id]['uid1'], + 'uid2' => $this->atacks[$id]['uid2'], + ]; + // + /* + if( $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0 ) { + $this->atacks[$id]['uid1'] = $this->atacks[$id]['uid2']; + }elseif( $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0 ) { + $this->atacks[$id]['uid2'] = $this->atacks[$id]['uid1']; + } + */ + if (isset($this->atacks[$id]) && $this->atacks[$id]['lock'] == 0) { + //Прием разгадать тактику + $i = 1; + $j = 2; + $k = 0; + $unpr = ''; + while ($i <= 2) { + $untac = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "217" AND `uid` = "' . $this->atacks[$id]['uid' . $i] . '" AND `delete` = 0 LIMIT 1')); + + $agrs = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "211" AND `uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `delete` = 0 LIMIT 1')); + + if (isset($untac['id']) && !isset($agrs['id'])) { + // AND `a`.`v2` != 235 // AND `a`.`v2` != 273 AND `a`.`v2` != 286 AND `a`.`v2` != 287 AND `a`.`v2` != 288 + + $pvr['sp'] = mysql_query('SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" + + AND `a`.`v2` != 222 + + AND `a`.`v2` != 238 + + AND `a`.`v2` != 228 + AND `a`.`v2` != 229 + + AND `a`.`v2` != 139 + AND `a`.`v2` != 188 + AND `a`.`v2` != 226 + AND `a`.`v2` != 211 + AND `a`.`v2` != 49 + AND `a`.`v2` != 233 + AND `a`.`v2` != 227 + AND `a`.`v2` != 220 + AND `a`.`v2` != 191 + AND `a`.`v2` != 332 + AND `a`.`v2` != 333 + AND `a`.`v2` != 334 + AND `a`.`v2` != 335 + AND `a`.`v2` != 236 + + AND `a`.`v2` != 201 + + AND `a`.`v2` != 261 AND `a`.`v2` != 262 AND `a`.`v2` != 206 AND `a`.`v2` != 207 AND `a`.`v2` != 208 AND `a`.`v2` != 209 + AND `a`.`v2` != 210 AND `a`.`v2` != 284 + AND `a`.`v2` != 263 AND `a`.`v2` != 258 AND `a`.`v2` != 29 AND `a`.`v2` != 30 + AND `a`.`v2` != 31 AND `a`.`v2` != 32 AND `a`.`v2` != 256 AND `a`.`v2` != 249 + AND `a`.`v2` != 248 AND `a`.`v2` != 187 AND `a`.`v2` != 245 AND `a`.`v2` != 175 + AND `a`.`v2` != 176 AND `a`.`v2` != 177 AND `a`.`v2` != 178 AND `a`.`v2` != 179 + AND `a`.`v2` != 285 AND `a`.`v2` != 36 AND `a`.`v2` != 85 AND `a`.`v2` != 86 + AND `a`.`v2` != 87 AND `a`.`v2` != 88 AND `a`.`v2` != 89 AND `a`.`v2` != 90 + AND `a`.`v2` != 269 AND `a`.`v2` != 276 AND `a`.`v2` != 277 AND `a`.`v2` != 270 + AND `a`.`v2` != 174 + AND `a`.`v2` != 324 + + AND `a`.`v2` != 217 + + AND `name` NOT LIKE "%Иммунитет%" + + LIMIT 30'); + while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { + $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1')); + if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { + $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); + } + } + // + $k++; + } + $j--; + $i++; + } + if ($u->info['admin'] > 0) { + //die('test'); + } + // + //UPDATE ... SET `lock` = 1 + //Копируем характиристики + //$this->a_save_stats($this->atacks[$id]['uid1']); + //$this->a_save_stats($this->atacks[$id]['uid2']); + // + + //Восстановление манны 1% за ход + if ($this->atacks[$id]['out1'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); + } + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; + } + // + if ($this->atacks[$id]['out2'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); + } + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; + } + // + //$this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; + //$this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; + // + + //Антистаты + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3']); + } + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3']); + } + //Если у ловкача ловкости больше нужной - добавляем лишнее АУ,, + /*if( $this->users[$this->uids[$this->atacks[$id]['uid1']]]['level'] == 7 ) { + if( $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2'] > 55 ) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m5'] += ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2']-5)*6; + } + } + + if( $this->users[$this->uids[$this->atacks[$id]['uid2']]]['level'] == 7 ) { + if( $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s2'] > 55 ) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m5'] += ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2']-5)*6; + } + }*/ + + // + $last_yrn = [ + 1 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], + 2 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'], + ]; + + //Расчет количества блоков и противников + $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + + // Получаем приемы игроков + $this->priemsRazmen($id, $at); + $this->priemsRazmenMoment($id, $at); + $this->priemsRazmen($id, $at); + + // Тестируем размены (получаем куда игрок ударил, куда попал, куда блок) + if ($this->atacks[$id]['uid2'] == 1) { + // $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['zona'] += 1; + // $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['zona'] += 1; + } + $at = $this->newRazmen($id); + + // Тестируем какие еще могут быть варианты при ударе + // Уворот, парирование, крит, пробить блок, блок щитом + // Блок щитом (если есть щит, конечно) + /* + $at = $this->mf4Razmen($id,$at,0); + // Крит + $at = $this->mf2Razmen($id,$at,0); + // Уворот + $at = $this->mf1Razmen($id,$at,0); + // Парирование + $at = $this->mf3Razmen($id,$at,0); + // Контрудар + $at = $this->mf5Razmen($id,$at,0); + // Считаем тип урона и урон + $at = $this->yronRazmen($id,$at); + */ + $at = $this->mf2Razmen($id, $at, $v); //крит + $at = $this->mf3Razmen($id, $at, $v); //парирование + $at = $this->mf4Razmen($id, $at, $v); //блок щитом + + $at = $this->mf1Razmen($id, $at, $v); //уворот + $at = $this->mf5Razmen($id, $at, $v); //контрудар + + $at = $this->yronRazmen($id, $at); //расчет урона + + // Проверяем приемы + //['effects'][ + // Получаем приемы игроков + $at = $this->priemsTestRazmen($id, $at); + // Собираем размен (пересчитываем и расчитываем урон и т.д) + $at = $this->priemsRestartRazmen($id, $at); //Повторная проверка приемов (если требуется) + // + + //Минусуем поглощенный урон + if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); + } + if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); + } + + // Обновляем НР и добавляем тактики + $at = $this->updateHealth($id, $at); + + // Заносим в логи + записываем статистику боя + //mysql_query('LOCK TABLES battle_logs WRITE'); + $this->addlogRazmen($id, $at); + //mysql_query('UNLOCK TABLES'); + //echo $this->seeRazmen($id,$at); + // NEW BATTLE SYSTEM + + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + + /* + if( $this->stats[$this->uids[$vrm['uid1']]]['yhod'] > 0 ) { + $this->atacks[$id]['uid1'] = $vrm['uid1']; + }elseif( $this->stats[$this->uids[$vrm['uid2']]]['yhod'] > 0 ) { + $this->atacks[$id]['uid2'] = $vrm['uid2']; + } + */ + + // + //Возращаем зоны блока + $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + //обновляем задержки приемов + $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); + $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); + $zd1id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems']); + $zd2id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems']); + // + $prmos = []; + // + $i5 = 0; + + while ($i5 < 51) { + if (isset($zd1[$i5]) && $zd1[$i5] > 0) { + //Если приемы не требуют ход + //$tstpm = mysql_fetch_array(mysql_query('SELECT `id` FROM `priems` WHERE `id` = "'.$zd1id[$i5].'" AND `activ` = 1 AND `img` NOT LIKE "wis_%" LIMIT 1')); + // + //if(isset($tstpm['id'])) { + // + $zd1[$i5] -= 1; + //}elseif( $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] ) { + //Обнуляем приемы не требующие ход + // $zd1[$i5] -= 1; + //}else{ + //не обнуляем (только те что требуют ход) + // if(!isset($prmos[$zd1id[$i5]])) { + // $prmos[$zd1id[$i5]] = mysql_fetch_array(mysql_query('SELECT `id`,`tr_hod` FROM `priems` WHERE `id` = "'.$zd1id[$i5].'" LIMIT 1')); + // } + // if( $prmos[$zd1id[$i5]]['tr_hod'] > 0 ) { + // $zd1[$i5] -= 1; + // } + //} + } else { + $zd1[$i5] = 0; + } + if (isset($zd2[$i5]) && $zd2[$i5] > 0) { + //Если приемы не требуют ход + //$tstpm = mysql_fetch_array(mysql_query('SELECT `id` FROM `priems` WHERE `id` = "'.$zd2id[$i5].'" AND `activ` = 1 AND `img` NOT LIKE "wis_%" LIMIT 1')); + // + //if(isset($tstpm['id'])) { + // + $zd2[$i5] -= 1; + //}elseif( $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] ) { + //Обнуляем приемы не требующие ход + // $zd2[$i5] -= 1; + //}else{ + //не обнуляем (только те что требуют ход) + // if(!isset($prmos[$zd2id[$i5]])) { + // $prmos[$zd2id[$i5]] = mysql_fetch_array(mysql_query('SELECT `id`,`tr_hod` FROM `priems` WHERE `id` = "'.$zd2id[$i5].'" LIMIT 1')); + // } + // if( $prmos[$zd2id[$i5]]['tr_hod'] > 0 ) { + // $zd2[$i5] -= 1; + // } + //} + } else { + $zd2[$i5] = 0; + } + $i5++; + } + unset($prmos); + + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } + + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } + + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); + if ($this->atacks[$id]['uid1'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd1); + } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd2); + } + // + //Проверяем тактики + $i = 1; + while ($i <= 6) { + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; + } + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; + } + $i++; + } + // + //Обновляем задержки предметов + mysql_query('UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100'); + + mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2'); + + //Обновляем задержки пирожков + mysql_query('UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + mysql_query('UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + + //Тактики + mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + + //Обновляем задержки пирожков + mysql_query('UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + + + //Обновляем данные в battle_users + mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); + mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); + //Восстановление манны 25% от мудрости за ход + + $last_yrn = [ + 1 => $last_yrn[1], + 2 => $last_yrn[2], + 10 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], + 20 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'], + ]; + + $last_yrn[100] = floor($last_yrn[10] - $last_yrn[1]); + $last_yrn[200] = floor($last_yrn[20] - $last_yrn[2]); + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $this->save_stats($this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'])); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $this->save_stats($this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'])); + } + mysql_query('UPDATE `stats` SET + + `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '", + `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] . '", + `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] . '", + `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic2'] . '", + `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic3'] . '", + `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic4'] . '", + `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic5'] . '", + `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic6'] . '", + `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic7'] . '", + + `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] . '", + `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'] . '", + `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['last_hp'] . '", + `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_exp'] . '", + `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] . '" + + WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); + // + mysql_query('UPDATE `stats` SET + + `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '", + `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] . '", + `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic1'] . '", + `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic2'] . '", + `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic3'] . '", + `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic4'] . '", + `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic5'] . '", + `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic6'] . '", + `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic7'] . '", + + `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] . '", + `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] . '", + `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['last_hp'] . '", + `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_exp'] . '", + `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] . '" + + WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); + // + $this->priemsRazmenMomentEnd($id, $at); + // + + // + //Минусуем заряд приема \ эффекта + $j = 1; + $jn = 1; + while ($j <= 2) { + $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; + $i = 0; + while ($i < count($eff)) { + if (isset($eff[$i])) { + if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { + $eff[$i]['hod']--; + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana($eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; + } + } + if (strripos($eff[$i]['data'], 'minprocmanahod')) { + $pvr = [ + 'x1' => 0, + 'x2' => 0, + 'd' => '', + 'i' => 0, + 'uid' => $eff[$i]['uid'], + 'color' => '', + 'color2' => '', + 'effx' => '', + 'x' => $eff[$i]['name'], + ]; + $pvr['d'] = explode('|', $eff[$i]['data']); + while ($pvr['i'] < count($pvr['d'])) { + if (isset($pvr['d'][$pvr['i']])) { + $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); + if ($pvr['d1'][0] == 'minprocmanahod') { + $pvr['d1'] = explode('x', $pvr['d1'][1]); + $pvr['x1'] = $pvr['d1'][0]; + $pvr['x2'] = $pvr['d1'][1]; + } + } + $pvr['i']++; + } + + $pvr['mp'] = round($this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand($pvr['x1'], + $pvr['x2'])); + $pvr['mpSee'] = 0; + $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); + $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; + $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; + + //$pvr['mp'] = $btl->hphe( $u->info['id'] , $pvr['hp'] ); + + if ($pvr['mpTr'] > 0) { + //Требуется хилл + if ($pvr['mpTr'] < $pvr['mp']) { + $pvr['mp'] = $pvr['mpTr']; + } + $pvr['mpSee'] = '+' . $pvr['mp']; + $pvr['mpNow'] += $pvr['mp']; + } + if ($pvr['mpNow'] > $pvr['mpAll']) { + $pvr['mpNow'] = $pvr['mpAll']; + } elseif ($pvr['mpNow'] < 0) { + $pvr['mpNow'] = 0; + } + if ($pvr['mpSee'] == 0) { + $pvr['mpSee'] = '--'; + } + + $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + $btl->users[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + mysql_query('UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] . '" WHERE `id` = "' . $pvr['uid'] . '" LIMIT 1'); + + $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex'], null); + $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' на ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (Мана)'; + $this->priemAddLog($id, 1, 2, $pvr['uid'], 0, + '' . $pvr['x'] . '', + $pvr['text2'], + ($this->hodID + 0) + ); + //echo '[Восстанавливаем '.round(rand($pvr['x1'],$pvr['x2'])).'% маны.]'; + unset($pvr); + } + + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['hod'] > 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; + mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); + } else { + //удаляем прием + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], + 3, $this->atacks[$id]['uid' . $jn]); + } + } + } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); + } else { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + if (isset($eff[$i]['priem']['minmana']) && round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana($eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn]); + } + } + } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && $c['effz'] > 0) { + $eff[$i]['hod']--; + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['hod'] > 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; + mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); + } else { + //удаляем прием + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn]); + } + } + } + // + } + } + $i++; + } + $j++; + } + // + // + //Проверяем + if ($c['propsk_die'] > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + $cn1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1')); + $cn2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1')); + if ($cn1[0] > 3) { + // + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid1'], 0, '', + $pvr['text2'], + ($this->hodID + 0) + ); + unset($pvr); + mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); + } + if ($cn2[0] > $c['propsk_die']) { + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid2'], 0, '', + $pvr['text2'], + ($this->hodID + 0) + ); + unset($pvr); + mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); + } + } + // + //Обновляем текущего противника + if ($u->info['id'] == $this->atacks[$id]['uid1']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } + if ($u->info['id'] == $this->atacks[$id]['uid2']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } + //Удаляем размен из базы //ТУТ возможен лаг удаления + mysql_query('DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR + ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )'); + + //$this->a_restart_stats($this->atacks[$id]['uid1'],1); + //$this->a_restart_stats($this->atacks[$id]['uid2'],1); + + unset($old_s1, $old_s2); + unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->atacks[$id]); + mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1'); + // + //Возвращаем старые характеристики + /* + $this->stats[$this->uids[$this->atacks[$id]['uid1']]] = $old_s1; + $this->stats[$this->uids[$this->atacks[$id]['uid2']]] = $old_s2; + */ + unset($old_s1, $old_s2); + // + } + } + + //Сохранение данные + public function save_stats($uid) + { + mysql_query('UPDATE `stats` SET + + `hpNow` = "' . $this->stats[$this->uids[$uid]]['hpNow'] . '", + `mpNow` = "' . $this->stats[$this->uids[$uid]]['mpNow'] . '", + `tactic1` = "' . $this->users[$this->uids[$uid]]['tactic1'] . '", + `tactic2` = "' . $this->users[$this->uids[$uid]]['tactic2'] . '", + `tactic3` = "' . $this->users[$this->uids[$uid]]['tactic3'] . '", + `tactic4` = "' . $this->users[$this->uids[$uid]]['tactic4'] . '", + `tactic5` = "' . $this->users[$this->uids[$uid]]['tactic5'] . '", + `tactic6` = "' . $this->users[$this->uids[$uid]]['tactic6'] . '", + `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '", + + `enemy` = "' . $this->users[$this->uids[$uid]]['enemy'] . '", + `battle_yron` = "' . $this->users[$this->uids[$uid]]['battle_yron'] . '", + `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", + `battle_exp` = "' . $this->users[$this->uids[$uid]]['battle_exp'] . '", + `priems_z` = "' . $this->users[$this->uids[$uid]]['priems_z'] . '" + + WHERE `id` = "' . $uid . '" LIMIT 1'); + } + + //Отображение НР + public function hpSee($now, $all, $type = 1) + { + $r = '[' . $now . '/' . $all . ']'; + if ($all > 10000) { + $type = 2; + } + if ($type == 1) { + } elseif ($type == 2) { + $p1 = floor($now / $all * 100); + $r = '[' . $p1 . '/100%]'; + } + return $r; + } + + //Быстрый лог + public function addFlog($t, $u1, $u2) + { + $vLog = ''; + if (isset($this->info[$this->uids[$u1]]['id'])) { + $vLog .= 'time1=' . time() . '||s1=' . $this->users[$this->uids[$u1]]['id']['sex'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login'] . '||'; + } + if (isset($this->info[$this->uids[$u2]]['id'])) { + $vLog .= 'time2=' . time() . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||login2=' . $this->users[$this->uids[$u2]]['login'] . ''; + } + $vLog = rtrim($vLog, '||'); + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $mas1['text'] = $t; + $this->add_log($mas1); + } + + + //Выводим лог боя + /* public function logCache() + { + global $c,$u,$log_text; + sleep(2); + $thishodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" ORDER BY `id` DESC LIMIT 1')); + if(isset($hodID['id'])) { + $hodID = $hodID['id']; + }else{ + $hodID = 0; + } + if( $hodID > $this->info['hod'] ) { + unlink("../../battle_logs/btl_".$this->info['id'].".js"); + $this->info['hod'] = $hodID; + mysql_query('UPDATE `battle` SET `hod` = "'.$hodID.'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); + if( $u->info['design'] == 1 ) { + $js = ''; $pll = 0; + if($_POST['idlog']<1){ $_POST['idlog'] = 0; } + // + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" AND `id` > '.mysql_real_escape_string($_POST['idlog']).' AND `id_hod` > '.($this->hodID-7).' LIMIT 100'); + $jin = 0; $forYou2 = 0; + while($pl = mysql_fetch_array($sp)) + { + $jin++; + $rt = $pl['text']; + $pl['vars'] = str_replace('^^^^','rvnO',$pl['vars']); + $rt = str_replace('{tm1}',''.date('H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm2}',''.date('H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm3}',''.date('d.m.Y H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm4}',''.date('d.m.Y H:i',$pl['time']).'',$rt); + $pl['text'] = $rt; + unset($rt); + if($pll < $pl['id']) { + $pll = $pl['id']; + } + $js = 'add_log('.$pl['id'].','.$forYou2.',"'.$pl['text'].'",'.$pl['id_hod'].',0,0,"'.str_replace('"','"',$pl['vars']).'");'.$js; + } + $js .= 'id_log='.$pll.';'; + }else{ + $js = ''; $pll = 0; + if($_POST['idlog']<1){ $_POST['idlog'] = 0; } + // + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" AND `id` > '.mysql_real_escape_string($_POST['idlog']).' AND `id_hod` > '.($this->hodID-7).' LIMIT 100'); + $jin = 0; $forYou2 = 0; + while($pl = mysql_fetch_array($sp)) + { + $jin++; + $rt = $pl['text']; + //$rt = str_replace('^^^^','=',$rt); + $pl['vars'] = str_replace('^^^^','rvnO',$pl['vars']); + $rt = str_replace('{tm1}',''.date('H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm2}',''.date('H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm3}',''.date('d.m.Y H:i',$pl['time']).'',$rt); + $rt = str_replace('{tm4}',''.date('d.m.Y H:i',$pl['time']).'',$rt); + $pl['text'] = $rt; + unset($rt); + if($pll < $pl['id']) { + $pll = $pl['id']; + } + $js = 'add_log('.$pl['id'].','.$forYou2.',"'.$pl['text'].'",'.$pl['id_hod'].',0,0,"'.str_replace('"','"',$pl['vars']).'");'.$js; + } + $js .= 'id_log='.$pll.';'; + } + // + $fp = fopen("battle_logs/btl_".$this->info['id'].".js", "w"); + fwrite($fp, 'var vlogid = '.$this->info['hod'].';var loadingLogNow = true;function logRefleshedCache(){ '.$js.' }'); + fclose($fp); + // + } + return true; + }*/ + + //Выводим лог боя + public function lookLog() + { + global $c, $u, $log_text; + $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); + if ($hodID['id_hod'] <= 1) { + $u->info['alog'] = 0; + } + if (isset($hodID['id']) && $this->info['team_win'] != -1) { + $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); + } + if (isset($hodID['id'])) { + $hodID = $hodID['id']; + } else { + $hodID = 0; + } + + $updt = 0; + if ($u->info['design'] == 1) { + $js = ''; + $pll = 0; + if ($_POST['idlog'] < 1) { + $_POST['idlog'] = 0; + } + $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + if (isset($sp) && $this->info['team_win'] != -1) { + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + } + $jin = 0; + $forYou2 = 0; + while ($pl = mysql_fetch_array($sp)) { + if ($jin == 0) { + $u->info['alog'] = $pl['id_hod']; + } + $jin++; + if ((true == false) && ($pl['type'] == 1 || $pl['type'] == 6)) { + } else { + $rt = $pl['text']; + //$rt = str_replace('^^^^','=',$rt); + $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); + $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', + $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', + $rt); + $rt = str_replace('{tm3}', + '' . date('d.m.Y H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm4}', + '' . date('d.m.Y H:i', $pl['time']) . '', $rt); + $pl['text'] = $rt; + } + unset($rt); + if ($pll < $pl['id']) { + $pll = $pl['id']; + } + $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', + '"', $pl['vars']) . '");' . $js; + } + mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); + $js .= 'id_log=' . $pll . ';'; + } else { + $js = ''; + $pll = 0; + if ($_POST['idlog'] < 1) { + $_POST['idlog'] = 0; + } + $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + if (isset($sp) && $this->info['team_win'] != -1) { + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + } + $jin = 0; + $forYou2 = 0; + while ($pl = mysql_fetch_array($sp)) { + if ($jin == 0) { + $u->info['alog'] = $pl['id_hod']; + } + $jin++; + $rt = $pl['text']; + //$rt = str_replace('^^^^','=',$rt); + $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); + $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $pl['time']) . '', + $rt); + $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $pl['time']) . '', + $rt); + $pl['text'] = $rt; + unset($rt); + if ($pll < $pl['id']) { + $pll = $pl['id']; + } + $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', + '"', $pl['vars']) . '");' . $js; + } + mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); + $js .= 'id_log=' . $pll . ';'; + } + + + return $js; + } + +//Новый лог Мой Лог + public function lookmLog() + { + global $c, $u, $log_text; + $js = ''; + $pll = 0; + + if ($this->info['type'] != 9) { + $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); + if ($hodID['id_hod'] <= 1) { + $u->info['mlog'] = 0; + } + if (isset($hodID['id']) && $this->info['team_win'] != -1) { + $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); + } + if (isset($hodID['id'])) { + $hodID = $hodID['id']; + } else { + $hodID = 0; + } + $tmlog = mysql_fetch_array(mysql_query('SELECT `mlog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); + $spm = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); + + if (isset($spm) && $this->info['team_win'] != -1) { + $spm = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); + } + + $jin = 0; + $forYou2 = 0; + + while ($plm = mysql_fetch_array($spm)) { + if ($jin == 0) { + $u->info['mlog'] = $plm['id_hod']; + } + $jin++; + $rt = $plm['text']; + $plm['vars'] = str_replace('^^^^', 'rvnO', $plm['vars']); + $rt = str_replace('{tm1}', '' . date('H:i', $plm['time']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $plm['time']) . '', $rt); + $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $plm['time']) . '', + $rt); + $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $plm['time']) . '', + $rt); + $plm['text'] = $rt; + unset($rt); + if ($pll < $plm['id']) { + $pll = $plm['id']; + } + $js = 'add_mlog(' . $plm['id'] . ',' . $forYou2 . ',"' . $plm['text'] . '",' . $plm['id_hod'] . ',0,0,"' . str_replace('"', + '"', $plm['vars']) . '");' . $js; + } + $js .= 'id_mlog=' . $pll . ';'; + mysql_query('UPDATE `stats` SET `mlog`="' . $u->info['mlog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); + } + return $js; + } +//====================== + + //Добавляем в лог + public function add_log($mass) + { + if (empty($mass['text'])) { + return; + } + mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES (unix_timestamp(), "' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $mass['text'] . '","' . $mass['vars'] . '","' . $mass['type'] . '")'); + if (rand(2, 10) == 10) { + $this->get_comment(); + } + } + + ///Комментатор + public function get_comment() + { + $boycom = [ + 'А танцуешь ты лучше.', + 'А мы что, в прятки тут играем?', + 'А вы разве пингвинов никогда не видели?', + 'А, ведь когда-то, вы были красивыми… А теперь? Ну и рожи! Жуть!', + 'А потом еще труп пинать будут.', + 'А я вчера ночью за соседями подглядывал. Они точно так же кувыркались', + 'А ведь вы живых людей дубасите...', + 'А вот я вчера в зоопарке был...', + 'А вы в стройбате не служили?', + 'А вы видели, чтобы так на улице делали!?', + 'А вы знали что ёжики размножаются в интернете?', + 'А жить-то, как хочется:', + 'А из-за чего вы собственно дерётесь?', + 'А чего ржёте, вы ещё остальных не видели', + 'А что произойдёт если ты испугаешся до полусмерти дважды?!', + 'Больше так не делай. Ты же не садист?', + 'Без комментариев...', + 'Больно ведь!', + 'Быстро ты за монитор спрятался!', + 'Все хотят попасть в рай, но никто не хочет умирать!', + 'Вчера с такой девчонкой познакомился.', + 'Всего 5 минут знакомы, а дерутся, словно супруги с 20-ти летним стажем...', + 'Все. Я так больше не могу.', + 'В конце концов, кто-то победит?', + 'Вы чего, с дерева упали?', + 'Возятся как сонные мухи... давайте я вам лучше анекдот расскажу: ...', + 'Вот видишь, как полезно чистить зубы на ночь?', + 'Вот вы все руками махаете, а за вами уже очередь', + 'Вот попадёте вы в плен и вас там будут долго бить. Но вы ничего не расскажете... и не потому, что вы такой стойкий, просто вы ничего не знаете', + 'Вы бы лучше пошли потренировались!', + 'Вы все еще разминаетесь? Позовите, когда кости в муку друг другу разминать будете.', + 'Вы же бойцы! Имейте совесть!', + 'Гаси недоумка!', + 'Да, если бы я смог это остановить, то получил бы нобелевскую премию `За мир` ', + 'Да куда они бьют?!', + 'Давайте быстрее! За вами уже очередь образовалась.', + 'Давайте обойдемся сегодня таймаутом. А? А то мне уже кошмары скоро будут сниться.', + 'Дерутся как девчонки!', + 'Дети, посмотрите налево... Ой!.. Нет, туда лучше не смотреть.', + 'Если так будет продолжаться, то скоро мы заснем!', + 'Если бы у меня было кресло-качалка, я бы в нём качался...', + 'Если вы что-то сказать хотите, то лучше молчите :)', + 'Жестокость не порок.', + 'Жизнь вне нашего клуба - это пустая трата кислорода!!!', + 'Жми! Дави! Кусай! Царапай!', + 'За такие бои надо в хаос отправлять!', + 'Знаете откуда в комиссионном магазине столько вещей? Это я после ваших гулянок собираю и сдаю туда. Иногда вместе с частями тела, застрявшими в них.', + 'Здесь люди так близки друг к другу. Просто иначе ударить нельзя.', + 'И пролитая кровь еще пульсирует...', + 'Инвалидов развелось...', + 'Какой бой!!!', + 'Кто!? Кто здесь?!', + 'Кто вас этому научил?', + 'Кузнечик, блин...', + 'Куплю импортный проигрыватель грампластинок.', + 'Лошадью ходи!', + 'Лучше враг, чем друг - враг.', + 'Ладно, вы тут пока друг друга за волосы таскайте, а я пойду, пообедаю.', + 'Мне ваш балет уже надоел!', + 'Может, начнется-таки настоящий бой???', + 'Мысли лезут в голову изнутри, а удары снаружи.', + 'Ну и где ваши коронные удары? Где живописные падения я спрашиваю!', + 'Ну, нельзя же так наотмашь лупить!', + 'Надо раньше было думать, теперь смертельно поздно...', + 'На такое зрелище билеты продавать можно. Народ ухохочется!', + 'Нет! Не надо драки! А... ладно деритесь, все равно не умеете.', + 'Нет, ну должен быть повод, должен же быть повод?', + 'Нет, я отказываюсь это комментировать!', + 'Не таких обламывали!', + 'Ну выпили вы рюмку, ну две... ну литр, ну два... так зачем же после этого драку затевать?!', + 'Ну и кто за этот погром платить будет?', + 'Ну и оскал у вас. Из вашей улыбки кастеты делать можно.', + 'Ну, что же ты..? Не печалься. Выше голову, так по ней удобней попасть.', + 'Ничего... Блок тоже удар.', + 'Обернись!!!.... Поздно...', + 'Ого! Научите меня так не делать.', + 'Осторожно! Сделаешь дырочку, уже не запломбируешь!', + 'Оно вам надо???', + 'Обычное дело...там что-то отклеилось.', + 'Ой, и заболтался я с вами...', + 'Он же не промахнётся если ты не отойдёшь!', + 'По-моему, кому-то светит инвалидность.', + 'Подкинь ему грабли, на которые он еще не наступал.', + 'Прав был кот Леопольд, давайте жить дружно?', + 'При ударе в живот нарушается кислотно-щелочной баланс.', + 'Проверь, не торчит ли у тебя нож из живота.', + 'Перестаньте мне орать!', + 'Подкинь ему грабли, на которые он еще не наступал.', + 'Прыгают тут как блохи... Все, я пошел за дихлофосом!', + 'Разбудите меня когда эта порнография закончится...', + 'Ребенок сильнее ударил бы!', + 'Славно вмазал!', + 'Славно они веселятся', + 'Смотрю вот на вас, и слезы наворачиваются.', + 'Сначала учатся ходить, а потом только в драку лезут.', + 'Так они друг другу что-нибудь сломают.', + 'Так ты ему все кости переломаешь!', + 'У меня в подъезде точно так же соседа отмудохали', + 'Убогих развелось...', + 'Ух ты, какой прыткий!', + 'Фашист!! Надо ж, так по больному месту врезать...', + 'Хватит бить его об угол моей кабинки! Мне же потом ее чинить.', + 'Хулиганы, прекратите немедленно!', + 'Хочешь, подскажу, куда он ударит?', + 'Хорошо, что у меня ловкости больше чем у вас всех, а то б вы и меня в инвалидную коляску посадили бы.', + 'Хороший бой!', + 'Хороший удар!', + 'Хиляк-разрядник!', + 'Что ты его за волосы схватил?! Отпусти немедленно!', + 'Щас я вас настигну, вот тогда мы и похохочем', + 'Это была какая-то неизвестная мне техника...', + 'Это же противник, а не глина! Хватит мяться!', + 'Это не бой, это издевательское избиение.', + 'Это поубавит спеси', + 'Это и был твой план `Б` ?', + 'Это была какая-то неизвестная мне техника...', + 'Я же предупреждал, - будет больно.', + 'Я не страдаю безумием. Я наслаждаюсь им каждую минуту :)', + 'Я красивый, я сильный, я умный, я добрый. А вот вы? Вы себя-то видели?!', + 'Я тоже умею драться, но не буду...', + '(тревожно озираясь) я вам по секрету скажу... за вами наблюдают!', + '<вырезано цензурой> после боя я этих <вырезано цензурой> обоих в <вырезано цензурой> и <вырезано цензурой>', + '<вырезано цензурой> каратисты фиговы', + ]; + //$act_com = array(); + if (rand(1, 6) == rand(1, 6)) { + $txt = '{tm1} Комментатор: ' . $boycom[rand(0, count($boycom) - 1)] . ''; + + $vLog = 'time1=' . time() . ''; + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $mas1['text'] = $txt; + $this->add_log($mas1); + } else { + return false; + } + } + + //Расчет типа удара от оружия + public function weaponTx($item) + { + global $u; + $tp = 0; + if (!isset($item['id'])) { + $i = 1; + while ($i <= 4) { + $itm['tya' . $i] = 1; + $i++; + } + } + $itm = $u->lookStats($item['data']); + $t[0]['z'] = 0; + $t[0]['t'] = 0; + //колящий урон + $t[1]['z'] = round(0 + $itm['tya1']); + $t[1]['t'] = 1; + //рубящий урон + $t[2]['z'] = round(0 + $itm['tya2']); + $t[2]['t'] = 2; + //дробящий урон + $t[3]['z'] = round(0 + $itm['tya3']); + $t[3]['t'] = 3; + //режущий урон + $t[4]['z'] = round(0 + $itm['tya4']); + $t[4]['t'] = 4; + //урон огня + $t[5]['z'] = round(0 + $itm['tym1']); + $t[5]['t'] = 5; + //урон воздуха + $t[6]['z'] = round(0 + $itm['tym2']); + $t[6]['t'] = 6; + //урон воды + $t[7]['z'] = round(0 + $itm['tym3']); + $t[7]['t'] = 7; + //урон земли + $t[8]['z'] = round(0 + $itm['tym4']); + $t[8]['t'] = 8; + //урон света + $t[9]['z'] = round(0 + $itm['tym5']); + $t[9]['t'] = 9; + //урон тьмы + $t[10]['z'] = round(0 + $itm['tym6']); + $t[10]['t'] = 10; + //урон серой магией + $t[11]['z'] = round(0 + $itm['tym7']); + $t[11]['t'] = 11; + + //Мешаем элементы массива + /* + $inr = array(); + $i = 1; + while( $i <= 11 ) { + if( $t[$i] > 0 ) { + $j = 0; + while( $j < $t[$i] ) { + //if(isset($itm['tya'.$i]) && $itm['tya'.$i] > 0 && $i < 5 && $itm['tya'.$i] > 0) { + //$inr[] = $i; + //}elseif(isset($itm['tym'.($i-4)]) && $itm['tym'.($i-4)] > 0 && $i > 4 && $itm['tym'.($i-4)] > 0) { + //$inr[] = $i; + //} + if( isset($itm['tya'.$i]) && $itm['tya'.$i] > 0 ) { + $inr[] = $i; + $rk .= '*'.$i.'='.$j.'%*|'; + }else{ + $rk .= ''.$i.'='.$j.'%|'; + } + $j++; + } + //if( $u->info['admin'] > 0 ) { + + //} + } + $i++; + } + //shuffle($inr); + $tp = $inr[rand(0,count($inr)-1)]; + if( !isset($itm['tya'.$tp]) || $itm['tya'.$tp] < 1 ) { + if(isset($item['id'])) { + $this->error($u->info['id'],'battle::weaponTx. Код ошибки: id предмета: -'.$item['id'].'-b'.$this->info['id'].'.(Тип атаки: tya'.$tp.'['.$itm['tya'.$tp].']).(Возможные типы атаки: '.$rk.').(Количество вариантов атак: '.count($inr).')'); + } + } + + //тип от оружия + if( $item['type'] == 18 ) { + $tp = 1; + }elseif( $item['type'] == 19 ) { + $tp = 2; + }elseif( $item['type'] == 20 ) { + $tp = 3; + }elseif( $item['type'] == 21 ) { + $tp = 4; + }else{ + //$tp = 0; + }*/ + + $tpt = $t[0]['z']; + $tpmin = $t[0]; + $tpmax = $t[0]; + $i = 1; + + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmax = $t[$i]; + $ii = $i; + } + $i++; + } + $t[$ii]['z'] = 0; + + $tpt = $t[0]['z']; + $i = 1; + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmin = $t[$i]; + } + $i++; + } + + $setclass = rand(1, 100); + + if ($setclass > $tpmax['z']) { + $tp = $tpmin['t']; + } else { + $tp = $tpmax['t']; + } + + + return $tp; + } + + //Функция ошибки + /*public function error($login,$t) { + mysql_query('INSERT INTO `chat_system` (`text`,`city`,`login`,`to`,`type`,`new`,`time`) VALUES ("'.mysql_real_escape_string($t).'","capitalcity","СИСТЕМА","'.$login.'","3","1","'.time().'")'); + }*/ + + + //Расчет урона от оружия + public function weaponAt($item, $st, $x) + { + $tp = 0; + $tp20 = 0; + if (isset($item['id'])) { + $itm = $this->lookStats($item['data']); + //начинаем расчет урона + $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; + $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; + if ($x != 0) { + /* + Колющий - 60% Силы и 40% Ловкости. + Рубящий - 70% Силы 20% Ловкости и 20% Интуиции. + Дробящий - 100% Силы. + Режущий - 60% Силы и 40% Интуиции. + */ + //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая + if ($x == 1) { + //колющий + $wst = $st['s2'] * 1; + $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; + $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; + $tp20 = 1; + } elseif ($x == 2) { + //рубящий + $wst = $st['s1'] * 0.75; + $min += 5 + (ceil($wst * 1.4) / 1) + $st['minAtack']; + $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; + $tp20 = 2; + } elseif ($x == 3) { + //дробящий + $wst = $st['s4'] * 1.5; + $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; + $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; + $tp20 = 3; + } elseif ($x == 4) { + //режущий + $wst = $st['s3'] * 1; + $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; + $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; + $tp20 = 4; + } elseif ($x >= 5 && $x <= 22) { + //урон магии и магии стихий + $wst = $st['s1'] * 0.01 + $st['s2'] * 0.01 + $st['s3'] * 0.01 + $st['s5'] * 0.06; + $min += 3 + (ceil($wst * 1.4) / 2.25) + $st['minAtack']; + $max += 5 + (ceil(0.4 + $min / 0.9) / 2.25) + $st['maxAtack']; + $tp20 = 5; + } else { + //без профильного урона + + } + + $wst = ($st['s1'] * 0.02 + $st['s2'] * 0.02 + $st['s3'] * 0.05); + $min1 = -2 + ceil($wst * 1.4) / 1.25; + $max1 = 4 + ceil(0.4 + $min1 / 0.9) / 1.25; + + $min = round(($min + $min1)); + //$max = round(($max+$max1)); + } + $tp = rand(($min + $max) / 3.5, (($min + $max) / 3.5 + (($min + $max) / 3.5) / 100 * 7)); + } + return $tp; + } + + //Расчет урона от оружия + public function weaponAt22($item, $st) + { + $tp = 0; + $tp20 = 0; + if (isset($item['id'])) { + $itm = $this->lookStats($item['data']); + //начинаем расчет урона + $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; + $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; + } + return [$min, $max]; + } + + public function domino($itm) + { + $r = 0; + //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u + //15 предметов + $clss = [ + 1 => 100, //шлем + 2 => 80, //наручи + 3 => 150, //оружие + 14 => 100, //щит + 5 => 200, //броня + 7 => 50, //пояс + 17 => 50, //ботинки + 10 => 80, //кольцо + 11 => 80, //кольцо + 12 => 80, //кольцо + 9 => 100, //амулет + 8 => 100, //серьги + 4 => 50, //рубаха + 16 => 80, //поножи + 6 => 50 //плащ + ]; + $r += $clss[$itm[0]]; + if ($itm[10] > 0) { + //екр.предмет + if ($itm[10] < 500) { + //не артефакт + $r += $clss[$itm[0]] * 4; + } else { + //артефакт + $r += $clss[$itm[0]] * 4; + } + } + return $r; + } + + public function adomino($itm) + { + $r = 0; + //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u + //15 предметов + $clss = [ + 1 => 80, //шлем + 2 => 60, //наручи + 3 => 130, //оружие + 14 => 80, //щит + 5 => 180, //броня + 7 => 30, //пояс + 17 => 30, //ботинки + 10 => 50, //кольцо + 11 => 50, //кольцо + 12 => 50, //кольцо + 9 => 80, //амулет + 8 => 80, //серьги + 4 => 30, //рубаха + 16 => 50, //поножи + 6 => 30 //плащ + ]; + $r += $clss[$itm[0]]; + return $r; + } + + public function domino_lvl($r, $lvl, $lvl_itm) + { + if ($lvl < $lvl_itm) { + $r = $r * ((50 - $lvl + $lvl_itm) / 100); + //расчет урона, если есть добавочные бонусы на подобии екр.вещей \ артефактов, либо легендарных предметов + $r = ceil($r); + } + return $r; + } + /* + public $bal = array( + //Расчет шанса победы X - Y + // танк , уворот , крит , силовик , универсал , маг + 'Танк' => array(0,50,90,00,90,50,50), // танк + 'Уворот' => array(0,00,50,90,00,50,70), // уворот + 'Крит' => array(0,90,00,50,90,30,50), // крит + 'Силовик' => array(0,00,90,00,50,50,50), // силовик + 'Универсал' => array(0,50,30,90,00,50,70), // универсал + 'Маг' => array(0,90,30,00,90,50,50) // маг + ); + */ + + /* + public function domino_all($v1,$v2,$d1,$d2) { + // Мощность класса 1 , Мощность класса 2 , Анти 1 , Анти 2 + //Расчет бонусов + $mx = 0; + $cs = array(NULL,'Танк','Уворот','Крит','Силовик','Универсал','Маг'); + $r = array( + 0 => 0, + 'Крит'=>array(), + 'Танк'=>array(), + 'Уворот'=>array(), + 'Универсал'=>array(), + 'Силовик'=>array(), + 'Маг'=>array() + ); + $i = 0; + while($i <= 7) { + if(isset($v1[$i]) || isset($v2[$i])) { + $r[$cs[$i]] = round(((1+($v1[$i]*1.3)-$v2[$i]+$d1[$i]+$d2[$i])/1300),2); + if($v1[$i] > $mx) { + $mx = $v1[$i]; + $r[0] = $cs[$i]; + $r[1] = $i; + } + } + $i++; + } + return $r; + }*/ + + public function yronLvl($lvl1, $lvl2) + { + $r = [ + 1 => [ + 0, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 2 => [ + 0, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 3 => [ + 0, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 4 => [ + 0, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 5 => [ + 0, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 6 => [ + 0, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 7 => [ + 0, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 8 => [ + 0, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + ], + 9 => [ + 0, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + 200, + 200, + ], + 10 => [ + 0, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + 200, + 200, + ], + 11 => [ + 0, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + 400, + 200, + ], + 12 => [ + 0, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + 800, + 600, + ], + 13 => [ + 0, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + 1200, + 1000, + ], + 14 => [ + 0, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + 1600, + 1400, + ], + 15 => [ + 0, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + 2000, + 1800, + ], + 16 => [ + 0, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + 2400, + 2200, + ], + 17 => [ + 0, + 6600, + 6400, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + 2800, + 2600, + ], + 18 => [ + 0, + 7000, + 6800, + 6600, + 6400, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + 3200, + 3000, + ], + 19 => [ + 0, + 7400, + 7200, + 7000, + 6800, + 6600, + 6400, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + 3600, + 3400, + ], + 20 => [ + 0, + 7800, + 7600, + 7400, + 7200, + 7000, + 6800, + 6600, + 6400, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + 4000, + 3800, + ], + 21 => [ + 0, + 8200, + 8000, + 7800, + 7600, + 7400, + 7200, + 7000, + 6800, + 6600, + 6400, + 6200, + 6000, + 5800, + 5600, + 5400, + 5200, + 5000, + 4800, + 4600, + 4400, + 4200, + ], + ]; + $r = floor($r[$lvl1][$lvl2] / 100); + $r = 0; + return $r; + } + //Гамс + //Расчет защиты + public function zago($v) + { + if ($v > 1700) { + $v = 1700; + } + $r = round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2); + return $r; + } + + //Расчет защиты (магия) + public function zmgo($v) + { + //if($v > 1000) { + // $v = 1000; + //} + $r = (1 - (pow(0.5, ($v / 250)))) * 100; + return $r; + } + + + public function yrn( + $st1, + $st2, + $u1, + $u2, + $level, + $level2 = null, + $type, + $min_yron, + $max_yron, + $min_bron = null, + $max_bron = null, + $vladenie, + $power_yron, + $power_krit, + $zashita, + $ozashita = null, + $proboi, + $weapom_damage, + $weapom_min, + $weapom_max, + $za_proc = null, + $zm_proc = null, + $zashitam = null, // pzm тут! + $ozashitam = null, + $wp_type, + $witm + ) { + global $u; + + //Поправка + if ($zashita < 1) { + $zashita = 1; + } + + if ($min_yron < 1) { + $min_yron = 1; + } + + if ($max_yron < 1) { + $max_yron = 1; + } + + if (!isset($type) || $type == '') { + $type = 12; + } + + //Параметры для возврвата + $r = ['min' => 0, 'max' => 0, 'type' => $type]; + $p = [ + 'Y' => 0, + 'B' => [0 => 0, 1 => 0, 'rnd' => false], + 'L' => $level, + 'W' => [$weapom_min, $weapom_max, 'rnd' => false], //минимальный урон //максимальный урон добавочный + 'U' => $vladenie, //владение оружием + 'M' => $power_yron, //мощность урона + 'K' => $power_krit, //мощность крита + 'S' => 0, //влияние статов на проф.урон + 'T' => 1, //Кф. оружия + 'iT' => 1, //Итоговый доп. Кф. оружия + /* + (S) - влияние наших статов на профильный урон + Колющий: S = Сила * 0,3 + Ловкость * 0,7 + Рубящий: S = Сила * 0,5 + Ловкость * 0,25 + Интуиция * 0,25 + Дробящий: S = Сила * 1 + Режущий: S = Сила * 0,3 + Интуиция * 0,7 + */ + ]; + + //$p['M'] = $p['M'] * 0.70; + //$p['K'] = $p['K'] * 0.70; //Тут мощность крита + + //Умножитель 1.33 для двуручки и 1.00 для одной руки + //if ($weapom_damage == 0) { $p['T'] = 1; }elseif($weapom_damage == 1) { $p['T'] = 2.33;$p['iT'] = 2.33;} + + $witmdata = $this->lookStats($witm['data']); + + //Расчет типа урона + + if ($wp_type == 18) { + $r['type'] = 1; + } elseif ($wp_type == 19) { + $r['type'] = 2; + } elseif ($wp_type == 20) { + $r['type'] = 3; + } elseif ($wp_type == 21) { + $r['type'] = 4; + } else { + $r['type'] = 0; + } + //ТУТ Профильный урон + //колющий + if ($r['type'] == 1) { + $p['S'] = $st1['s1'] * 0.25 + $st1['s2'] * 0.75; + $p['U'] = $st1['a1'] * 1.00; //кинжалы + //рубящий + } elseif ($r['type'] == 2) { + $p['S'] = $st1['s1'] * 1.20; + $p['U'] = $st1['a2'] * 1.00; //топоры + //дробящий + } elseif ($r['type'] == 3) { + $p['S'] = $st1['s1'] * 0.5 + $st1['s4'] * 1.00; + $p['U'] = $st1['a3'] * 1.00; //дубины + //режущий + } elseif ($r['type'] == 4) { + $p['S'] = $st1['s3'] * 1.00; + $p['U'] = $st1['a4'] * 1.00; //мечи + //Магиечески + } elseif ($r['type'] >= 5 && $r['type'] < 12) { + $p['S'] = $st1['s1'] * 0.5 + $st1['s2'] * 0.5; + $p['U'] = $st1['mg' . ($r['type'] - 4)] * 1.00; //магией + $p['Mage'] = true; + } else { + $p['S'] = 0; + $p['U'] = 0; // для кулака(нужно переписывать + } + //Тут общее усиление + //Колющий + /*if($r['type'] == 1) { //s2 ловка + if ($st1['s2']<100) + { + $p['S'] = $p['S']*0.15; + }elseif ($st1['s2']>=150 && $st1['s2']<250){ + $p['S'] = $p['S']*0.25; + }elseif ($st1['s2']>=250 && $st1['s2']<300){ + $p['S'] = $p['S']*0.50; + }elseif ($st1['s2']>=300){ + $p['S'] = $p['S']*0.65; + } + + //рубящий + }elseif($r['type'] == 2) { //s1 сила + if ($st1['s1']<100) + { + $p['S'] = $p['S']*0.25; + }elseif ($st1['s1']>=100 && $st1['s1']<200){ + $p['S'] = $p['S']*0.35; + }elseif ($st1['s1']>=200 && $st1['s1']<250){ + $p['S'] = $p['S']*0.45; + }elseif ($st1['s1']>=250){ + $p['S'] = $p['S']*0.50; + } + + //дробящий + }elseif($r['type'] == 3) { //s1 сила + if ($st1['s1']<100) + { + $p['S'] = $p['S']*0.50; + }elseif ($st1['s1']>=125 && $st1['s1']<150){ + $p['S'] = $p['S']*0.65; + }elseif ($st1['s1']>=150 && $st1['s1']<175){ + $p['S'] = $p['S']*0.75; + }elseif ($st1['s1']>=175){ + $p['S'] = $p['S']*0.85; + } + + //режущий + }elseif($r['type'] == 4) { //s3 инта + if ($st1['s3']<100) + { + $p['S'] = $p['S']*0.10; + }elseif ($st1['s3']>=150 && $st1['s3']<200){ + $p['S'] = $p['S']*0.15; + }elseif ($st1['s3']>=200 && $st1['s3']<250){ + $p['S'] = $p['S']*0.20; + }elseif ($st1['s3']>=250){ + $p['S'] = $p['S']*0.25; + } + + }*/ + + $r['bron']['rnd'] = rand($r['bron'][0], $r['bron'][1]); + + // + /*$r['bron'] = array($min_bron, $max_bron); //Броня зоны куда бьем + $r['bron']['rnd'] = rand($r['bron'][0],$r['bron'][1]); + //$r['bron']['rnd'] += $r['bron']['rnd']*0.01; //искуственное поднятие брони +1% + + $r['za'] = $zashita; //Защита от урона + $r['oza'] = $ozashita; //Особенность Защиты от урона + + $r['zm'] = $zashitam; //Защита от урона + $r['ozm'] = $ozashitam; //Особенность Защиты от урона*/ + + + /* + //Базовый урон + r.B[0] = $('#v1').val() * 0.51; + r.B[1] = r.B[0] + 3.73; + r.B[0] = Math.ceil(r.B[0]); + r.B[1] = Math.floor(r.B[1]); + if( r.B[0] < 0 ) { r.B[0] = 0; } + if( r.B[1] < 0 ) { r.B[1] = 0; } + r.B[0] += 5; + r.B[1] += 6; + // + */ + + //Остальные расчеты (коэфицент) + //$p['B'][0] = $st1['s1']*0.51; + //$p['B'][1] = $p['B'][0] + 3.73; + $p['B'][0] = 2 + $level + $st1['s1'] - round($st1['s1'] / 5); + $p['B'][1] = $p['B'][0] + 3; + /*$p['B'][0] += 5; + $p['B'][1] += 6;*/ + + $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); + $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); + + //Обычный урон + //$p['Mstart'] = 0; //Начальная мощность + if ($r['type'] == 12) { + $r['min'] = ($p['B'][0] + $weapom_min) * $p['T'] * (1 + $p['M'] / 100); + $r['max'] = ($p['B'][1] + $weapom_max) * $p['T'] * (1 + $p['M'] / 100); + } else { + $r['min'] = (($p['B'][0] + $p['S'] * 2 + $weapom_min * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); + $r['max'] = (($p['B'][1] + $p['S'] * 2 + $weapom_max * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); + //$r['min'] = (($p['B'][0]+$p['S']+$weapom_min)*$p['T']*(1+($u1['level']/200)*$p['U']))*(1+$p['M']/100); + //$r['max'] = (($p['B'][1]+$p['S']+$weapom_max)*$p['T']*(1+($u1['level']/200)*$p['U']))*(1+$p['M']/100); + if ($witmdata['tr_lvl'] < $level) { + /* + $minp = 3*($level-$witmdata['tr_lvl']); + $r['min'] -= ceil($r['min'] / 100 * $minp); + $r['max'] -= ceil($r['max'] / 100 * $minp); + */ + } + } + + //$r['minm'] = $r['min']*0.13; + //$r['maxm'] = $r['max']*0.13; + + /*if( $wp_type == 22 ) { + //Посохи + $r['min'] = $r['min']/2; + $r['max'] = $r['max']/2; + }*/ + + //Критический урон + //Новая + //$r['Kmin'] = $r['min']; + //$r['Kmax'] = $r['max']; + + /*$r['min'] += $weapom_min; + $r['max'] += $weapom_max; + $r['Kmin'] += $weapom_min*2; + $r['Kmax'] += $weapom_max*2;*/ + + //Минимальное значение урона + //$r['min_'] = floor($r['min']*0.13); + //$r['max_'] = floor($r['max']*0.13); + //$r['Kmin_'] = floor($r['Kmin']*0.13); + //$r['Kmax_'] = floor($r['Kmax']*0.13); + + //Особенности защиты + //$r['ozash_rnd'] = $r['oza'][$r['type']][1]; /*rand($r['oza'][$r['type']][0],$r['oza'][$r['type']][1]);*/ + + //if($r['ozash_rnd'] > 80) { $r['ozash_rnd'] = 80; } + //if($r['ozash_rnd'] < 0) { $r['ozash_rnd'] = 0; } + + + //$r['ozash_rnd'] = 100-$r['ozash_rnd']; + + //$p['iT'] + + /*$r['min'] = floor($r['min']*$p['iT'] + $weapom_min); + $r['max'] = floor($r['max']*$p['iT'] + $weapom_max); + $r['Kmin'] = floor($r['Kmin']*$p['iT'] + $weapom_min*2); + $r['Kmax'] = floor($r['Kmax']*$p['iT'] + $weapom_max*2); + $r['min_'] = floor($r['min_']*$p['iT'] + $weapom_min); + $r['max_'] = floor($r['max_']*$p['iT'] + $weapom_max); + $r['Kmin_'] = floor($r['Kmin_']*$p['iT'] + $weapom_min*2); + $r['Kmax_'] = floor($r['Kmax_']*$p['iT'] + $weapom_max*2); + */ + + //$r['min'] -= ($r['min']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); + //$r['max'] -= ($r['max']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); + + //$r['Kmin'] -= ($r['Kmin']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); + //$r['Kmax'] -= ($r['Kmax']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); + + $r['bRND'] = $p['B']['rnd']; + + //$r['min'] += $min_yron; + //$r['max'] += $max_yron; + + // + + /*if( $r['minm'] > $r['min'] ) { + $r['min'] = $r['minm']; + } + if( $r['maxm'] > $r['max'] ) { + $r['max'] = $r['maxm']; + }*/ + + $r['Kmin'] = ceil((2 + (0 + $p['K'] / 100)) * $r['min']); + $r['Kmax'] = ceil((2 + (0 + $p['K'] / 100)) * $r['max']); + + //$r['Kmin'] = ceil( ( 1 + ( 1 + $p['K']/100 ) ) * $r['min']); + //$r['Kmax'] = ceil( ( 1 + ( 1 + $p['K']/100 ) ) * $r['max']); + + //$r['Kmin'] = ceil( ( $r['min'] * 2 ) * ( 1 + $p['K']/100 )); + //$r['Kmax'] = ceil( ( $r['max'] * 2 ) * ( 1 + $p['K']/100 )); + + //$r['Kmin'] = ceil( ( $r['min'] ) * ( 2 + $p['K']/100 )); + //$r['Kmax'] = ceil( ( $r['max'] ) * ( 2 + $p['K']/100 )); + // + //$r['Kminm'] = $r['Kmin']*0.05; + //$r['Kmaxm'] = $r['Kmax']*0.05; + + //Расчет брони + //для обычного + if ($r['type'] < 5 || $r['type'] == 12) { + $r['min_abron'] = round($r['min'] * 0.05); + $r['max_abron'] = round($r['max'] * 0.05); + + /*if($proboi != 0) { + $r['bron']['rndold'] = $r['bron']['rnd']; + $r['yrnrz'] = $r['max']-$r['min']; + if( $r['yrnrz'] < 0 ) { + $r['yrnrz'] = -$r['yrnrz']; + } + }*/ + if ($proboi != 0) { + $r['bron']['rndold'] = $r['bron']['rnd']; + //$r['bron']['rnd'] = floor($r['bron']['rnd']/100*(100-$proboi)); + //if( $r['bron']['rnd'] < $r['bron'][0] ) { + $r['bron']['rnd'] = 0;//$r['bron'][0]; + //} + /*if( round($r['min']*0.45) < $r['bron']['rnd'] ) { + $r['bron']['rnd'] = round($r['min']*0.55); + } + // + $r['yrnrz'] = $r['max']-$r['min']; + if( $r['yrnrz'] < 0 ) { + $r['yrnrz'] = -$r['yrnrz']; + }*/ + } + + //Новые исправления в броне + if ($r['bron']['rnd'] > $r['min']) { + // $r['bron']['rnd'] = $r['min']; + } + // + + $r['Kmin'] -= $r['bron']['rnd'] * 2; //было умножить на 2 + $r['Kmax'] -= $r['bron']['rnd'] * 2; //было умножить на 2 + + $r['min'] -= $r['bron']['rnd']; //не было деления ни на чо. + $r['max'] -= $r['bron']['rnd']; //не было деления ни на чо. + + if ($proboi != 0) { + // $r['yrnrz'] + // $r['bron']['rndold'] + } + } + + //Расчет защиты (не более 80%) + if ($r['type'] < 5) { + $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); + $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); + } elseif ($r['type'] == 12) { + $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); + $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); + } else { + $r['min'] = round($r['min'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['max'] = round($r['max'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zmgo($st2['zm']))); + } + + /*if( $r['Kminm'] > $r['Kmin'] ) { + $r['Kmin'] = $r['Kminm']; + } + if( $r['Kmaxm'] > $r['Kmax'] ) { + $r['Kmax'] = $r['Kmaxm']; + } + + if( $r['minm'] > $r['min'] ) { + $r['min'] = $r['minm']; + } + if( $r['maxm'] > $r['max'] ) { + $r['max'] = $r['maxm']; + }*/ + + $r['min'] = round($r['min']); + $r['max'] = round($r['max']); + $r['Kmin'] = round($r['Kmin']); + $r['Kmax'] = round($r['Kmax']); + + $min_yrn = 0; //% + + //if( $wp_type == 18 ) { + //$min_yrn = 17; + //} + + //колющий + /*if($r['type'] == 1) { + $min_yrn += 50; + //рубящий + }elseif($r['type'] == 2) { + $min_yrn += 40; + //дробящий + }elseif($r['type'] == 3) { + $min_yrn += 35; + //режущий + }elseif($r['type'] == 4) { + $min_yrn += 60; + //Магиечески + }elseif($r['type'] >= 5){ + + }else { + + } + + // + if( $p['M'] > 0 ) { + //$min_yrn -= $p['M']/100*20; + } + // + if( $p['Mage'] == true && $r['type'] != 1 ) { + //$min_yrn += 30; + } + // + if( $r['type'] >= 5 ) { + $min_yrn += $zm_proc; + }else{ + $min_yrn += $za_proc; + } + if($r['type'] < 5){ + //$min_yrn += 50; + }*/ + + //$min_yrn = 33; + + if ($u1['clone'] > 0) { + $min_yrn = 75; + } + + $r['min'] -= floor($r['min'] / 100 * $min_yrn); + $r['max'] -= floor($r['max'] / 100 * $min_yrn); + $r['Kmin'] -= floor($r['Kmin'] / 100 * ($min_yrn)); + $r['Kmax'] -= floor($r['Kmax'] / 100 * ($min_yrn)); + $r['min_'] -= floor($r['min_'] / 100 * $min_yrn); + $r['max_'] -= floor($r['max_'] / 100 * $min_yrn); + $r['Kmin_'] -= floor($r['Kmin_'] / 100 * ($min_yrn)); + $r['Kmax_'] -= floor($r['Kmax_'] / 100 * ($min_yrn)); + + $defd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1')); + if ($defd[0] > 100) { + $defd[0] = 100; + } + $defd = 0 + $defd[0]; + $powd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1')); + if ($powd[0] > 100) { + $powd[0] = 100; + } + $powd = 0 + $powd[0]; + $defd = $defd - $powd; + + $r['min'] -= floor($defd); + $r['max'] -= floor($defd); + $r['Kmin'] -= floor($defd * 2); + $r['Kmax'] -= floor($defd * 2); + $r['min_'] -= floor($defd); + $r['max_'] -= floor($defd); + $r['Kmin_'] -= floor($defd * 2); + $r['Kmax_'] -= floor($defd * 2); + + /* + if($r['type'] == 4) { + $r['Kmin'] -= floor($r['Kmin']/100*10); + $r['Kmax'] -= floor($r['Kmax']/100*10); + $r['Kmin_'] -= floor($r['Kmin_']/100*10); + $r['Kmax_'] -= floor($r['Kmax_']/100*10); + } + */ + + $r['min'] += $st1['maxAtack']; + $r['max'] += $st1['maxAtack']; + $r['Kmin'] += $st1['maxAtack'] * 2; + $r['Kmin'] += $st1['maxAtack'] * 2; + + /*$r['min_'] += $st1['maxAtack']; + $r['max_'] += $st1['maxAtack']; + $r['Kmin_'] += $st1['maxAtack']*2; + $r['Kmin_'] += $st1['maxAtack']*2;*/ + + + /* + if($r['min'] < round($weapom_min/2)) { + $r['min'] = round($weapom_min/2); + } + if($r['max'] < round($weapom_max/2)) { + $r['max'] = round($weapom_max/2); + } + if($r['Kmin'] < round($weapom_min)) { + $r['Kmin'] = round($weapom_min); + } + if($r['Kmax'] < round($weapom_max)) { + $r['Kmax'] = round($weapom_max); + } + if($r['min_'] < round($weapom_min/2)) { + $r['min_'] = round($weapom_min/2); + } + if($r['max_'] < round($weapom_max/2)) { + $r['max_'] = round($weapom_max/2); + } + if($r['Kmin_'] < round($weapom_min)) { + $r['Kmin_'] = round($weapom_min); + } + if($r['Kmax_'] < round($weapom_max)) { + $r['Kmax_'] = round($weapom_max); + } + */ + if ($r['min'] < 1) { + $r['min'] = 1; + } + if ($r['max'] < 1) { + $r['max'] = 1; + } + if ($r['Kmin'] < 2) { + $r['Kmin'] = 2; + } + if ($r['Kmax'] < 2) { + $r['Kmax'] = 2; + } + if ($r['Kmin_'] < 2) { + $r['Kmin_'] = 2; + } + if ($r['Kmin_'] < 2) { + $r['Kmax_'] = 2; + } + + $r['m_k'] = $r['Kmax']; + + return $r; + } + + public $pr_not_use = [], $pr_reset = [], $pr_yrn = false, $prnt = []; + //Завершение действия приема + // pl прием + // u1 инфа юзера + // t1 тип снятия + // 99 = очищение кровью + // u2 + //$this->delPriem($pd[$k2][1][$k],${'p'.$k2},1,${'p'.$k2jn}); + public $del_val = [], $re_pd = []; + + public function delPriem( + $pl, + $u1, + $t = 1, + $u2 = false, + $rznm = 'Очиститься Кровью', + $k2nm = null, + $yrn = null, + $yrnt = null + ) { + global $u, $priem; + if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { + if ($pl['x'] > 1) { + $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; + } + if ($pl['timeUse'] == 77) { + //завершаем прием + mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; + if (isset($u2['id'])) { + $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; + } + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($t == 4) { + $mas1['id_hod']++; + $t = 2; + } + if ($t == 1) { + $mas1['id_hod']++; + if ($pl['priem']['file'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { + require('priems/' . $pl['priem']['file'] . '.php'); + } + } elseif ($pl['priem']['file3'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { + require('priems/' . $pl['priem']['file3'] . '.php'); + } + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; + $this->del_val['eff'][$pl['priem']['id']] = true; + } + } elseif ($t == 2) { + $mas1['text'] = '{tm1} У персонажа {u1} закончилось действие магии "' . $pl['name'] . '".'; + } elseif ($t == 99) { + $mas1['text'] = '{u1} Снял эфект "' . $pl['name'] . '" с помощью ' . $rznm . ' .'; + } else { + if ($t == 100) { + $mas1['id_hod']++; + } + $mas1['text'] = '{tm1} Закончилось действие эффекта "' . $pl['name'] . '" для {u1}.'; + } + if ($pl['priem']['id'] != 24) { + $this->add_log($mas1); + } + $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); + } else { + //не удалось удалить прием или эффект + } + } + + public function hodUserPriem($pl, $u1, $t = 1, $u2 = false, $rznm = 'Очиститься Кровью', $k2nm, $yrn, $yrnt) + { + global $u, $priem; + if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { + if ($yrnt == 1) { + //обычный удар + $yrn = round($yrn); + } elseif ($yrnt == 6) { + //противник увернулся от удара + $yrn = 0; + } elseif ($yrnt == 9) { + //противник парировал удар + $yrn = 0; + } elseif ($yrnt == 3) { + //вы нанесли крит-удар + $yrn = round($yrn * 1.95) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); + } elseif ($yrnt == 4) { + //вы нанесли крит-удар через блок + $yrn = round($yrn * 0.45) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); + } else { + //неизвестный удар + $yrn = 0; + } + + if ($pl['x'] > 1) { + $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; + } + $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; + if (isset($u2['id'])) { + $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; + } + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($t == 4) { + $mas1['id_hod']++; + $t = 2; + } + if ($t == 1) { + $mas1['id_hod']++; + if ($pl['priem']['file'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { + require('priems/' . $pl['priem']['file'] . '.php'); + } + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; + $this->del_val['eff'][$pl['priem']['id']] = true; + } + } + $this->add_log($mas1); + $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); + } else { + //не удалось удалить прием или эффект + } + } + + //расчет защиты + public function aPower($za, $za1, $yrn) + { + $z = 0; + /*$z = ($za+$za1)*0.35; + $z = round($yrn/$z*100);*/ + + $z = (1 - (pow(0.5, (($za + $za1) / 250)))) * 100; + return $z; + } + + //расчет брони + public function bronGo($min, $max) + { + $v = 0; + //$v = ceil(($min+$max)/2,$max); + $v = ceil($min, $max); + return $v; + } + + //расчет брони (test) + public function bronGoTest($min, $max) + { + $v = 0; + //$v = ceil(($min+$max)/2,$max); + $v = ceil(round($min, $max)); + return $v; + } + + //Разбираем массив со статами + public function lookStats($m) + { + $ist = []; + $di = explode('|', $m); + $i = 0; + $de = false; + while ($i < count($di)) { + $de = explode('=', $di[$i]); + $ist[$de[0]] = $de[1]; + $i++; + } + return $ist; + } + + //Расчет зависимости уворота + public function mfsgo1($a, $b) + { + $r = $this->form_mf($a, $b); + return $r; + } + + //Расчет зависимости крита + public function mfsgo2($a, $b) + { + $r = $this->form_mf($a, $b); + return $r; + } + + //Расчет мф. (новая) + public function form_mf($u, $au) + { + $v = $u * 5.1 - $au * 5.1; + if ($v < 0) { + $v = 0; + } + $r = (1 - (pow(99 / 100, (($v) / 100)))) * 100; + $r = round($r); + return $r; + } + + //Ступеньчатая формула (общая) для 5ых уровней. + public function msf_st2($mf, $lvl1, $lvl2) + { + $r = 0; + + if ($lvl1 > $lvl2) { + $lvl = $lvl1; + } else { + $lvl = $lvl2; + } + + /* + 1-ый: от 0 до 50 - линейное изменение шанса от 0 до 25% + 2-ой: от 51 до 151 - линейное изменение шанса от 25% до 50% + 3-ий: от 151 до 400 - линейное изменение шанса от 50% до 75% + 4-ый: свыше 400 - 75% + 0,01 * (разница К и АК - 1000) + Крит АК Разница процент + 350 50 300 85 + 350 100 250 + 350 150 200 85 + 350 175 175 + 350 200 150 + 350 225 125 + 350 250 100 65 + 50 35 + + + + */ + //турнир + if ($mf < 0) { + $mf = 0; + } + if ($lvl <= 7) { + //Баланс 0-7 уровня + if ($mf <= 100) { //0-35 + $prc = $mf; + $r = 35 / 50 * $prc; + } elseif ($mf <= 200) { //35-65 + $prc = $mf - 101; + $r = $prc / 99 * 30; + $r += 35; + } elseif ($mf <= 400) { //65-85 + $prc = $mf - 201; + $r = $prc / 199 * 20; + $r += 65; + } else { //> 75 + $r = 85 + 0.01 * abs(($mf - 1000)); + } + } else { + //Баланс остальных уровней + if ($mf <= 100) { //0-45 + $prc = $mf; + $r = 45 / 100 * $prc; + } elseif ($mf <= 300) { //45-65 + $prc = $mf - 101; + $r = $prc / 199 * 20; + $r += 45; + } elseif ($mf <= 450) { //65-75 + $prc = $mf - 301; + $r = $prc / 149 * 10; + $r += 65; + } else { //> 75 + $r = 85; + //$r = 75 + 0.01 * abs(($mf-1000)); + } + } + + if ($r < 0) { + $r = 0; + } + + return $r; + } + + //Ступеньчатая формула (уворот) + public function msf_st($mf, $lvl1, $lvl2) + { + $r = 0; + + if ($lvl1 > $lvl2) { + $lvl = $lvl1; + } else { + $lvl = $lvl2; + } + + /* + 1-ый: от 0 до 100 - линейное изменение шанса от 0 до 25% + 2-ой: от 101 до 400 - линейное изменение шанса от 35% до 70% + 3-ий: от 401 до 1000 - линейное изменение шанса от 70% до 85% + 4-ый: свыше 1000 - 85% + 0,01 * (разница У и АУ - 1000) + */ + /* Шпаргалочка для улучшения баланса. 150 АУ у слабых критов, 350 у топовых. + + АУ У Разница Процент + 75 750 675 85 + 100 750 650 70 + 150 750 600 + 200 750 550 55 + + 300 750 450 50 + 350 750 400 50 + + Было 700 у, поправил 750 и соотвественно разницу. Посмотрим как будут убивать У. + */ + + if ($mf < 0) { + $mf = 0; + } + //турнир + if ($lvl <= 7) { + //Баланс 0-7 уровня + if ($mf <= 200) { //0-60 + $prc = $mf; + $r = 60 / 200 * $prc; + } elseif ($mf <= 550) { //60-70 + $prc = $mf - 201; + $r = $prc / 349 * 10; + $r += 60; + } elseif ($mf <= 675) { //70-75 + $prc = $mf - 551; + $r = $prc / 124 * 5; + $r += 70; + } else { //> 85 + $r = 76; + //$r = 85 + 0.01 * abs(($mf-1000)); + } + } else { + //Баланс всех остальных уровней + /* Шпаргалочка для улучшения баланса. 150 АУ у слабых критов, 350 у топовых. + + АУ У Разница Процент + 50 950 1000 85 + 100 950 850 + 150 950 800 + 250 950 700 80 + + 300 950 650 75 + 400 950 550 70 + + + Пробуем разница 100 между У и АУ - шанс 50, остальное попасть нереально. Позже искусственно завышаем АУ танку при размене. + */ + if ($mf <= 250) { //0-35 + $prc = $mf; + $r = 35 / 250 * $prc; + } elseif ($mf <= 600) { //35-50 + $prc = $mf - 251; + $r = $prc / 349 * 15; + $r += 35; + } elseif ($mf <= 800) { //50-70 + $prc = $mf - 601; + $r = $prc / 199 * 20; + $r += 50; + } else { //> 85 + $r = 75; + //$r = 75 + 0.01 * abs(($mf-1000)); + } + } + + if ($r < 0) { + $r = 0; + } + + + return floor($r * 1.25); + } + + //Расчет МФ + public function mfs($type, $mf, $lvl1, $lvl2) + { + $rval = 0; + switch ($type) { + case 1: + + //Крит + + if ($mf['amf'] < 0) { + $mf['amf'] = 0; + } + if ($mf['mf'] < 0) { + $mf['mf'] = 0; + } + if ($mf['mf'] > $mf['smf']) { + $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); + } else { + $rval = 0; + } + + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + if ($mf['amf'] >= 1) { + if ($mf['amf'] > 100) { + $mf['amf'] = 100; + } + if (($mf['amf'] * 100) >= mt_rand(1, 10000)) { + $rval = 100; + } + } + + + break; + case 2: + + if ($mf['mf'] < 0) { + $mf['mf'] = 0; + } + if ($mf['amf'] < 0) { + $mf['amf'] = 0; + } + if ($mf['smf'] < 0) { + $mf['smf'] = 0; + } + if ($mf['asmf'] < 0) { + $mf['asmf'] = 0; + } + + if ($mf['mf'] > $mf['smf']) { + $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5 + } else { + $rval = 0; + } + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + if ($mf['asmf'] >= 0) // + { + if ($mf['asmf'] > 100) { + $mf['asmf'] = 100; + } + if ($mf['asmf'] >= rand(1, 100)) { + $rval = 0; + } + } + if ($mf['amf'] >= 0) { + if ($mf['amf'] > 100) { + $mf['amf'] = 100; + } + if ($mf['amf'] >= rand(1, 100)) { + $rval = 100; + } + } + + + break; + case 3: + //$mf[1] -= 4; + //$mf[2] -= 4; + if ($mf[1] < 1) { + $mf[1] = 1; + } + if ($mf[2] < 1) { + $mf[2] = 1; + } + + //$rval = $mf[1] - $mf[2]; //Парирование + $rval = $mf[1] - $mf[2] / 2; + if ($rval > 75) { + $rval = 75; + } + //$rval = round($rval/3); + if ($rval < 1) { + $rval = 1; + } + + //$rval = (1-( pow(0.75, ($rval/125) ) ))*100; + + //if( $rval > 60 ) { + // $rval = 60; + //} + + break; + case 4: + $mf = round($mf * 0.6); + if ($mf < 1) { + $mf = 0; + } + if ($mf > 100) { + $mf = 100; + } + //$mf = (1-( pow(0.5, ($mf/200) ) ))*100; + $rval = min($mf, 100); //пробой брони + break; + case 5: + if ($mf < 1) { + $mf = 0; + } + $rval = min($mf, 85); //блок щитом + break; + case 6: + //Контрудар + //$mf['a'] защита + //$mf['b'] атака + if ($mf['a'] > 0) { + if ($mf['b'] > 0) { + $rval = round($mf['a'] - ($mf['b'] / 2)); + } else { + $rval = $mf['a']; + } + } else { + $rval = 0; + } + + + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + + + break; + } + if ($this->get_chanse($rval) == true) { + $rval = 1; + } else { + $rval = 0; + } + return $rval; + } + + public function dodge($a, $b) + { + $i = 0; + $arr = []; //массив для записи уникальных случайных чисел + while ($i < ($b - $a)) { + while (in_array($rand, $arr)) { + $rand = mt_rand(1, 100); + } + $arr[] = $rand; + $i++; + } + + $n = mt_rand(1, 100); + return (!!array_search($n, $arr)); + } + + public function get_chanse($percent) + { + /*$a = 101+$percent; + $b = 100-$percent; + $i = 1; + if(($a-$b)>0){ + while($i<=$a-$b){ + $conp[] = rand(1,100); + //$conp[] = mt_rand(1,100); + if( $i > 100 ) { + $i = ($a-$b+1); + } + $i++; + } + } + $t = count($conp); + $prob = round($percent); + if(@array_search($prob,$conp)!=false){ + $critical = true; + }else{ + $critical = false; + }*/ + /*if( rand(0,100) <= $percent ) { + $critical = true; + }else{ + $critical = false; + }*/ + if ($percent >= 100) { + $percent = 100; + } elseif ($percent == 0) { + $percent = 0; + } + $critical = $this->dodge(1, $percent); + return $critical; + } + + //Расчет шанса + public function get_chanse_new($persent) + { + $mm = 1; + if (mt_rand($mm, 100 * $mm) <= $persent * $mm) { + return true; + } else { + return false; + } + } + + //Смена противника + public function smena($uid, $auto = false, $lastdie = false) + { + global $u; + if (($auto == false && $u->info['smena'] > 0) || $auto == true) { + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1) { + if (isset($this->uids[$uid]) && $uid != $u->info['id'] && $this->users[$this->uids[$uid]]['team'] != $this->users[$this->uids[$u->info['id']]]['team']) { + if (!isset($this->ga[$u->info['id']][$uid]) || $lastdie == true) { + if (ceil($this->stats[$this->uids[$uid]]['hpNow']) >= 1) { + //меняем противника + if ($auto == false) { + $u->info['smena']--; + } + $upd = mysql_query('UPDATE `stats` SET `enemy` = "' . $uid . '",`smena` = "' . $u->info['smena'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['enemy'] = $uid; + $this->users[$this->uids[$uid]]['smena'] = $u->info['smena']; + $this->users[$this->uids[$u->info['id']]]['enemy'] = $uid; + return 1; + } else { + return 'Нельзя сменить, противник уже мертв'; + } + } else { + return 'Нельзя сменить на выбранную цель!'; + } + } else { + return 'Нельзя сменить на выбранную цель []'; + } + } else { + return 'Для вас поединок закончен, ожидайте пока завершат другие...'; + } + } else { + return 'У вас закончились смены противника'; + } + } + + //авто-смена противника //ТУТ баг выбора + public function autoSmena() + { + global $u; + $ms = []; + $ms_all = []; + $ms_ansf = []; + $i = 0; + $j = 0; + $z = 0; + while ($i < count($this->users)) { + if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] > 0 && -($u->info['enemy']) != $this->users[$i]['id']) { + if (!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) { + $ms[$j] = $this->users[$i]['id']; + $j++; + } + if (!isset($this->uids[(-($u->info['enemy']))])) { + $ms_all[] = $this->users[$i]['id']; + } + if (isset($this->ga[$this->users[$i]['id']][$u->info['id']])) { + $ms_ansf[$z] = $this->users[$i]['id']; + $z++; + } + } + $i++; + } + $msh = []; + if ($j == 0 && $z == 0) { + $enemydie = 0; + + if (isset($this->stats[$this->uids[$u->info['enemy']]])) { + $u->info['enemy'] = 0; + $enemydie = 1; + } + + if ((!isset($this->uids[(-($u->info['enemy']))]) || $this->stats[$this->uids[(-($u->info['enemy']))]]['hpNow'] < 1) && ($u->info['enemy'] < 0 || $enemydie == 1)) { + $i = 0; + $j = 0; + while ($i < count($this->users)) { + if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] >= 1 && -($u->info['enemy']) != $this->users[$i]['id']) { + $ms[$j] = $this->users[$i]['id']; + $msh[$ms[$j]] = true; + $j++; + } + $i++; + } + } + } + + $ms = $ms[rand(0, $j - 1)]; + $ms_ansf = $ms_ansf[rand(0, $z - 1)]; + if ($z > 0) { + $this->smena($ms_ansf, true); + } elseif ($j > 0) { + if (isset($msh[$ms])) { + $this->smena($ms, true, true); + } else { + $this->smena($ms, true); + } + } else { + if ($u->info['enemy'] < 0) { + $smnr5 = $this->smena(-($u->info['enemy']), true); + /*if( $smnr5 != 1 ) { + if( !isset($this->uids[(-($u->info['enemy']))]) ) { + $u->info['enemy'] = $ms_all[rand(0,(count($ms_all)-1))]; + mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + } + }*/ + unset($smnr5); + } + } + } + + //авто-смена противника new + /*public function autoSmena() + { + global $u; + $ms = array(); + $ms_all = array(); + $i = 0; $j = 0; + while($iusers)) + { + if(isset($this->users[$i]) && $this->users[$i]['id']!=$u->info['id'] && $this->users[$i]['team']!=$u->info['team'] && $this->stats[$i]['hpNow']>=1 && -($u->info['enemy']) != $this->users[$i]['id']) + { + if(!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) + { + $ms[$j] = $this->users[$i]['id']; + $j++; + } + if( !isset($this->uids[(-($u->info['enemy']))]) ) { + $ms_all[] = $this->users[$i]['id']; + } + } + $i++; + } + + $ms = $ms[rand(0,$j-1)]; + if($j>0) + { + $this->smena($ms,true); + }else{ + if( $u->info['enemy'] < 0 ) { + $smnr5 = $this->smena(-($u->info['enemy']),true); + if( $smnr5 != 1 ) { + //$u->info['enemy'] = -($u->info['enemy']); + //mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + if( !isset($this->uids[(-($u->info['enemy']))]) ) { + $u->info['enemy'] = $ms_all[rand(0,(count($ms_all)-1))]; + mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + } + //echo 'Fatal error: '.$smnr5.' #'.$j.''; + } + unset($smnr5); + //mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + } + } + }*/ + + //Действия бота (атака) + public function botAtack($uid, $pl, $tp) + { + /*if (isset($uid['id'])) {$uidt=$uid['id'];} else {$uidt=$uid;} + if (isset($pl['id'])) {$plt=$pl['id'];} else {$plt=$pl;} + $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$uidt.'" AND `hpNow` >= 1 LIMIT 1')); + $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$plt.'" AND `hpNow` >= 1 LIMIT 1')); + if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id']!=$test_pl['id']) + { + }*/ + $test_atack = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND (( + `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '" + ) OR ( + `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '" + )) LIMIT 1')); + + if ($tp == 1 && !isset($test_atack['id'])) { + $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); + $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { + $a = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); + $b = rand(1, 5); + $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")'); + } + } elseif ($tp == 2) { + //бот отвечает на удар + $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); + $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl['uid2'] . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { + $bot = $this->users[$this->uids[$pl['uid2']]]; + $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; + $a222 = rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5); + $a = explode('_', $a222); + $i = 1; + $na['id'] = time(); + while ($i <= 5) { + if (isset($a[$i - 1])) { + $a[$i - 1] = intval(round($a[$i - 1])); + if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { + $na['a'][$i] = $a[$i - 1]; + } else { + $na['a'][$i] = 0; + } + } + $i++; + } + $na['b'] = rand(1, 5); + //Проводим удар + + $this->atacks[$pl['id']]['a2'] = $a222; + $this->atacks[$pl['id']]['b2'] = $na['b']; + $this->startAtack($pl['id']); + } + } + //unset($test_uid,$test_pl,$test_atack); + } + + //Проверяем удары, приемы, свитки, зверей + public function testActions() + { + //проверяем удары + $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id` ASC'); + $i = 0; + $botA = []; + $botR = []; + while ($pl = mysql_fetch_array($m)) { + //mysql_query('DELETE FROM `battle_act` WHERE `battle` = "'.$this->info['id'].'" AND `uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'"'); + $pluids = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl['uid1'] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl['uid2'] . '" AND `hpNow` <= 0) LIMIT 1')); + + $pltest = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1')); + if (isset($pltest['id'])) { + if (isset($pluids['hpNow'])) { + mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['time'] + $this->info['timeout'] > time()) { + //удар не пропущен по тайму, просто заносим данные + $this->atacks[$pl['id']] = $pl; + $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id']; + $this->ag[$pl['uid2']][$pl['uid1']] = $pl['id']; + if (isset($this->iBots[$pl['uid1']])) { + //ударил бот и нет ответа + $botA[$pl['uid1']] = $pl['id']; + } elseif (isset($this->iBots[$pl['uid2']])) { + //ударили бота и он не ответил + $botR[$pl['uid2']] = $pl['id']; + if ($this->users[$this->uids[$pl['uid2']]]['timeGo'] < time()) { + $this->botAtack($pl['uid1'], $pl, 2); + } + } + } else { + //пропуск по тайму + //mysql_query('UPDATE `battle_act` SET `time`="'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); + $pl['time'] = time(); + if ($pl['a1'] == 0 && $pl['a2'] == 0) { + //игрок 1 пропустил по тайму + $pl['out1'] = time(); + $pl['tout1'] = 1; + //игрок 2 пропустил по тайму + $pl['out2'] = time(); + $pl['tout2'] = 1; + } elseif ($pl['a1'] == 0) { + //игрок 1 пропустил по тайму + $pl['out1'] = time(); + $pl['tout1'] = 1; + } elseif ($pl['a2'] == 0) { + //игрок 2 пропустил по тайму + $pl['out2'] = time(); + $pl['tout2'] = 1; + } + //наносим удар по пропуску + if (!isset($pluids['hpNow'])) { + $this->atacks[$pl['id']] = $pl; + $this->startAtack($pl['id']); + mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '"'); + //mysql_query('DELETE FROM `battle_act` WHERE (`uid1` = "'.$pl['uid1'].'" AND `uid2` = "'.$pl['uid2'].'") OR (`uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'")'); + } + } + } + } + //тест удара + if ($this->uAtc['id'] > 0) { + if ($this->na == 1) { + if ($pl['out1'] == 0 && $pl['out2'] == 0) { + //Может разменяться только тот кто бил + if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) { + $this->addNewAtack(); + } + } else { + $this->addNewAtack(); + } + } + } + //тест использования заклятий + + //тест использования приемов + + //тест, бот делает удары + $i = 0; + while ($i < count($this->bots)) { + $bot = $this->bots[$i]; + if (isset($bot) && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['pass'] != 'saintlucia') //Тут проверка на бота saintlucia + { + //mysql_query('UPDATE `stats` SET `timeGo` = "'.$tnbot.'" WHERE `id` = "'.$this->users[$this->uids[$bot]]['id'].'" LIMIT 1'); + $j = 0; + while ($j < count($this->users)) { + if ($this->info['razdel'] == 0) { + $tnbot = time() + rand(1, 1); + } else { + $tnbot = time() + rand(1, 2); + } + if ($this->users[$j]['timeGo'] >= time() || $this->users[$this->uids[$bot]]['timeGo'] >= time()) { + } elseif ($this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']) { + if (isset($this->users[$j]) && $this->stats[$j]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && !isset($this->ga[$bot][$this->users[$j]['id']]) && !isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['id'] != $bot && $this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $this->botAtack($this->users[$j]['id'], $bot, 1); + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } + } elseif (isset($this->users[$i]) && $this->users[$i]['bot'] > 0 && $this->stats[$i]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$i]['id'] != $bot && $this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + if ($this->botAct($bot) == true) { + if (!isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time() && !isset($this->ag[$bot][$this->users[$i]['id']])) { + $this->botAtack($this->users[$i]['id'], $bot, 1); + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } elseif (isset($this->ag[$bot][$this->users[$i]['id']])) { + } elseif (isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $this->botAtack($bot, $this->users[$i]['id'], 1); + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } + } + } + } else { + //Удары между ботами + // + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1) { + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, + 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, + 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, + 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, + 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); + if (isset($this->ga[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $tnbot = time() + rand(3, 7); + if ($this->info['type'] == 329) { // тестовый бой + $tnbot = time() - 1; + } + $this->startAtack($this->ga[$bot][$this->users[$j]['id']]); + $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } + } elseif (isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { + if ($this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['timeGo'] < time()) { + $this->startAtack($this->ag[$bot][$this->users[$j]['id']]); + $tnbot = time() + rand(3, 7); + if ($this->info['type'] == 329) { // тестовый бой + $tnbot = time() - 1; + } + $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } + } + } + // + } + } + $j++; + } + } + $i++; + } + } + + //Действия бота + public function botAct($uid) + { + $r = false; + if ($this->users[$this->uids[$uid]]['bot'] > 0) { + if ($this->users[$this->uids[$uid]]['online'] < time() - 3) { + $r = true; + $this->users[$this->uids[$uid]]['online'] = time(); + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . ((int)$uid) . '" LIMIT 1'); + } else { + if (rand(0, 2) == 1) { + $r = true; + } + } + } + return $r; + } + + //получаем данные о поединке + public function battleInfo($id) + { + $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); + if (isset($b['id'])) { + $this->hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $b['id'] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($this->hodID['id_hod'])) { + $this->hodID = $this->hodID['id_hod']; + } else { + $this->hodID = 0; + } + /*if( $this->hodID > $b['hod'] ) { + $b['hod'] = $this->hodID; + mysql_query('UPDATE `battle` SET `hod` = "'.$this->hodID.'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); + }*/ + return $b; + } else { + return false; + } + } + + //наносим удар противнику + public function addAtack() + { + global $js; + if (isset($_POST['atack'], $_POST['block'])) { + $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; + $a = explode('_', $_POST['atack']); + $i = 1; + $na['id'] = time(); + while ($i <= 5) { + if (isset($a[$i - 1])) { + $a[$i - 1] = intval(round($a[$i - 1])); + if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { + $na['a'][$i] = $a[$i - 1]; + } else { + $na['a'][$i] = 0; + } + } + $i++; + } + + $na['b'] = intval(round($_POST['block'])); + if ($na['b'] < 1 || $na['b'] > 5) { + $na['b'] = 0; + } + + $this->uAtc = $na; + $js .= 'testClearZone();'; + } else { + $this->e = 'Выберите зоны удара и блока'; + } + } + + //выделяем пользователей + public function teamsTake() + { + global $u; + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + $nxtlg = []; + $t = mysql_query('SELECT `u`.`room`,`u`.`no_ip`,`u`.`twink`,`u`.`stopexp`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + $i = 0; + $bi = 0; + $up = ''; + if ($this->info['start2'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start2` = "0" LIMIT 1')); + if (isset($tststrt['id'])) { + $upd = mysql_query('UPDATE `battle` SET `start2` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } else { + $this->info['start2'] = time(); + } + } + while ($pl = mysql_fetch_array($t)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$i] = $pl; + $this->uids[$pl['id']] = $i; + + if ($this->info['start2'] == 0) { + mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + $this->users[$i]['notrhod'] = -1; + } + + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$i] = $u->getStats($pl, 0, 0, false, $this->cached, true); + //Заносим старт + if ($this->info['start2'] == 0) { + if (!isset($ts[$this->users[$i]['team']])) { + $tsi++; + $ts[$this->users[$i]['team']] = $tsi; + } + + if ($this->users[$i]['level'] <= 7) { + $this->users[$i]['tactic7'] = floor(10 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] == 8) { + $this->users[$i]['tactic7'] = floor(20 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] == 9) { + $this->users[$i]['tactic7'] = floor(30 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] >= 10) { + $this->users[$i]['tactic7'] = floor((40 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } + + if ($this->stats[$i]['s7'] > 49) { + mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 101 AND `delete` = 0'); + mysql_query(" + INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + ( 22, '" . $this->stats[$i]['id'] . "', 'Спасение', 'add_spasenie=1', 101, 77, 0, '" . $this->stats[$i]['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); + "); + } + + + #Вот здесь добавляло лишнего духа) Ost. Costa + #$this->users[$i]['tactic7'] += $this->stats[$i]['s7']; + ##### + // Бафф Зверя animal_bonus + if ($this->users[$i]['animal'] > 0) { + $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); + if (isset($a['id'])) { + if ($a['eda'] >= 1) { + $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); + $anl = $anl['bonus']; + + $tpa = [ + 1 => 'cat', + 2 => 'owl', + 3 => 'wisp', + 4 => 'demon', + 5 => 'dog', + 6 => 'pig', + 7 => 'dragon', + ]; + $tpa2 = [ + 1 => 'Кота', + 2 => 'Совы', + 3 => 'Светляка', + 4 => 'Чертяки', + 5 => 'Пса', + 6 => 'Свина', + 7 => 'Дракона', + ]; + $tpa3 = [ + 1 => 'Кошачья Ловкость', + 2 => 'Интуиция Совы', + 3 => 'Сила Стихий', + 4 => 'Демоническая Сила', + 5 => 'Друг', + 6 => 'Полная Броня', + 7 => 'Инферно', + ]; + + mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 100 AND `delete` = 0'); + + mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $this->users[$i]['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $this->users[$i]['id'] . '")'); + + //добавление духа от дракона + if ($a['type'] == 7) { + if ($a['level'] == 10) { + $this->users[$i]['tactic7'] = floor((50 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($a['level'] == 11) { + $this->users[$i]['tactic7'] = floor((65 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($a['level'] == 12) { + $this->users[$i]['tactic7'] = floor((90 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } + } + // + $anl = $u->lookStats($anl); + + $vLog = 'time1=' . time() . '||s1=' . $this->users[$i]['sex'] . '||t1=' . $this->users[$i]['team'] . '||login1=' . $this->users[$i]['login'] . ''; + $vLog .= '||s2=1||t2=' . $this->users[$i]['team'] . '||login2=' . $a['name'] . ' (Зверь ' . $this->users[$i]['login'] . ')'; + + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => 1, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + + $ba = ''; + $i6 = 0; + while ($i6 < count($u->items['add'])) { + if (isset($anl['add_' . $u->items['add'][$i6]])) { + if ($anl['add_' . $u->items['add'][$i6]] > 0) { + if ($u->items['add'][$i6] == 'mib1') { + $ba .= 'Броня головы: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib2') { + $ba .= 'Броня корпуса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib3') { + $ba .= 'Броня пояса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib4') { + $ba .= 'Броня ног: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mab1' || $u->items['add'][$i6] == 'mab2' || $u->items['add'][$i6] == 'mab3' || $u->items['add'][$i6] == 'mab4') { + } else { + $ba .= $u->is[$u->items['add'][$i6]] . ': +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } + } + } + $i6++; + } + $ba = trim($ba, ', '); + if ($ba == '') { + $ba = 'Эффект отсутсвует'; + } + + $mas1['text'] = '{tm1} {u2} очнулся от медитации, и призвал заклятье "' . $tpa3[$a['type']] . ' [' . $a['level'] . ']" на {u1}. (' . $ba . ')'; + $nxtlg[count($nxtlg)] = $mas1; + mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "' . $a['id'] . '" LIMIT 1'); + //$this->add_log($mas1); + $this->get_comment(); + } else { + //$u->send('',$this->users[$i]['room'],$this->users[$i]['city'],'',$this->users[$i]['login'],''.$a['name'].' нуждается в еде...',time(),6,0,0,0,1); + } + } + } + + mysql_query('UPDATE `stats` SET `last_hp` = "0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7` = "' . ($this->users[$i]['tactic7']) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + $rs[$this->users[$i]['team']] .= $u->microLogin($this->users[$i], 2) . ', '; + } + $up .= '`uid` = "' . $pl['id'] . '" OR'; + //battle-user (статистика, начальная) + $mybu = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . mysql_real_escape_string($pl['id']) . '" LIMIT 1')); + if (!isset($mybu['id'])) { + //Пустое значение статистики для данного персонажа за текущий бой + $this->addstatuser($pl['id']); + } + $i++; + } + + /* + if($i == 0) { + $t = mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "'.$this->info['id'].'" AND `st`.`hpNow` > 0'); + $i = 0; $bi = 0; $up = ''; + while($pl = mysql_fetch_array($t)) + { + //записываем данные + if($pl['login2']=='') + { + $pl['login2'] = $pl['login']; + } + $this->users[$i] = $pl; + $this->uids[$pl['id']] = $i; + if($pl['bot']>0) + { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$i] = $u->getStats($pl,0); + //Заносим старт + if($this->info['start1']==0) + { + if(!isset($ts[$this->users[$i]['team']])) + { + $tsi++; + $ts[$this->users[$i]['team']] = $tsi; + } + + if($this->users[$i]['level']<=7) + { + $this->users[$i]['tactic7'] = floor(10/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); + }elseif($this->users[$i]['level']==8) + { + $this->users[$i]['tactic7'] = floor(20/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); + }elseif($this->users[$i]['level']==9) + { + $this->users[$i]['tactic7'] = floor(30/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); + }elseif($this->users[$i]['level']>=10) + { + $this->users[$i]['tactic7'] = floor(40/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); + } + + $this->users[$i]['tactic7'] += $this->stats[$i]['s7']; + + mysql_query('UPDATE `stats` SET `tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7`="0",`tactic7` = "'.($this->users[$i]['tactic7']).'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + + $rs[$tsi] .= $u->microLogin($this->users[$i],2).', '; + } + $up .= '`uid` = "'.$pl['id'].'" OR'; + $i++; + } + } + */ + + $up = rtrim($up, ' OR'); + //mysql_query('UPDATE `eff_users` SET `timeAce` = "0" WHERE ('.$up.') AND `delete` = "0"'); + //echo '


'; + + //Заносим в лог начало поединка + + if ($this->info['start1'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start1` = "0" LIMIT 1')); + if (isset($tststrt['id'])) { + $upd = mysql_query('UPDATE `battle` SET `start1` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + if ($upd) { + $i = 0; + $r = ''; + while ($i <= $tsi) { + if (isset($rs[$i]) && $rs[$i] != '') { + $r .= rtrim($rs[$i], ', ') . ' и '; + } + $i++; + } + $r = rtrim($r, ' и '); + $r = str_replace('"', '\\\\\"', $r); + $this->hodID++; + $vLog = 'time1=' . time() . '||'; + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $r = 'Часы показывали ' . date('d.m.Y H:i', + $this->info['time_start']) . ', когда ' . $r . ' бросили вызов друг другу.'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $r . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + if (!$ins) { + //echo $r; + } + $this->info['start1'] = time(); + } + } + + // + + if (count($nxtlg) > 0) { + $i = 0; + while ($i < count($nxtlg)) { + $this->add_log($nxtlg[$i]); + $i++; + } + } + // + } + } + } + + //Возращаем зоны блока по умолчанию + public function restZonb($uid1, $uid2) + { + if ($this->stnZbVs[$uid1] > 0) { + $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid1]; + } + if ($this->stnZbVs[$uid2] > 0) { + $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid2]; + } + } + + //проверка блока (Визуальная) + public function testZonbVis() + { + global $u; + if ($this->stnZbVs == 0) { + $zb = $this->stats[$this->uids[$u->info['id']]]['zonb']; + $this->stnZbVs = $zb; + } else { + $zb = $this->stnZb; + } + $eu = $this->users[$this->uids[$u->info['id']]]['enemy']; + if ($zb > 3) { + $zb = 3; + } + if ($eu != '' && $eu != 0) { + if ($this->stats[$this->uids[$eu]]['weapon1'] == 1 || $this->stats[$this->uids[$eu]]['weapon2'] == 1) { + if ($this->stats[$this->uids[$u->info['id']]]['weapon1'] != 1 && $this->stats[$this->uids[$u->info['id']]]['weapon2'] != 1) { + $zb -= 1; + } + } + } + if ($zb < 1) { + $zb = 1; + } + return $zb; + } + + //проверка блока + public function testZonb($uid, $uid2) + { + global $u; + $zba = [1 => 0, 2 => 0]; + + $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; + $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; + + if ($this->stnZb[$uid] == 0) { + $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; + $this->stnZb[$uid] = $zba[1]; + } else { + $zba[1] = $this->stnZb[$uid]; + } + + if ($this->stnZb[$uid2] == 0) { + $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; + $this->stnZb[$uid] = $zba[2]; + } else { + $zba[2] = $this->stnZb[$uid2]; + } + + if ($zba[1] > 3) { + $zba[1] = 3; + } + if ($zba[2] > 3) { + $zba[2] = 3; + } + + //Блоки игрока 1 + if ($this->stats[$this->uids[$uid2]]['weapon1'] == 1 || $this->stats[$this->uids[$uid2]]['weapon2'] == 1) { + if ($this->stats[$this->uids[$uid]]['weapon1'] != 1 && $this->stats[$this->uids[$uid]]['weapon2'] != 1) { + $zba[1] -= 1; + } + } + + //Блоки игрока 2 + if ($this->stats[$this->uids[$uid]]['weapon1'] == 1 || $this->stats[$this->uids[$uid]]['weapon2'] == 1) { + if ($this->stats[$this->uids[$uid2]]['weapon1'] != 1 && $this->stats[$this->uids[$uid2]]['weapon2'] != 1) { + $zba[2] -= 1; + } + } + + if ($zba[1] < 1) { + $zba[1] = 1; + } + if ($zba[2] < 1) { + $zba[2] = 1; + } + + $this->stats[$this->uids[$uid]]['zonb'] = $zba[1]; + $this->stats[$this->uids[$uid2]]['zonb'] = $zba[2]; + if ($this->stats[$this->uids[$uid]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid]]['zonb'] < $this->stats[$this->uids[$uid]]['min_zonb']) { + $this->stats[$this->uids[$uid]]['zonb'] = $this->stats[$this->uids[$uid]]['min_zonb']; + } + if ($this->stats[$this->uids[$uid2]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid2]]['zonb'] < $this->stats[$this->uids[$uid2]]['min_zonb']) { + $this->stats[$this->uids[$uid2]]['zonb'] = $this->stats[$this->uids[$uid2]]['min_zonb']; + } + } + + //генерируем команды + public function genTeams($you) + { + global $u; + $ret = ''; + $teams = []; + //выделяем пользователей + $i = 0; + $j = 1; + $tms = []; + //if( $this->users[$this->uids[$you]]['team'] > 0 && $this->stats[$this->uids[$you]]['hpNow'] > 0 ) { + $teams[$this->users[$this->uids[$you]]['team']] = ''; + $tms[0] = $this->users[$this->uids[$you]]['team']; + //} + while ($i < count($this->uids)) { + if ($this->stats[$i]['hpNow'] > 0) { + if (!isset($teams[$this->users[$i]['team']])) { + $tms[$j] = $this->users[$i]['team']; + $j++; + } + if ($this->stats[$i]['hpNow'] < 0) { + $this->stats[$i]['hpNow'] = 0; + } + if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) { + $this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll']; + } + $a1ms = ''; + if (isset($this->ga[$this->users[$i]['id']][$you]) && $this->ga[$this->users[$i]['id']][$you] != false) { + $a1mc = ''; + $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1')); + if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + $a1mc = 'color:red;'; + } + $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"'; + } elseif (isset($this->ag[$this->users[$i]['id']][$you]) && $this->ag[$this->users[$i]['id']][$you] != false) { + $a1mc = ''; + $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1')); + if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + $a1mc = 'color:green;'; + } + $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"'; + } + if ($this->users[$i]['login2'] == '') { + $this->users[$i]['login2'] = $this->users[$i]['login']; + } + if ($this->users[$i]['align'] == 9) { + $this->stats[$i]['hpNow'] = $this->stats[$i]['hpNow'] / ($this->stats[$i]['hpAll'] / 100); + $this->stats[$i]['hpAll'] = '100%'; + } + $ldr = ''; + if ($this->users[$i]['lider'] == $this->info['id']) { + $ldr = 'users[$i]['team'] . '.gif \>'; + } + $teams[$this->users[$i]['team']] .= ', ' . $ldr . 'users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']'; + } + $i++; + } + + //генерируем команды + $i = 0; + while ($i < count($tms)) { + $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', '); + if ($teams[$tms[$i]] != '') { + //if($u->info['team'] == $tms[$i]) { + // $teams[$tms[$i]] = ' '.$teams[$tms[$i]]; + //}else{ + $teams[$tms[$i]] = ' ' . $teams[$tms[$i]]; + //} + $ret .= $teams[$tms[$i]]; + if (count($tms) > $i + 1) { + $ret .= '   против   '; + } + } + $i++; + } + return 'genteam("' . $ret . '");'; + } + + + public function addTravm($uid, $type, $lvl) + { + global $u; + $t = $type; + if ($t == 1) { + $name = 'Легкая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов + $data = 'add_s' . $stat . '=-' . $lvl; + $img = 'eff_travma1.gif'; + $v1 = 1; + //echo ''.$name.''; + } elseif ($t == 2) { + $name = 'Средняя травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(3, 5);// время травмы от 6 до 12 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 2); + $v1 = 2; + $img = 'eff_travma2.gif'; + } elseif ($t == 3) { + $name = 'Тяжелая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(5, 7);// время травмы от 12 до 6 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 3); + $v1 = 3; + $img = 'eff_travma3.gif'; + } elseif ($t == 4) { + $name = 'Неизлечимая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = 24;// время травмы от 24 часа + $data = 'add_s' . $stat . '=-' . ($lvl * 50); + $v1 = 4; + $img = 'eff_travma4.gif'; + } + $timeEnd = $timeEnd * 3600; + // + //$timeEnd = $timeEnd/3600; + // + $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $v1 . '")'); + $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")'); + } + + public function testUserInfoBattle($uid) + { + global $u; + if (!isset($this->uids[$uid])) { + //Заносим данные об игроке снова (видимо он погиб и его стерло с инфо) + if (!isset($this->uids[$uid])) { + $this->uids[$uid] = count($this->users); + } + $this->users[$this->uids[$uid]] = mysql_fetch_array(mysql_query('SELECT + + `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $uid . '" LIMIT 1')); + $this->stats[$this->uids[$uid]] = $u->getStats($this->users[$this->uids[$uid]], 0, 0, false, false, true); + } + } + + ///----Спасение функция + public function spaCheck($u1) + { + if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { + mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"'); + if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) // + { + //Свиток спасения + // + if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) { + //Даем призрачку + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Призрачная защита', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5); + } elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) { + //Абсолютная защита + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Абсолютная защита', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75); + } elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) { + //Абсолютная защита x2 + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Защита Мироздателя', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); + } + + if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { + $this->stats[$this->uids[$u1]]['hpNow'] = 1; + } + if ($this->stats[$this->uids[$u1]]['mpNow'] < 1) { + $this->stats[$this->uids[$u1]]['mpNow'] = 1; + } + if ($this->stats[$this->uids[$u1]]['hpNow'] > $this->stats[$this->uids[$u1]]['hpAll']) { + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); + } + if ($this->stats[$this->uids[$u1]]['mpNow'] > $this->stats[$this->uids[$u1]]['mpAll']) { + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); + } + + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u1 . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'); + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$this->uids[$u1]]['hpNow'] . '",`mpNow` = "' . $this->stats[$this->uids[$u1]]['mpNow'] . '", `tactic7` = `tactic7` - 25 WHERE `id` = "' . $u1 . '" LIMIT 1'); + $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' убит...' . $this->stats[$this->uids[$u1]]['login'] . ' был спасен. '; + $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, + ' ', + $mas['text'], + ($this->hodID + 0) + ); + // + + + } else { + if (isset($this->stats[$this->uids[$u1]]['login'])) { + mysql_query('UPDATE `stats` SET `hpNow` = "0",`mpNow` = "0" WHERE `id` = "' . $u1 . '" LIMIT 1'); + $this->stats[$this->uids[$u1]]['hpNow'] = 0; + $this->users[$this->uids[$u1]]['hpNow'] = 0; + $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' погиб.'; + $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, + ' ', + $mas['text'], + ($this->hodID + 1) + //Удаляем размен из базы //ТУТ возможен лаг удаления + ); + mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "-' . $this->stats[$this->uids[$u1]]['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->stats[$this->uids[$u1]]['id'] . '" AND `v1` = "priem" AND `delete` =0'); + // v1 priem + } + } + } + } + //Конец спасения + +} diff --git a/_incl_data/class/BotLogic.php b/_incl_data/class/BotLogic.php new file mode 100644 index 00000000..3cbf8fd2 --- /dev/null +++ b/_incl_data/class/BotLogic.php @@ -0,0 +1,1024 @@ + ['timeout' => 30]]); + $val = file_get_contents('https://new-combats.com/jx/battle/refresh_bot.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx); + echo '[' . $val . ']
'; + unset($val); + } + } + + static function battle_priems() + { + //используем приемы в бою + if (self::$st['hpNow'] > 0 && self::$bot['battle'] > 0) { + + $pr = explode('|', self::$bot['priems']); + $rz = explode('|', self::$bot['priems_z']); + $i = 0; + while ($i < count($pr)) { + if ($pr[$i] > 0) { + self::$pr[$pr[$i]] = $rz[$i]; + } + $i++; + } + $i = 0; + while ($i < count($pr)) { + if ($rz[$i] < 1 && $pr[$i] > 0) { + //Можно использовать прием, подключаем логику + BotPriemLogic::start($i, $pr[$i]); + } + $i++; + } + self::$pr = false; + } + } + + static function clear_bot() + { + + //Очистка бота, обнуляем его до [0], удаляем эффекты, предметы и т.д, а текущему ставим логин delete + + //Удаляем сообщения в чате + mysql_query('DELETE FROM `chat` WHERE `to` = "' . self::$bot['login'] . '"'); + //Удаляем шмотки и эффекты + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . self::$bot['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . self::$bot['id'] . '"'); + + //Удаляем статы и поле в юзерс + mysql_query('DELETE FROM `users` WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `online` WHERE `uid` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . self::$bot['id'] . '" LIMIT 1'); + + } + + static function inuser_go_main($id, $txt = '') + { + if (isset($id['id'])) { + $ctx = stream_context_create(['https' => ['timeout' => 1]]); + file_get_contents('https://new-combats.com/main_bot.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx); + } + } + + static function inuser_go_zv($id, $txt = '') + { + if (isset($id['id'])) { + $ctx = stream_context_create(['https' => ['timeout' => 1]]); + file_get_contents('https://new-combats.com/main_bot.php?zayvka=1&r=4&uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx); + } + } + + //ПРоверка на файтрум + static function test_fr($id, $city = 'capitalcity') + { + return $city != 'capitalcity' || $id == 0 || $id == 2 || $id == 4 || $id == 5 || $id == 7 || $id == 377; + } + + //Действия бота вне боя + static function actions() + { + + global $u; + + if (self::$bot['battle'] == 0 && self::$bot['zv'] == 0 && self::$bot['pass'] == 'saintlucia') { + + //Можно: сменить фулл, перейти в другую комнату, входить наймом, делать бафы + + //Переходим в другую комнату + if (true == false && self::$bot['a1'] != 0 && self::$bot['a1'] != self::$bot['room']) { + + self::_loc(self::$bot['a1']); + + } else { + + self::update('a1', 0); + + //CAPITAL + if (self::$bot['city'] == 'capitalcity' && !self::test_fr(self::$bot['room'])) { + + if (self::$bot['exp'] > 400000 && self::$bot['level'] == 8) { + self::$bot['exp'] = 400000; + mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } elseif (self::$bot['exp'] > 3500000 && self::$bot['level'] == 9) { + self::$bot['exp'] = 3500000; + mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + //Действие в комнате + //Магазин + //Покупаем кристалл вечности + if (self::$bot['room'] == 10 && self::$bot['level'] == 5 && self::$bot['exp'] >= 12499) { + $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($cr['id'])) { + //Покупаем кристалл + $u->addItem(1204, self::$bot['id']); + } + } + //Переходим в комнату для сражений + self::_loc(self::_loc_zv()); + } + } + + //Если бот уже набрал опыт для перехода на 6-ой + if (self::$bot['level'] == 5 && self::$bot['exp'] >= 12499) { + $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($cr['id'])) { + self::update('a1', 10); + } + } + + //Похоже что боту пора сменить комплект )) + if (self::$bot['clss'] == 0) { + + //Выбираем новый класс и шмотки :) + + //Меняем класс + self::$bot['clss'] = rand(1, 4); + + $x = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" ')); + + if ($x[0] > 0) { + + if ($x[0] > 1) { + + $x = rand(1, $x[0]); + //выбираем 1 из нескольких + $da = ['ASC', 'DESC', 'DESC', 'ASC']; + $da = $da[rand(0, 5)]; + $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" ORDER BY `id` ' . $da . ' LIMIT ' . ($x - 1) . ',1')); + } else { + $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" LIMIT 1')); + } + + if (!isset($com['id'])) { + + $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` < "' . (self::$bot['level']) . '" ORDER BY `id` DESC LIMIT 1')); + + } + + if (isset($com['id'])) { + + mysql_query('UPDATE `users` SET `clss` = "' . self::$bot['clss'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + /* Забираем старые шмотки и эффекты */ + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `gift` = "" AND `item_id` != "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0"'); + mysql_query('UPDATE `items_users` SET `iznosNOW` = "0" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0"'); + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0"'); + + /* Обновляем статы и приемы */ + + if ($com['pr'] == '') { + $i = 1; + while ($i <= 18) { + $com['pr'] .= $com['p' . $i] . '|'; + $i++; + } + $com['pr'] .= '0'; + } + + mysql_query('UPDATE `stats` SET `stats` = "' . $com['stats'] . '",`priems` = "' . $com['pr'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + $i = 1; + while ($i <= 20) { + if ($com['e' . $i] > 0) { + //Выдаем и надеваем предмет + //$it = $u->addItem($com['e'.$i],self::$bot['id']); + $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1')); + mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time() + 9640000) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'); + } + $i++; + } + + $i = 1; + while ($i <= 20) { + if ($com['w' . $i] > 0) { + //Выдаем и надеваем предмет + $it = $u->addItem($com['w' . $i], self::$bot['id']); + $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_shop` WHERE `item_id` = "' . $com['w' . $i] . '" LIMIT 1')); + if ($it > 0) { + mysql_query('UPDATE `items_users` SET `inOdet` = "' . $i . '",`delete` = "0", `1price` = "' . $eff1['price_1'] . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `id` = "' . $it . '" LIMIT 1'); + } + } + $i++; + } + } + } + } + + //если бот уже 1-ый уровень, а сидит в новичках :) кидаем его в залы + if (self::$bot['city'] == 'capitalcity' && self::$bot['level'] < 2 && self::$bot['room'] == 0 && self::$bot['a1'] == 0) { + self::_loc(self::_loc_zv()); + } + } + } + + public $bot_last_action = []; + + //Включаем логику бота + static function start($id) + { + if (!isset($bot_last_action[$id])) { + global $u; + $bot_last_action[$id]++; + self::$bot = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`id` = "' . mysql_real_escape_string($id) . '" AND `u`.`banned` = "0" LIMIT 1')); + + if (isset(self::$bot['id'])) { + + self::$st = $u->getStats(self::$bot, 0); + + //Заходим ботом в онлайн + self::_online(); + + if (self::$bot['battle'] > 0) { + + //Действия бота в поединке + self::$btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string(self::$bot['battle']) . '" AND `team_win` = "-1" LIMIT 1')); + if (isset(self::$btl['id'])) { + + $go_bot = false; + $go_txt = ''; + + $a1 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid1` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); + + //Проверяем возможность использования приемов и делаем список что использовать + //используем приемы + self::battle_priems(); + + //Бот сделал удар, но никто не ответил, проверяем таймаут и если что заходим + if (isset($a1['id']) && $a1['time'] + self::$btl['timeout'] < time()) { + $go_bot = true; + } + + //ТУТ test + $a2 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); + if (isset($a2['uid1'])) { + mysql_query('UPDATE `stats` SET `enemy` = "' . $a2['uid1'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + $a3 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); + if (isset($a3['uid2'])) { + mysql_query('UPDATE `stats` SET `enemy` = "' . $a3['uid2'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + //Размен с противником + + + self::$enemy = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . self::$bot['enemy'] . '" LIMIT 1')); + + } else { + + //Заходим на персонажа + self::inuser_go_btl(self::$bot); + + //Поединок уже завершился, выкидываем из боя + self::$bot['battle'] = 0; + mysql_query('UPDATE `users` SET `battle` = "' . self::$bot['battle'] . '" WHERE `id` = "' . mysql_real_escape_string(self::$bot['id']) . '" LIMIT 1 '); + } + + } else { + + //Действия бота вне поединка + if (self::$bot['timeMain'] < time()) { + + mysql_query('UPDATE `chat` SET `time` = "' . time() . '" WHERE `to` = "' . self::$bot['login'] . '" AND `time` = "-1"'); + + //Действие возможно произвести + if (self::$bot['ipreg'] == 1 || self::$bot['ipreg'] == 2 || self::$bot['ipreg'] == 4) { + //Принимаем только хаоты + self::$bot['ipreg'] = 3; + } + if (self::$bot['ipreg'] == 5) { + //Подаем только хаоты + self::$bot['ipreg'] = 7; + } + // + if (self::$bot['ipreg'] == 0 || !self::test_fr(self::$bot['room'])) { + + //Обновляем эффекты + $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" LIMIT 1')); + if (isset($com['id'])) { + $eft = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($eft['id'])) { + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0"'); + $i = 1; + while ($i <= 20) { + if ($com['e' . $i] > 0) { + //Выдаем и надеваем предмет + //$it = $u->addItem($com['e'.$i],self::$bot['id']); + $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1')); + mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time() + 86400 * 7) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'); + } + $i++; + } + } + } + + if (self::$bot['level'] >= 13 && self::$bot['clan'] == 0 && self::$bot['align'] == 0) { + //обнуляем бота + self::clear_bot(); + } + + //Только-что из поединка, хиляется + if (!self::test_fr(self::$bot['room'])) { + + //В какой-то локации, видимо что-то делаем + + } elseif (self::$st['hpNow'] >= self::$st['hpAll']) { + echo 1; + //Приступаем к активной деятельности :) + mysql_query('UPDATE `stats` SET `zv`= "0",`team`= "0",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `ipreg` = "' . self::new_action() . '",`mod_zvanie` = "Стажер" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + } else { + + if (self::$bot['mod_zvanie'] == 'Стажер100500') { + //Надеваем комплект + обновляем эффекты + mysql_query('UPDATE `eff_users` SET `timeUse` = "' . (time() + 7200) . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" AND `v1` != "priem" LIMIT 12'); + mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . self::$bot['id'] . '" AND `inOdet` > 0 AND `delete` = "0"'); + $sp = mysql_query('SELECT `u`.`id`,`st`.`inslot`,`st`.`2too` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `st` ON `st`.`id` = `u`.`item_id` WHERE `u`.`inOdet` = 0 AND `st`.`inslot` > 0 AND `st`.`inSlot` <= 20'); + $in = []; + while ($pl = mysql_fetch_array($sp)) { + $od = $pl['inslot']; + + if ($od == 10 && $in[10] > 0) { + if ($in[11] > 0) { + if ($in[12] == 0) { + $od = 12; + } + } else { + $od = 11; + } + } + + if ($od == 3 && $in[3] > 0 && $pl['2too'] > 0) { + if ($in[14] > 0) { + mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . self::$bot['id'] . '" AND `inOdet` = "14" AND `delete` = "0" LIMIT 1'); + $in[14] = 0; + } + $od = 14; + } + + if ($in[$od] == 0) { + $in[$od] = $pl['id']; + mysql_query('UPDATE `items_users` SET `inOdet` = "' . $od . '" WHERE `id` = "' . $pl['id'] . '" AND `uid` = "' . self::$bot['id'] . '" LIMIT 1'); + } + } + mysql_query('UPDATE `items_users` SET `mod_zvanie` = "Cтaжер" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + //Хиляемся дальше + if (self::$bot['regHP'] == 0 || self::$bot['regMP'] == 0) { + mysql_query('UPDATE `stats` SET `regHP` = "' . time() . '", `regMP` = "' . time() . '",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + $reg = $u->regen(self::$bot['id'], self::$st, 0); + } + + self::actions(); + + self::update('timeMain', self::rnd()); + + } elseif (self::$bot['ipreg'] == 1) { + + //Принять заявку на бой (физ.) + if (self::$bot['zv'] == 0) { + + //Выделяем подходящую заявку в физ. поединке + $rz = 2; + $zv = 0; + $nozv = 0; + + if (self::$bot['level'] == 0) { + $rz = 1; + } + + $zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `city` = "' . self::$bot['city'] . '" AND `otk` < "' . rand(2, 6) . '" AND `time` < "' . (time() - rand(15, 25)) . '" AND `bcs` < "' . time() . '" AND `start` = "0" AND `razdel` = "' . $rz . '" AND `cancel` = "0" AND `time` > "' . (time() - 1111) . '" AND `money3` = 0 ORDER BY `time` DESC LIMIT 1')); + + if (isset($zv['id'])) { + + $uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1')); + $uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1')); + + if (isset($uz1['id']) && !isset($uz2['id'])) { + + $uz1st = $u->getStats($uz1, 0); + + if ($uz1st['reting'] <= floor(self::$st['reting'] * 1.27)) { + + //Принимаем заявку + $sa = ''; + if (self::$bot['sex'] == 2) { + $sa = 'а'; + } + + $text = ' [login:' . self::$bot['login'] . '] принял' . $sa . ' вашу заявку на бой.[reflesh_main_zv_priem:' . self::$bot['id'] . ']'; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz1['city'] . "','','','" . $uz1['login'] . "','" . $text . "','" . time() . "','6','0')"); + mysql_query('UPDATE `stats` SET `zv` = "' . $zv['id'] . '",`team` = "2" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + } else { + $nozv = 1; + } + + unset ($uz1st); + + } else { + $nozv = 1; + } + } else { + $nozv = 1; + } + + if ($nozv == 1 && self::$bot['timeMain'] < time() - rand(1, 3) * 60) { + mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + unset($rz); + } + + + } elseif (self::$bot['ipreg'] == 2) { + + //Принять заявку на бой (груп.) + self::bot_group_haot_zv(6); + } elseif (self::$bot['ipreg'] == 3) { + + //Принять заявку на бой (хаот.) + self::bot_group_haot_zv(7); + } elseif (self::$bot['ipreg'] == 4) { + + //Принять заявку на бой (турнир.) + self::e('' . self::$bot['login'] . ', я хочу принять турнир...'); + } elseif (self::$bot['ipreg'] == 5) { + + //Подать заявку (физ.) + if (self::$bot['zv'] == 0) { + + $rz = 2; + if (self::$bot['level'] == 0) { + $rz = 1; + } + + $ins = mysql_query('INSERT INTO `zayvki` (`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) VALUES ( + "0", + "0", + "' . time() . '", + "' . self::$bot['city'] . '", + "' . self::$bot['id'] . '", + "0", + "0", + "300", + "0", + "21", + "0", + "21", + "1", + "1", + "0", + "0", + "' . $rz . '", + "", + "", + "","' . (0 + self::$bot['reting']) . '","0")'); + $zid = mysql_insert_id(); + mysql_query('UPDATE `stats` SET `zv` = "' . $zid . '", `team` = "1" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + } elseif (self::$bot['ipreg'] == 6 || self::$bot['ipreg'] == 7) { + + self::bot_group_haot_zv(self::$bot['ipreg']); + + if (self::$bot['zv'] == 0) { + + $rz = 5; + + $zv_c = [ + + 'time_start' => (60 * 5), 'tm1' => rand(2, 6), 'tm2' => rand(2, 6), 'l1min' => 0, 'l1max' => 21, 'l2min' => 0, 'l2max' => 21, 'timeout' => (60 * rand(1, 3)), + + ]; + + if (self::$bot['ipreg'] == 7) { + $zv_c['tm1'] = 99; + } + + $zv_c['tm2'] = $zv_c['tm1']; + $zv_c['l1min'] = self::$bot['level']; + $zv_c['l1max'] = self::$bot['level']; + + if ($zv_c['l1min'] < 2) { + $zv_c['l1min'] = 2; + } + if ($zv_c['l1max'] > 21) { + $zv_c['l1max'] = 21; + } + + $zv_c['l2min'] = $zv_c['l1min']; + $zv_c['l2max'] = $zv_c['l1max']; + + } + + } elseif (self::$bot['ipreg'] == 8) { + + //Ожидание начала поединка + if (self::$bot['zv'] == 0) { + + //Поединок не удалось начать + mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } else { + $zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . self::$bot['zv'] . '" AND `cancel` = "0" AND `start` = "0" LIMIT 1')); + + if (!isset($zv['id'])) { + + //Обнуляем действия + mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + } elseif ($zv['razdel'] == 4 || $zv['razdel'] == 5) { + + //хаот или группа + if ($zv['time_start'] + $zv['time'] <= time()) { + + self::inuser_go_zv(self::$bot); + } + + } else { + //физ + if ($zv['creator'] == self::$bot['id']) { + + $uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1')); + if (isset($uz2['id'])) { + //Заявку кто-то принял, реагируем! :) + $pr = -1; + + $uz2st = $u->getStats($uz2, 0); + + //btl-cof + if ($uz2st['reting'] > floor(self::$st['reting'] * 1.27)) { + + //Отказываем, в 95% случаев, противник слишком силен + if (rand(0, 100) > 95) { + //отправляем бота на избиение :D + $pr = 1; + } else { + //отказ + $pr = 0; + } + + } else { + $pr = 1; + } + + //Можно принять заявку + //$pr = 0; + + if ($pr == 1) { + + //Прием заявки + //создаем поединок с ботом + $expB = 0; + $btl = ['players' => '', 'timeout' => $zv['timeout'], 'type' => $zv['type'], 'invis' => $zv['invis'], 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; + $ins = mysql_query('INSERT INTO `battle` (`time_over`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`team_win`) VALUES ( + "0", + "' . self::$bot['city'] . '", + "' . time() . '", + "' . $btl['players'] . '", + "' . $btl['timeout'] . '", + "' . $btl['type'] . '", + "' . $btl['invis'] . '", + "' . $btl['noinc'] . '", + "' . $btl['travmChance'] . '", + "' . $btl['typeBattle'] . '", + "' . $btl['addExp'] . '", + "' . $btl['money'] . '", + "-1")'); + if ($ins) { + $btl_id = mysql_insert_id(); + //обновляем данные о поединке + mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $uz2['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '",`ipreg` = "0" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team`="1" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team`="2" WHERE `id` = "' . $uz2['id'] . '" LIMIT 1'); + + //Если бой кулачный, то снимаем вещи + if ($btl['type'] == 1) { + mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . self::$bot['id'] . '" AND `inOdet`!=0'); + mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $uz2['id'] . '" AND `inOdet`!=0'); + } + + mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + + //обновляем заявку, что бой начался + self::$bot['battle'] = $btl_id; + + //Отправляем сообщение в чат всем бойцам + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $uz2['login'] . "','" . time() . "','11','0','117')"); + } + + } elseif ($pr == 0) { + + //Отказ + $sa = ''; + if (self::$bot['sex'] == 2) { + $sa = 'а'; + } + $text = ' [login:' . self::$bot['login'] . '] отказал' . $sa . ' вам в поединке.'; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz2['city'] . "','','','" . $uz2['login'] . "','" . $text . "','" . time() . "','6','0')"); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "1" WHERE `id` = "' . $uz2['id'] . '" LIMIT 1'); + mysql_query('UPDATE `zayvki` SET `otk` = ( `otk` + 1 ),`bcs` = "' . (time() + rand(30, rand(60, 180))) . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + } + + } else { + + //Заявку никто не принял, возможно стоит отменить заявку вообще! + if (self::$bot['timeMain'] < time() - 30 - rand((7 / $zv['otk']), (3 * 49 / $zv['otk']))) { + + mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + + } + + } + + } + + } + + //Бот уже слишком долго ждет ответа игрока, отказываемся от заявки + if (self::$bot['timeMain'] < time() - rand((30 / $zv['otk']), (135 / $zv['otk'])) && $zv['creator'] != self::$bot['id'] && ($zv['razdel'] == 1 || $zv['razdel'] == 2)) { + + $uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1')); + if (isset($uz1['id'])) { + + $sa = ''; + if (self::$bot['sex'] == 2) { + $sa = 'а'; + } + + $text = ' [login:' . self::$bot['login'] . '] отозвал' . $sa . ' свой запрос на бой.'; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz1['city'] . "','','','" . $uz1['login'] . "','" . $text . "','" . time() . "','6','0')"); + } + + mysql_query('UPDATE `zayvki` SET `otk` = ( `otk` + 1 ),`bcs` = "' . (time() + rand(30, rand(60, 180))) . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "1" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `ipreg` = "1",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + + } + + } else { + self::update('ipreg', 0); + } + + } + + } + + return true; + + } else { + + return false; + + } + } + } + + static function team_zv_cf($zv, $tm) + { + $r = mysql_fetch_array(mysql_query('SELECT SUM(`btl_cof`) FROM `stats` WHERE `zv` = "' . $zv['id'] . '" AND `team` = "' . $tm . '" LIMIT 1')); + return $r[0]; + } + + static function new_action() + { + + $r = rand(1, 7); + + if (self::$bot['level'] < 2) { + if ($r == 2 || $r == 3 || $r == 6 || $r == 7 || $r == 8) { + if (rand(0, 1) == 1) { + $r = 1; //принимаем физ + } elseif (rand(0, 1) == 0) { + $r = 4; //принимаем турнир + } else { + $r = 5; //подаем физ + } + } + } elseif (self::$bot['level'] == 0) { + if (rand(0, 1) == 1) { + $r = 1; //принимаем физ + } else { + $r = 5; //подаем физ + } + } + + if ($r == 4) { + $r = 1; + } + + return $r; + + } + + + /*/ + Базовые функции обучения бота + /*/ + //Бот ищет заявку в группы или хаот для своего уровня и подходящую ему + static function bot_group_haot_zv($id) + { + $rz = 5; + + $sp = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "' . $rz . '" AND `cancel` = "0" AND `start` = "0" AND `invise` = "0" AND `money3` = 0 AND ( + ( `min_lvl_1` <= ' . self::$bot['level'] . ' AND `max_lvl_1` >= ' . self::$bot['level'] . ' ) OR ( `min_lvl_2` <= ' . self::$bot['level'] . ' AND `max_lvl_2` >= ' . self::$bot['level'] . ' ) + )'); + + $pr = 0; + + while ($pl = mysql_fetch_array($sp)) { + + if ($pr == 0) { + + $go = 1; + $tm = [0, 0, 0]; + + if ($rz == 4) { + + $tm1c = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" AND `team` = "1" LIMIT 1')); + $tm2c = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" AND `team` = "2" LIMIT 1')); + + if ($tm1c[0] < $pl['tm1max'] && $pl['min_lvl_1'] <= self::$bot['level'] && $pl['max_lvl_1'] >= self::$bot['level']) { + $tm[1] = 1; + } + + if ($tm2c[0] < $pl['tm2max'] && $pl['min_lvl_1'] <= self::$bot['level'] && $pl['max_lvl_1'] >= self::$bot['level']) { + $tm[2] = 1; + } + + $atm = 1; + $tmr = 0; + if ($tm[1] == 1 && $tm[2] == 0) { + $tmr = 1; + } elseif ($tm[1] == 0 && $tm[2] == 1) { + $tmr = 2; + } else { + $tmr = rand(1, 2); + } + + if ($tmr > 0) { + if ($tmr == 1) { + $atm = 2; + } + + + //Логика приема заявки + if ((self::team_zv_cf($pl, $atm) > (self::team_zv_cf($pl, $tmr) + self::$st['reting']) * 1.67 || ($zv['tm2max'] < $zv['tm1max'] / 2) || ($zv['tm1max'] < $zv['tm2max'] / 2)) && rand(0, 100) < 90) { + $go = 0; + } + } + + } elseif ($rz == 5) { + + + if ($pl['min_lvl_1'] == self::$bot['level'] && $pl['max_lvl_1'] == self::$bot['level']) { + $tm[1] = 1; + } + $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"')); + $cols = $col_p[0]; + if ($cols >= $pl['maxplayers']) { + $go = 0; + } + + } + + + if ($go == 1 && ($tm[1] != 0 || $tm[2] != 0)) { + + if ($tm[1] == 1 && $tm[2] == 0) { + $tm = 1; + } elseif ($tm[1] == 0 && $tm[2] == 1) { + $tm = 2; + } else { + $tm = rand(1, 2); + } + + if ($rz == 5) { + $tm = 1; + } + + + if ($rz == 5) { + $tm = rand(1, 2); + + if ($pl['invise'] == 0) { + $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"')); + $nxtID = $nxtID[0]; + self::$bot['login2'] = ''; + } else { + self::$bot['login2'] = ''; + } + + $blnc = 100 * self::$bot['level'] + self::$st['reting']; + + $pl['tm' . $tm] += $blnc; + + mysql_query('UPDATE `zayvki` SET `tm1` = "' . $pl['tm1'] . '", `tm2` = "' . $pl['tm2'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + + } + + if ($tm > 0 || $rz == 5) { + + //Принимаем участие в заявке + mysql_query('UPDATE `stats` SET `zv` = "' . $pl['id'] . '",`team` = "' . $tm . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `login2` = "' . self::$bot['login2'] . '",`ipreg` = "8" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + self::$bot['zv'] = $pl['id']; + $pr = $pl['id']; + + } + + } //if + + } // while + + } + + } + + //Добавляем нового бота + static function createNewBot($login, $sex) + { + if ($sex != 1) { + $sex = 0; + } else { + $se = 1; + } + + $r = ['name' => '_', 'city_real' => '', 'deviz' => '', 'chatColor' => 'Black']; + + $ins = mysql_query("INSERT INTO `users` (`fnq`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`name`,`sex`,`city_real`,`deviz`,`chatColor`,`timereg`) VALUES ( + '0', + 'real_bot_user', + '0', + '" . mysql_real_escape_string($login) . "', + '" . md5('regnxt#$%^а0.' . time()) . "', + '127.0.0.1', + '127.0.0.1', + 'capitalcity', + 'capitalcity', + '" . $r['name'] . "', + '" . mysql_real_escape_string($sex) . "', + '" . $r['city_real'] . "', + '" . $r['deviz'] . "', + '" . $r['chatColor'] . "', + '" . time() . "')"); + if ($ins) { + $uid = mysql_insert_id(); + mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')"); + mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('" . $uid . "','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')"); + mysql_query("UPDATE `users` SET `online`='" . time() . "' WHERE `uid` = '" . $uid . "' LIMIT 1"); + } + + } + + //Бот находится в онлайне + static function _online() + { + if (self::$bot['online'] < time() - 60) { + //уровень/апп + if (self::$bot['battle'] == 0 && self::$bot['zv'] == 0) { + self::_level(); + } + self::update('online', time()); + + } + } + + //Бот меняет локацию + static function _loc_A($a, $b) + { + return $b; + } + + static function _loc_zv() + { + + if (rand(0, 100) < 5) { + $r = 1; + } else { + $r = rand(1, 4); + } + + //будуар + if ($r == 4 && self::$bot['sex'] != 1) { + $r = rand(1, 3); + } + + if (self::$bot['city'] == 'capitalcity') { + if ($r == 4) { + //будуар + $r = 7; + } elseif ($r == 3) { + //ЗВ 3 + $r = 5; + } elseif ($r == 2) { + //ЗВ 2 + $r = 2; + } else { + //ЗВ 1 + $r = 4; + } + + if (self::$bot['level'] == 0) { + //Новички + $r = 0; + } + + } + + return $r; + } + + static function _loc($id) + { + + if ($id == self::$bot['room']) { + //ничего, уже пришли + self::update('a1', 0); + + } else { + + //Прокладываем маршрут из текущей комнаты + $rid_next = self::_loc_A(self::$bot['room'], $id); + if ($rid_next > 0) { + //Идем туда + //$rid_next = 377; + mysql_query('UPDATE `users` SET `room` = "' . $rid_next . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + return true; + } else { + //Невозможно дойти туда + return false; + } + + } + + } + + //Бот получил уровень, либо апп + static function _level() + { + global $u; + $lvl = mysql_fetch_array(mysql_query('SELECT `upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . (self::$bot['upLevel'] + 1) . '" LIMIT 1')); + if (isset($lvl['upLevel'])) { + + if (self::$bot['level'] <= 5 && self::$bot['exp'] >= 12499) { + $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($cr['id'])) { + $u->addItem(1204, self::$bot['id']); + self::$bot['exp'] = 12500; + } + } + if ($lvl['exp'] <= self::$bot['exp']) { + self::inuser_go_main(self::$bot); + mysql_query('UPDATE `users` SET `clss` = "0" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + + } + + } else { + self::e(self::$bot['login']); + } + + } + + //Вспомогательные функции + static function e($t) + { + + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date('H:i:s') . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity", + "LEL","6","1","-1")'); + + } + + static function rnd() + { + return time() + rand(3, 14) + rand(0, 14) + rand(7, 21); + } + + static function update($n, $v, $t = 'users') + { + self::$bot[$n] = $v; + mysql_query('UPDATE `' . $t . '` SET `' . $n . '` = "' . self::$bot[$n] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); + } + +} diff --git a/_incl_data/class/BotPriemLogic.php b/_incl_data/class/BotPriemLogic.php new file mode 100644 index 00000000..da3fc716 --- /dev/null +++ b/_incl_data/class/BotPriemLogic.php @@ -0,0 +1,399 @@ += 175 && $id <= 179) { + self::priem175($i); + } + //********************************* + } + return true; + } + + private static function usePriem($id, $on = null) + { + $go_txt = '&usepriem=' . $id; + if ($on != '') { + $on = str_replace(' ', '%20', $on); + $go_txt .= '&useon=' . $on; + } + BotLogic::inuser_go_btl(BotLogic::$bot, $go_txt); + } + + //Ставка на опережение + private static function priem220($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Разгадать тактику + private static function priem217($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Обреченность + private static function priem204($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Выжить + private static function priem232($i) + { + if (self::hp() <= 30 && rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Жажда крови + private static function priem188($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Шок удар + private static function priem235($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Хлебнуть крови + private static function priem240($i) + { + if (self::hp() <= 70) { + self::usePriem($i); + } + } + + //Силовое поле + private static function priem175($i) + { + self::usePriem($i); + } + + //Прикрыться + private static function priem1($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Вломить + private static function priem2($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Собрать зубы + private static function priem3($i) + { + if (self::hp() <= 70 && rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Воля к победе + private static function priem6($i) + { + if (self::hp() <= 40 && rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Танец ветра + private static function priem8($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Танец лезвий + private static function priem48($i) + { + if (rand(0, 100) < 70) { + self::usePriem($i); + } + } + + //Дикая удача + private static function priem9($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Слепая удача + private static function priem47($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Предвиденье + private static function priem10($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Второе дыхание + private static function priem49($i) + { + if (rand(0, 100) < 80 && self::hp() <= 60) { + self::usePriem($i); + } + } + + //Рывок + private static function priem223($i) + { + if (self::hp() <= 50 && rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Удачный удар + private static function priem11($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + //Стойкость + private static function priem13($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Ярость + private static function priem14($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + //Сильный удар + private static function priem4($i) + { + if (rand(0, 100) < 60) { + self::usePriem($i); + } + } + + //Утереть пот + private static function priem5($i) + { + if (self::hp() <= 95) { + self::usePriem($i); + } + } + + + //Агрессивная защита + private static function priem211($i) + { + if (rand(0, 100) < 80) { + self::usePriem($i); + } + } + + + //Полная защита + private static function priem45($i) + { + if (rand(0, 100) < 50) { + self::usePriem($i); + } + } + + + //Активная защита + private static function priem7($i) + { + if (rand(0, 100) < 30) { + self::usePriem($i); + } + } + + + private static function hp() + { + return round((BotLogic::$st['hpNow'] / BotLogic::$st['hpAll'] * 100), 2); + } + + //Тест на возможность использования + private static function testpriem($pl) + { + global $u; + $notr = 0; + + $tr = $u->lookStats($pl['tr']); + $d2 = $u->lookStats($pl['date2']); + + $x = 1; + while ($x <= 7) { + if (BotLogic::$bot['tactic' . $x] < $pl['tt' . $x] && $x != 7 && $pl['tt' . $x] > 0) { + $notr++; + } elseif ($x == 7) { + if ($pl['tt' . $x] > 0 && BotLogic::$bot['tactic' . $x] <= 0) { + $notr++; + } + } + $x++; + } + + if ($pl['xuse'] > 0) { + $xu = $u->testAction('`vars` = "use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', 2); + if ($xu[0] >= $pl['xuse']) { + $notr++; + } + } + + $x = 0; + $t = $u->items['tr']; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($tr['tr_' . $n])) { + if ($n == 'lvl') { + if ($tr['tr_' . $n] > BotLogic::$bot['level']) { + $notr++; + } + } elseif ($tr['tr_' . $n] > BotLogic::$st[$n]) { + $notr++; + } + } + $x++; + } + + if (isset($tr['tr_mpNow']) && BotLogic::$st['mpNow'] < $tr['tr_mpNow']) { + $notr++; + } + + if ($pl['trUser'] == 1) { + //требует чтобы пользователь с кем-то разменивался (при ожидании прием гаснит) + $ga = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . BotLogic::$bot['battle'] . '" AND `uid1` = "' . BotLogic::$bot['id'] . '" AND `uid2` = "' . BotLogic::$bot['enemy'] . '" LIMIT 1')); + if (isset($ga['id'])) { + $notr++; + } + } + + //Если прием уже использовали + if (BotLogic::$st['prsu'][$pl['id']] > 0) { + $notr++; + } + + return $notr; + } +} diff --git a/_incl_data/class/CalculateFromString.php b/_incl_data/class/CalculateFromString.php new file mode 100644 index 00000000..7768ce24 --- /dev/null +++ b/_incl_data/class/CalculateFromString.php @@ -0,0 +1,63 @@ + self::PARENTHESIS_DEPTH){ + break; + } + } + + // Calculate the result + if(preg_match(self::PATTERN, $input, $match)){ + return $this->compute($match[0]); + } + // To handle the special case of expressions surrounded by global parenthesis like "(1+1)" + if(is_numeric($input)){ + return $input; + } + + return 0; + } + + return $input; + } + + private function compute($input){ + $compute = create_function('', 'return '.$input.';'); + + return 0 + $compute(); + } + + private function callback($input){ + if(is_numeric($input[1])){ + return $input[1]; + } + elseif(preg_match(self::PATTERN, $input[1], $match)){ + return $this->compute($match[0]); + } + + return 0; + } +} + +$Cal = new CalculateFromString(); +$xyz='(100 * 25000) + (250 * 25000) + ((500/100) * 25000)'; +$result = $Cal->calculate($xyz); +echo $result; + diff --git a/_incl_data/class/Chat.php b/_incl_data/class/Chat.php new file mode 100644 index 00000000..da8774ea --- /dev/null +++ b/_incl_data/class/Chat.php @@ -0,0 +1,85 @@ + [0 => 'смеется', 1 => 'посмеялся над [*%l*]'], 'fingal' => [0 => 'трет фингал', 1 => 'щупает фингал у [*%l*]'], 'eek' => [0 => 'ошарашен', 1 => 'ошарашен действиями [*%l*]'], 'smoke' => [0 => 'закуривает', 1 => 'предлагает [*%l*] пойти покурить'], 'hi' => [0 => 'приветствует всех вокруг', 1 => 'приветствует [*%l*]'], 'bye' => [0 => 'прощается со всеми и уходит', 1 => 'прощается с [*%l*]'], 'king' => [0 => 'коронует себя :-)', 1 => 'объявляет [*%l*] своим королем!'], 'king2' => [0 => 'коронует себя :-)', 1 => 'объявляет [*%l*] своей королевой!'], 'boks2' => [0 => 'вызывает всех на поединок', 1 => 'предлагает [*%l*] дружеский матч'], 'boks' => [0 => 'обещает побить любого, кто примет вызов!', 1 => 'намекает [*%l*] на поединок'], 'gent' => [0 => 'предлагает считать себя благородным сэром', 1 => 'считает [*%l*] джельтельменом'], 'lady' => [0 => 'предлагает считать себя благородной леди', 1 => 'считает, что [*%l*] настоящая Леди'], 'tongue' => [0 => 'показывает окружающим язык', 1 => 'показывает язык [*%l*]'], 'smil' => [0 => 'болтает без умолку', 1 => 'считает, что [*%l*] говорит откровенную ерунду!'], 'ponder' => [0 => 'кое-что усиленно обдумывает', 1 => 'обещает обмозговать предложение [*%l*]'], 'bow' => [0 => 'сохраняя достоинство, кивает окружающим', 1 => 'сохраняя достоинство кивает [*%l*]'], 'angel' => [0 => 'считает себя Ангелом', 1 => 'считает [*%l*] своим Ангелом'], 'angel2' => [0 => 'грезит об Ангелах', 1 => 'думает что [*%l*] Ангел'], 'hello' => [0 => 'желает здравствовать окружающим', 1 => 'желает здравствовать [*%l*]'], 'dont' => [0 => 'рекомендует окружающим не делать этого', 1 => 'рекомендует [*%l*] не делать этого'], 'idea' => [0 => 'озарен свежей идеей!', 1 => 'предлагает [*%l*] обсудить пару идей'], 'mol' => [0 => 'преклоняется перед окружающими', 1 => 'преклоняется перед [*%l*]'], 'super' => [0 => 'считает, что мир хорош, все дамы - Леди, а Солнце - шар дающий свет!', 1 => 'фанатеет от [*%l*]'], 'beer' => [0 => 'вспоминает про припрятаный в заначке эликсир...', 1 => 'готов поделиться с [*%l*] припрятанным эликсиром!'], 'drink' => [0 => 'считает, что пора пить различные эликсиры', 1 => 'предлагает [*%l*] пойти пропустить по стаканчику эликсира'], 'baby' => [0 => 'изображает малыша', 1 => ' считает, что [*%l*] еще мал и неопытен для обоснованной критики'], 'tongue2' => [0 => ' показывает всяким врединам язык', 1 => 'показывает [*%l*] язык, проявляя недовольство'], 'sword' => [0 => 'готов сразиться в честном поединке', 1 => 'вызывает [*%l*] на честный поединок!'], 'agree' => [0 => 'пожимает руку собеседникам', 1 => 'пожимает руку [*%l*]'], 'loveya' => [0 => 'преисполнен чувства любви', 1 => 'преисполнен чувства любви к [*%l*]'], 'kiss' => [0 => 'целует всех', 1 => 'целует [*%l*]'], 'kiss2' => [0 => 'хочет нежно поцеловать кого-то...', 1 => 'нежно целует [*%l*]'], 'kiss3' => [0 => 'кое-кого целует...', 1 => 'нежно целует [*%l*]'], 'kiss4' => [0 => 'кое-кого целует...', 1 => 'хочет уединиться с [*%l*] и целоваться...'], 'rose' => [0 => 'хочет кому-то подарить розу, но стесняется...', 1 => 'дарит [*%l*] ароматную розу...'], 'love' => [0 => 'думает только о любви...', 1 => 'думает, что [loginfrom] + [*%l*]= любовь!'], 'love2' => [0 => 'мечтает о свадьбе...', 1 => 'мечтает о свадьбе с [*%l*]'], 'confused' => [0 => 'в недоумении...', 1 => 'недоумевает от [*%l*]'], 'yes' => [0 => 'кивает в знак согласия', 1 => 'кивает [*%l*] в знак согласия'], 'no' => [0 => 'мотает головой в знак протеста', 1 => 'мотает головой [*%l*] в знак протеста'], 'shuffle' => [0 => 'в смущении от таких обстоятельств', 1 => 'в смущении от [*%l*]'], 'nono' => [0 => 'выражает категорическое несогласие!', 1 => 'выражает категорическое несогласение с [*%l*]'], 'maniac' => [0 => 'знает точно наперед - сегодня кто-нибудь умрет...', 1 => 'считает, что [*%l*] пора бы уже стать жертвой маньяка...'], 'privet' => [0 => 'почтительно приветствует окружающих', 1 => 'почтительно приветствует [*%l*]'], 'ok' => [0 => 'считает, что это замечательная идея', 1 => 'считает, что [*%l*] движется в правильном направлении'], 'ninja' => [0 => 'угрожает окружающим тайным мастерством!', 1 => 'угрожает [*%l*] мастерством древних'], 'pif' => [0 => 'ищет подходящую мишень', 1 => 'думает, что сложно промахнуться по [*%l*]'], 'smash' => [0 => 'собирается крушить и ломать', 1 => 'хочет сломать пару-тройку костей у [*%l*]'], 'alien' => [0 => 'считает, что мир захватили мутанты!', 1 => ' считает, что [*%l*] еще тот мутант!'], 'pirate' => [0 => 'подумывает, кого бы ограбить!...', 1 => 'считает, что лучшей жертвы чем [*%l*], не найти!'], 'gun' => [0 => 'хочет повысить кое-кому уровень железа в организме... :gun:', 1 => 'считает, что у [*%l*] маловато железа в организме! :gun:'], 'trup' => [0 => 'падает замертво', 1 => 'считает, что [*%l*], живет слишком долго, и пора бы это исправить!'], 'mdr' => [0 => 'считает, что у него есть отличный способ решения разногласий... :mdr:', 1 => 'предлагает [*%l*] культурно отдохнуть :mdr:'], 'sneeze' => [0 => 'громко чихает', 1 => 'чихает на [*%l*], обрызгивая его слюнями с ног до головы!'], 'mad' => [0 => 'просто в бешенстве!!!', 1 => 'в бешенстве от [*%l*]!!!'], 'friday' => [0 => 'культурно отдыхает...', 1 => 'предлагает [*%l*] культурно отдохнуть'], 'cry' => [0 => 'безудержно рыдает', 1 => 'рыдает на плече у [*%l*]'], 'grust' => [0 => 'грустит...', 1 => 'грустит о [*%l*]'], 'rupor' => [0 => 'пытается докричаться до окружающих', 1 => 'пытается докричаться до [*%l*]'], 'fie' => [0 => 'умоляет: НЕТ, только не ЭТО!!!', 1 => 'умоляет [*%l*] о пощаде!'], 'nnn' => [0 => 'ничего не видит, не слышит, и никому не скажет...', 1 => 'ничего не видел, не слышал и не помнит о [*%l*]'], 'row' => [0 => 'находится в бешенстве и ищет с кем бы пообщаться...', 1 => 'собирается выяснить отношения с [*%l*]'], 'red' => [0 => 'смущаясь краснеет...', 1 => 'краснеет от [*%l*]'], 'lick' => [0 => 'облизнулся, в предвкушении', 1 => 'облизывается при виде [*%l*]'], 'help' => [0 => 'нуждается в срочной помощи!', 1 => 'просит помощи у [*%l*]'], 'wink' => [0 => 'подмигивает окружающим', 1 => 'подмигивает [*%l*]'], 'jeer' => [0 => 'посмеивается над ситуацией...', 1 => 'посмеивается над [*%l*]'], 'tease' => [0 => 'дразнится', 1 => 'дразнит [*%l*]'], 'nunu' => [0 => 'недоволен окружающими...', 1 => 'недоволен [*%l*]'], 'inv' => [0 => 'хочет найти свои зубы...', 1 => 'жалуется [*%l*] на трудности жизни инвалида...'], 'duel' => [0 => 'собирается проткнуть кое-кого...', 1 => 'вызывает [*%l*] на дуэль!'], 'susel' => [0 => 'Напевая: "эээххх ухнеееемм, да ещеее ууухнеем.." высматривает в толпе подходящий пондер...', 1 => 'предлагает [*%l*] отхватить прямо по пондеру!'], 'nun' => [0 => 'угрожает окружающим палочками для риса', 1 => 'показывает [*%l*] как надо пользоваться палочками для риса'], 'kruger' => [0 => 'ненавязчиво объясняет окружающим кого тут надо бояться :kruger:', 1 => 'демонстрирует [*%l*] нестриженные когти'], 'flowers' => [0 => 'учится выхватывать букет Ромашек-21 из-за спины одним движением', 1 => 'целует [*%l*] и дарит букет ромашек'], 'horse' => [0 => 'патрулирует границы Бойцовского Клуба', 1 => 'предлагает [*%l*] порубать всех врагов в капусту! :horse:'], 'hug' => [0 => 'готов обнять всех в комнате!', 1 => 'крепко обнимает [*%l*]'], 'str' => [0 => 'в ужасе покрывается ледяным потом!', 1 => 'в ужасе прячется от [*%l*]'], 'alch' => [0 => 'напоминает окружающим о вечных ценностях :alch:', 1 => 'предлагает [*%l*] приобщиться к вечным ценностям :alch:'], 'pal' => [0 => ' напоминает, что из под робы выпирает крест, а не что-то там! :-)', 1 => 'требует от [*%l*] предъявить документы в развернутом виде!'], 'mag' => [0 => 'читает заклинания. Вслух. По слогам.', 1 => 'произносит страшное колдунство на [*%l*]'], 'sniper' => [0 => 'изображает из себя Вильгельма Теля', 1 => 'предлагает [*%l*] поиграть в Вильгельма Теля'], 'fuck' => [0 => 'повторяет позы камасутры', 1 => 'предлагает [*%l*] повторить позы камасутры вместе'], 'rotate' => [0 => 'катается от смеха по полу', 1 => 'катается по полу от смеха над [*%l*]']]; + + public function expworld($txt, $vl) + { + $words = explode(' ', $txt); + $j = 0; + $i = -1; + while ($i < count($words)) { + $i++; + if (isset($words[$i]) && strlen($words[$i]) > $vl) { + $words[$i] = substr($words[$i], 0, $vl) . ' ' . substr($words[$i], $vl); + $i = 0; + $j++; + $txt = implode(' ', $words); + $words = explode(' ', $txt); + } + } + return implode(' ', $words); + } + + public function str_count($str, $col) + { + if (strlen($str) > $col) { + $str = substr($str, 0, $col); + } + return ($str); + } + + public function smileText($text, $tol, $room, $city) + { + $retxt = ''; + $j = 0; + $txt = str_replace('/', '⁄', $text) . ' '; + + if (preg_match("/⁄(.*?) /", $txt, $retxt) && isset($this->smilesWorld[$retxt[1]])) { + if ($tol == '') { + $tol = str_replace('⁄' . $retxt[1] . ' ', '', $txt); + $tol = trim($tol, ' '); + } + if ($tol == '') { + $txt = $this->smilesWorld[$retxt[1]][0]; + } else { + $mbl = mysql_fetch_array(mysql_query('SELECT `online`,`id`,`login`,`room`,`city` FROM `users` WHERE `room`="' . $room . '" AND `online` > ' . (time() - 520) . ' AND `city` = "' . $city . '" AND `login`="' . mysql_real_escape_string($tol) . '" LIMIT 1')); + if (isset($mbl['id'])) { + $txt = '' . $this->smilesWorld[$retxt[1]][1] . ''; + $txt = str_replace('[*%l*]', '[login:' . $tol . ']', $txt); + } else { + $txt = 'USER IS FALSE'; + } + } + $j = 1; + } + + if ($j == 1) { + $text = $txt; + } else { + $text = false; + } + + return $text; + } + + public function send($color, $room, $city, $from, $to, $text, $time, $type, $toChat, $spam, $sound, $new = 0) + { + mysql_query("INSERT INTO `chat` (`new`,`sound`,`color`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`spam`) VALUES ('" . $new . "','" . $sound . "','" . $color . "','" . $city . "','" . $room . "','" . $from . "','" . $to . "','" . $text . "','" . $time . "','" . $type . "','" . $toChat . "','" . $spam . "')"); + return mysql_insert_id(); + } + + public function jsmsg($id, $time, $to, $from, $type, $ch, $e, $see, $js = 0, $cl = '#000000', $typeTime = NULL) + { + $tm = date('H:i', $time); + if ($typeTime == 1) { + $tm = date('d.m.Y H:i', $time); + } + $rt = 'top.addMessage(\'' . $id . '\',\'' . $tm . '\',\'' . $to . ' \',\'' . $from . '\',\'' . $type . '\',\'' . $ch . '\'," ' . $e . ' ",\'' . $see . '\',\'' . $cl . '\');'; + if ($js == 1) { + $rt = ''; + } + return $rt; + } +} diff --git a/_incl_data/class/Dialog.php b/_incl_data/class/Dialog.php new file mode 100644 index 00000000..e03c0e14 --- /dev/null +++ b/_incl_data/class/Dialog.php @@ -0,0 +1,1398 @@ + $i, 1 => $x - ($i * $j)]; + } + + public function objLevel($t, $l) + { + $i = 1; + $r = 0; + while ($i <= $l) { + if (isset($t[$i])) { + $r = $t[$i]; + } + $i++; + } + return $r; + } + + public function start($id) + { + global $u, $q, $c, $d, $code; + $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dialog` WHERE `id` = "' . mysql_real_escape_string((int)$id) . '" LIMIT 1')); + if (isset($this->info['id'])) { + $pg = 1; + $go = 1; + $txt = ''; + //Переход по страницам + if (isset($_GET['act'])) { + $ta = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `id` = "' . mysql_real_escape_string((int)$_GET['act']) . '" AND `id_dg` = "' . $this->info['id'] . '" LIMIT 1')); + if (isset($ta['id'])) { + $ta['action'] = $this->ltr($ta['action']); + $act = explode('|', $ta['action']); + $go1 = 1; + $needRep = []; + if ($ta['tr'] != '') { + $i = 0; + $x = explode('|', $ta['tr']); + while ($i < count($x)) { + //Требования + $k = explode('=', $x[$i]); + if ($k[0] == 'data') { + $date = explode('-', $k[1]); + $dd1 = $date[0]; + $mm1 = $date[1]; + $dd2 = $date[2]; + $mm2 = $date[3]; + $date1 = strtotime($dd1 . '-' . $mm1 . '-' . date('Y')); + $date2 = strtotime($dd2 . '-' . $mm2 . '-' . date('Y')); + + if ($date1 > time() || $date2 < time()) { + $go1 = 'delete'; + $i = count($x); + } + + } elseif ($k[0] == 'diact') { + //Действия + //user_id # all # all # lukaqst1 # -1 + if ($this->quest_act($k[1]) == false) { + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'quest_end') { + //Квест можно выполнять несколько раз в текущей пещере + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { + $go1 = 0; + $txt .= '
Что-то не так, Вы уже взяли данное задание...'; + $pg = $ta['page']; + } + } elseif ($k[0] == 'quest_only_one') { + //Квест можно выполнять только один раз + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) { + $go1 = 0; + $txt .= '
Что-то не так, Вы уже выполняли данное задание...'; + $pg = $ta['page']; + } + } elseif ($k[0] == 'quest_now') { + //Квест должен быть взят + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { + } else { + $go1 = 0; + $txt .= '
Что-то не так, требуется взять задание...'; + $pg = $ta['page']; + } + } elseif ($k[0] == 'tr_itm') { + //Квест требует предмет + $qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $k[1] . '" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if ($qlst[0] < $k[2]) { + $go1 = 0; + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $k[1] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + $txt .= '
Требуется предмет "' . $itmqs['name'] . '" (x' . $k[2] . ').'; + } + $pg = $ta['page']; + } + } elseif ($k[0] == 'tr_itmodet') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (!isset($qlst['id'])) { + $go1 = 0; + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $k[1] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + $txt .= '
Требуется предмет "' . $itmqs['name'] . '".'; + } + $pg = $ta['page']; + } + } elseif ($k[0] == 'tr_noitmodet') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (isset($qlst['id'])) { + $go1 = 0; + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $k[1] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + $txt .= '
У вас уже есть требуемый предмет "' . $itmqs['name'] . '".'; + } + $pg = $ta['page']; + } + } elseif ($k[0] == 'tr_noitm') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (isset($qlst['id'])) { + $go1 = 0; + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $k[1] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + $txt .= '
У вас уже есть требуемый предмет "' . $itmqs['name'] . '".'; + } + $pg = $ta['page']; + } + } elseif ($k[0] == 'del_itm') { + //Квест удаляет предмет + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $k[1] . '" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (isset($qlst['id'])) { + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $k[1] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + if (mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $qlst['id'] . '" LIMIT 1')) { + $txt .= '
Вы отдали "' . $itmqs['name'] . '"'; + } + } + $pg = $ta['page']; + } + } elseif ($k[0] == 'needRep') { + // разговор требует репутации в пещере. + $temp = explode(',', $k[1]); + $needRep = ['city' => $temp[0], 'rep' => (int)$temp[1]]; + if (isset($needRep)) { # Проверяем репутацию. + if ($u->rep['rep' . $needRep['city']] < $needRep['rep']) { + $swapActStatus = 0; + $go1 = 0; + $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; + $pg = $ta['page']; + } + } + } + $i++; + } + } + if (isset($act[1]) && $go1 == 1) { + $act1 = explode('=', $act[1]); + $act0 = explode('=', $act[0]); + if ($act0[0] == 'fileqst') { + if (file_exists('_incl_data/class/quest/' . htmlspecialchars($act0[1]) . '.php')) { + require_once('_incl_data/class/quest/' . htmlspecialchars($act0[1]) . '.php'); + } else { + $txt .= '
Квест не найден в списках NPS...'; + } + $pg = $act[1]; + } elseif ($act[0] == 'dialog_act_update') { + $act33 = $this->dialog_act_update($act[2]); + if ($act33[0] == false) { + if ($act33[1] == '') { + $txt .= '
Что-то пошло не так...'; + } else { + $txt .= '
' . $act33[1] . ''; + } + } else { + $txt .= '
' . $act33[1] . ''; + } + $pg = $act[1]; + } elseif ($act[0] == 'quest_act') { + $txt .= '
Вы получили новое задание.'; + mysql_query('INSERT INTO `dialog_act` ( + `uid`,`city`,`time`,`var`,`val`,`btl_bot`,`itms`,`now`,`max`,`info` + ) VALUES ( + "' . $u->info['id'] . '","' . $u->info['city'] . '","' . time() . '","' . mysql_real_escape_string($act1[0]) . '","' . mysql_real_escape_string($act1[1]) . '" + ,"' . mysql_real_escape_string($act1[3]) . '","' . mysql_real_escape_string($act1[4]) . '","' . mysql_real_escape_string($act1[5]) . '","' . mysql_real_escape_string($act1[6]) . '","' . mysql_real_escape_string($act1[7]) . '" + )'); + $pg = $act1[2]; + if ($act1[8] != 0) { + //Выдаем предмет для квеста + $itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $act1[8] . '" LIMIT 1')); + if (isset($itmb['id'])) { + $u->addItem($act1[8], $u->info['id'], '|nodelete=1'); + $txt .= '
Вы получили предмет "' . $itmb['name'] . '"'; + } + } + } elseif ($act[0] == 'buyitm') { + $itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $act1[0] . '" LIMIT 1')); + if (isset($itmb['id'])) { + if ($u->info['money'] < $act1[1]) { + $txt .= '
Вам не хватает денег для покупки "' . $itmb['name'] . '", требуется ' . $act1[1] . ' кр.'; + } else { + $act1dt = ''; + $txt .= '
Вы успешно приобрели "' . $itmb['name'] . '"'; + if ($act1[1] > 0) { + $txt .= ' за ' . $act1[1] . ' кр.'; + $u->info['money'] -= $act1[1]; + mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + if ($act1[2] > 0) { + $txt .= ' за ' . $act1[2] . ' екр.'; + } + if ($act1[3] > 0) { + $txt .= ' на срок ' . $u->timeOut($act1[3]) . ''; + $act1dt .= '|srok=' . $act1[3] . ''; + } + $txt .= ''; + + $u->addItem($itmb['id'], $u->info['id'], $act1dt); + $pg = $act1[4]; + } + } else { + $txt .= '
Неудалось приобрести предмет...'; + $pg = 1; + } + } elseif ($act1[0] == 'quest') { + $pg = $act1[1]; + $act2 = explode('=', $act[1]); + if ($act2[0] > 0 && $q->testGood($act2[0]) == 1) { + //выдаем квест + if ($act2[1] != '0') { + //Выдача предмета + $ic1 = 0; + $act21 = explode(',', $act2[1]); + while ($ic1 < count($act21)) { + $act3 = explode('-', $act21[$ic1]); + $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $act3[0] . '" LIMIT 1')); + if (isset($itmqs['id'])) { + if ($act3[2] > 1) { + //несколько + $txt .= '
Вы получили предмет "' . $itmqs['name'] . '" (x' . $act3[2] . ' шт.).'; + } else { + //один + $txt .= '
Вы получили квестовый предмет "' . $itmqs['name'] . '".'; + } + $ic2 = 1; + while ($ic2 <= $act3[2]) { + $u->addItem($itmqs['id'], $u->info['id'], '|quest_item=1', ['del' => $act3[3]]); + $ic2++; + } + } + $ic1++; + } + } + $q->startq($act2[0]); + $txt .= '
' . $u->error . '.'; + $u->error = ''; + } else { + $txt .= '
Не удалось получить задание, не соответствуют условия получения...'; + } + } elseif ($act[0] == 'go' && $go1 == 1) { + $pg = $act[1]; + } elseif ($act[0] == 'atackbot' && $go1 == 1) { + //Нападение на монстра + if (round((int)$act[1]) > 0) { + $btl_id = 0; + //$expB = -77.77; + $expB = 0; + $btl = ['players' => '', 'timeout' => 180, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; + + $ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( + "' . $d->info['id2'] . '", + "' . $d->info['id'] . '", + "' . $u->info['x'] . '", + "' . $u->info['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(); + + if ($btl_id > 0) { + //Добавляем ботов + $k = $u->addNewbot(round((int)$act[1]), null, null, []); + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `x`="' . $u->info['x'] . '",`y`="' . $u->info['y'] . '",`team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + + } + header('location: main.php'); + } else { + echo 'Поединок почему-то не начался...'; + } + die(); + } elseif ($act[0] == 'goroom' && $go1 == 1) { + $u->info['room'] = $act[1]; + mysql_query('UPDATE `users` SET `room` = "' . $u->info['room'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + header('location: main.php'); + die(); + } elseif ($act[0] == 'transfer2' && $go1 == 1) { + //Обменник тыквоголового + $txt = ''; + + $xtik = 0; //Требуется тыкв + + if ($act[1] == 1 && true == false) { + $txt .= 'Обмен 1...'; + $xtik = 10; + $itik = 4465; + + } elseif ($act[1] == 2) { + $txt .= 'Обмен 2...'; + $xtik = 15; + $itik = 2143; + + } elseif ($act[1] == 3) { + $txt .= 'Обмен 3...'; + $xtik = 15; + $itik = 2144; + + } elseif ($act[1] == 4 && true == false) { + $txt .= 'Обмен 4...'; + $xtik = 6; + //арт воина + $itik = -1; + + } elseif ($act[1] == 5 && true == false) { + $txt .= 'Обмен 5...'; + $xtik = 6; + //арт мага + $itik = -2; + + } elseif ($act[1] == 6) { + $txt .= 'Обмен 6...'; + $xtik = 50; + //значок 1 + $itik = -3; + + } elseif ($act[1] == 7) { + $txt .= 'Обмен 7...'; + $xtik = 70; + //значок 2 + $itik = -4; + + } else { + $txt .= 'Тыквоголовый не меняет этот хлам...'; + } + + $txt = 'Обменник начнет свою работу 3 ноября'; + + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + + $t = $this->trnObj($itms[4504], $xtik); + if ($t[0] > 0) { + // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды + //удаляем ингридиенты + + $gdtik = 1; + + if ($gdtik == 1) { + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" ORDER BY `inGroup` ASC LIMIT ' . $xtik . ''); + //echo 'UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.$t[0].''; + if ($upd) { + if ($itik > 0) { + //Выдаем предметы + $u->addItem($itik, $u->info['id'], '|nosale=1|srok=' . (7 * 86400) . '', null, 1); + $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itik . '" LIMIT 1')); + $txt = 'Вы получили предмет "' . $itm_nm['name'] . '"'; + } else { + //Что-то уникальное + if ($itik == -1) { + //Артефакт воин + $arts_1 = []; + $arts_lvl = $u->info['level']; + if ($arts_lvl < 4) { + $arts_lvl = 4; + } elseif ($arts_lvl > 10) { + $arts_lvl = 10; + } + $sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl=' . $arts_lvl . '%" AND `data` NOT LIKE "%|tr_s5=%" AND `data` NOT LIKE "%|add_s6=%" AND `data` NOT LIKE "%|tr_s6=%"'); + while ($pl1 = mysql_fetch_array($sp1)) { + $arts_1[] = $pl1['items_id']; + } + $arts_1 = $arts_1[rand(0, count($arts_1) - 1)]; + if ($arts_1 > 0) { + $u->addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100); + } + $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $arts_1 . '" LIMIT 1')); + + $txt = 'Вы получили артефакт для воина "' . $itm_nm['name'] . '" на срок 12 часов.'; + } elseif ($itik == -2) { + //Артефакт мага + $arts_1 = []; + $arts_lvl = $u->info['level']; + if ($arts_lvl < 4) { + $arts_lvl = 4; + } elseif ($arts_lvl > 10) { + $arts_lvl = 10; + } + $sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl=' . $arts_lvl . '%" AND ( `data` LIKE "%|tr_s6=%" OR `data` LIKE "%|add_s6=%")'); + while ($pl1 = mysql_fetch_array($sp1)) { + $arts_1[] = $pl1['items_id']; + } + $arts_1 = $arts_1[rand(0, count($arts_1) - 1)]; + if ($arts_1 > 0) { + $u->addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100); + } + $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $arts_1 . '" LIMIT 1')); + + $txt = 'Вы получили артефакт для мага "' . $itm_nm['name'] . '" на срок 12 часов.'; + } elseif ($itik == -3) { + //Значок +1 + mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . $u->info['id'] . '" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")'); + mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "Хэллоуин`' . date('Y') . '
Обыкновенный собиратель тыкв!", + "helloween_2014m1.gif", + "' . (time() + 86400 * 365) . '", + "add_m10=15|add_m11=15", + "1", + "1" + )'); + $txt = 'Вы получили значок "Хэллоуин`' . date('Y') . ' Обыкновенный"'; + } elseif ($itik == -4) { + //Значок +5 + mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . $u->info['id'] . '" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")'); + mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "Хэллоуин`' . date('Y') . '
Лучший собиратель тыкв!", + "helloween_2014m2.gif", + "' . (time() + 86400 * 365) . '", + "add_m10=15|add_m11=15", + "1", + "1" + )'); + $txt = 'Вы получили значок "Хэллоуин`' . date('Y') . ' Лучший"'; + } + } + } + } else { + $txt = 'Неудалось совершить обмен...'; + } + } else { + $txt = 'Недостаточно тыкв для обмена...'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + $pg = 3; + } elseif ($act[0] == 'transfer1' && $go1 == 1) { + //Меняем гайки и прочий мусор из канализации на жетоны + //ИХ больше у тебя нету... Неси еще, Луке нужно больше ИХ! + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1002" OR `item_id` = "1003" OR `item_id` = "1004" OR `item_id` = "1005" OR (`item_id` >= "1009" AND`item_id` <= "1014")) AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + //Предметы + $cn = [0 => 3, //кол-во классификаций + 1 => [//гайка + 1 => ['n' => 'Гайка', 0 => 1002, 1 => 3, 7 => 9, 8 => 15], //болт + 2 => ['n' => 'Болт', 0 => 1003, 1 => 1, 7 => 3, 8 => 5], //вентиль + 3 => ['n' => 'Вентиль', 0 => 1005, 1 => (1 / 3), 7 => 1, 8 => 2], 'add' => [0 => 1006, 1 => 'Жетон'] //предмет вознаграждения, бронзовый жетон + ], //бронза + 2 => [//гайка + 1 => ['n' => 'Чистая гайка', 0 => 1009, 1 => 3, 7 => 9, 8 => 15], //болт + 2 => ['n' => 'Длинный Болт', 0 => 1010, 1 => 1, 7 => 3, 8 => 5], //вентиль + 3 => ['n' => 'Чистый вентиль', 0 => 1011, 1 => (1 / 3), 7 => 1, 8 => 2], 'add' => [0 => 1007, 1 => 'Серебряный жетон'] //предмет вознаграждения, бронзовый жетон + ], //серебро + 3 => [//гайка + 1 => ['n' => 'Гайка с Резьбой', 0 => 1012, 1 => 3, 7 => 9, 8 => 15], //болт + 2 => ['n' => 'Нужный болт', 0 => 1013, 1 => 1, 7 => 3, 8 => 5], //вентиль + 3 => ['n' => 'Рабочий вентиль', 0 => 1014, 1 => (1 / 3), 7 => 1, 8 => 2], 'add' => [0 => 1008, 1 => 'Золотой жетон'] //предмет вознаграждения, бронзовый жетон + ] //золото + ]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j < count($cn[$i][$j])) { + + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], $u->info['level'])); + if ($t[0] > 0) { + // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды + //удаляем ингридиенты + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i]['add'][0], $u->info['id'], $data); + $e++; + } + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '
'; + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + } + $j++; + } + $i++; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + } elseif ($act[0] == 'transfer3' && $go1 == 1) { + //ИХ больше у тебя нету... Неси еще, Луке нужно больше ИХ! + //Серебро на золото, 3 к 1 + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "1007" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + //Предметы + $cn = [0 => 1, //кол-во классификаций + 1 => [//гайка + 1 => ['n' => 'Серебряный жетон', 0 => 1007, 1 => 3, 7 => 3, 8 => 3], 'add' => [0 => 1008, 1 => 'Золотой жетон'] //предмет вознаграждения, бронзовый жетон + ]]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j < count($cn[$i][$j])) { + + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], $u->info['level'])); + if ($t[0] > 0) { + // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды + //удаляем ингридиенты + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i]['add'][0], $u->info['id'], $data); + $e++; + } + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '
'; + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + } + $j++; + } + $i++; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + } elseif ($act[0] == 'transfer4' && $go1 == 1) { + //ИХ больше у тебя нету... Неси еще, мне нужно больше ИХ! + //Засоры к золоту, 20 к 1 + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "4728" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + //Предметы + $cn = [0 => 1, //кол-во классификаций + 1 => [//гайка + 1 => ['n' => 'Засоры', 0 => 4728, 1 => 20, 7 => 20, 8 => 20], 'add' => [0 => 1008, 1 => 'Золотой жетон'] //предмет вознаграждения, бронзовый жетон + ]]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j < count($cn[$i][$j])) { + + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], $u->info['level'])); + if ($t[0] > 0) { + // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды + //удаляем ингридиенты + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i]['add'][0], $u->info['id'], $data); + $e++; + } + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '
'; + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + } + $j++; + } + $i++; + } + + if ($txt == '') { + $txt = 'Необходимо минимум 20 засоров для обмена.'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + } elseif ($act[0] == 'transferSpells30' && $go1 == 1) { + + //2553 2554 + + $keypr1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = "2553" LIMIT 1')); + $keypr2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = "2554" LIMIT 1')); + + $txt = ''; + + if (isset($keypr1['id'], $keypr2['id'])) { + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr1['id'] . '" OR `id` = "' . $keypr2['id'] . '" LIMIT 2'); + $data = '|frompisher=' . $d->info['id2']; + $u->addItem(2555, $u->info['id'], $data); + $txt = 'Вы успешно получили "Пирамидальный ключ"'; + } + + if ($txt == '') { + $txt = 'Необходимо принести два разных осколка...'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + + } elseif ($act[0] == 'transferSpells31' && $go1 == 1) { + + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "2560" OR `item_id` = "2564" OR `item_id` = "2568" OR `item_id` = "2572" OR `item_id` = "2576") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + + $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); + if (!isset($keypr['id'])) { + $itms = []; + $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; + } + + //Предметы + $cn = [0 => 5, //кол-во классификаций + 1 => [1 => ['n' => 'Зачаровать Украшение [0]', 0 => 2560, 8 => 3, 'add' => [2561, 'Зачаровать Украшение [1]']], 2 => ['n' => 'Зачаровать Оружие [0]', 0 => 2564, 8 => 3, 'add' => [2565, 'Зачаровать Оружие [1]']], 3 => ['n' => 'Зачаровать Броню [0]', 0 => 2568, 8 => 3, 'add' => [2569, 'Зачаровать Броню [1]']], 4 => ['n' => 'Зачаровать Перчатки [0]', 0 => 2572, 8 => 3, 'add' => [2573, 'Зачаровать Перчатки [1]']], 5 => ['n' => 'Зачаровать Шлем [0]', 0 => 2576, 8 => 3, 'add' => [2577, 'Зачаровать Шлем [1]']]]]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j <= $cn[0]) { + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], 8)); + if ($t[0] > 0) { + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data); + $e++; + } + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr['id'] . '" LIMIT 1'); + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i][$j]['add'][1] . ' x' . $t[0] . '
'; + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + $i = $cn[0]; + $j = count($cn[$i][$j]); + } + $j++; + } + $i++; + } + + if ($txt == '') { + $txt = 'У вас не хватило необходимых предметов...'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + + } elseif ($act[0] == 'transferSpells32' && $go1 == 1) { + + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "2561" OR `item_id` = "2565" OR `item_id` = "2569" OR `item_id` = "2573" OR `item_id` = "2577") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + + $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); + if (!isset($keypr['id'])) { + $itms = []; + $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; + } + + //Предметы + $cn = [0 => 5, //кол-во классификаций + 1 => [1 => ['n' => 'Зачаровать Украшение [1]', 0 => 2561, 8 => 3, 'add' => [2562, 'Зачаровать Украшение [2]']], 2 => ['n' => 'Зачаровать Оружие [1]', 0 => 2565, 8 => 3, 'add' => [2566, 'Зачаровать Оружие [2]']], 3 => ['n' => 'Зачаровать Броню [1]', 0 => 2569, 8 => 3, 'add' => [2570, 'Зачаровать Броню [2]']], 4 => ['n' => 'Зачаровать Перчатки [0]', 0 => 2573, 8 => 3, 'add' => [2574, 'Зачаровать Перчатки [2]']], 5 => ['n' => 'Зачаровать Шлем [1]', 0 => 2577, 8 => 3, 'add' => [2578, 'Зачаровать Шлем [2]']]]]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j <= $cn[0]) { + + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], 8)); + if ($t[0] > 0) { + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data); + $e++; + } + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr['id'] . '" LIMIT 1'); + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i][$j]['add'][1] . ' x' . $t[0] . '
'; + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + $i = $cn[0]; + $j = count($cn[$i][$j]); + } + $j++; + } + $i++; + } + + if ($txt == '') { + $txt = 'У вас не хватило необходимых предметов...'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + + } elseif ($act[0] == 'transferSpells33' && $go1 == 1) { + + $pg = $act[1]; + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "2562" OR `item_id` = "2566" OR `item_id` = "2570" OR `item_id` = "2574" OR `item_id` = "2578") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + + $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); + if (!isset($keypr['id'])) { + $itms = []; + $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; + } + + //Предметы + $cn = [0 => 5, //кол-во классификаций + 1 => [1 => ['n' => 'Зачаровать Украшение [0]', 0 => 2562, 8 => 3, 'add' => [2563, 'Зачаровать Украшение [3]']], 2 => ['n' => 'Зачаровать Оружие [0]', 0 => 2566, 8 => 3, 'add' => [2567, 'Зачаровать Оружие [3]']], 3 => ['n' => 'Зачаровать Броню [0]', 0 => 2570, 8 => 3, 'add' => [2571, 'Зачаровать Броню [3]']], 4 => ['n' => 'Зачаровать Перчатки [0]', 0 => 2574, 8 => 3, 'add' => [2575, 'Зачаровать Перчатки [3]']], 5 => ['n' => 'Зачаровать Шлем [0]', 0 => 2578, 8 => 3, 'add' => [2579, 'Зачаровать Шлем [3]']]]]; + + $i = 1; + while ($i <= $cn[0]) { + $j = 1; + while ($j <= $cn[0]) { + + $t = $cn[$i][$j]; + $t = $this->trnObj($itms[$cn[$i][$j][0]], $this->objLevel($cn[$i][$j], 8)); + if ($t[0] > 0) { + $upd = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $cn[$i][$j][0] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT ' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ''); + if ($upd) { + $data = '|frompisher=' . $d->info['id2']; + $e = 1; + while ($e <= $t[0]) { + $u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data); + $e++; + } + $txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i][$j]['add'][1] . ' x' . $t[0] . '
'; + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr['id'] . '" LIMIT 1'); + } else { + $txt .= 'Не удалось обменять предмет "' . $cn[$i][$j]['n'] . '", что-то не так ...
'; + } + $i = $cn[0]; + $j = count($cn[$i][$j]); + } + $j++; + } + $i++; + } + + if ($txt == '') { + $txt = 'У вас не хватило необходимых предметов...'; + } + + if ($txt != '') { + $txt = '
' . $txt . ''; + } + + } elseif ($act[0] == 'GoHrumpShop' && $go1 == 1) { //отправляемся в магазин Рульфа Хрумпта (пещеры мглы) + mysql_query('UPDATE `stats` SET `x` = "6",`y` = "73" WHERE `id` = "' . $u->info['id'] . '" AND `dnow` = "' . $u->info['dnow'] . '" LIMIT 1'); + header('location: main.php'); + die(); + } elseif ($act[0] == 'swapItem' && $go1 == 1) { + $txt = ''; + $swapItem = $act[1]; + $swapError = $act[2]; + $swapTrue = $act[3]; + # Обмениваем предметы у Забытого (Мастерская Забытых) + if (!isset($swapActStatus)) $swapActStatus = 1; # Все окей, проблем нет! + $swapAct = []; # Собираем данные об обмене. + $temp = explode("\\", $swapItem); + foreach ($temp as $t) { + $t = explode('=', $t); + if ($t[0] == 'tr') { // Нужны для обмена + $temp2 = explode(',', $t[1]); + $tr_items = []; + foreach ($temp2 as $t2) { + $temp3 = explode('x', $t2); + if (!isset($temp3[1])) $temp3[1] = 1; // Если количество не задано, задаем 1ед. + if (isset($temp3[2]) && $temp3[2] == 'del') $temp3[2] = true; else $temp3[2] = false; // Удаляем даже при неудачной попытке совершить обмен! + $tr_items[] = ['item_id' => $temp3[0], 'colvo' => (int)$temp3[1], 'delete' => $temp3[2]]; + } + $swapAct['tr'] = $tr_items; + + } elseif ($t[0] == 'needQuest') { // Если нужен какой-то квест для приобретения. + + } elseif ($t[0] == 'needRep') { // Если нужна репутация в подземельи + $temp2 = explode(',', $t[1]); + $need_rep = []; + $need_rep[] = ['city' => $temp2[0], 'rep' => (int)$temp2[1]]; + + $swapAct['need_rep'] = $need_rep; + + } elseif ($t[0] == 'add') { // Какие предметы даем. + $temp2 = explode(',', $t[1]); + $add_items = []; + foreach ($temp2 as $t2) { + $temp3 = explode('x', $t2); + if (!isset($temp3[1])) $temp3[1] = 1; // Если количество не задано, задаем 1ед. + $add_items[] = ['item_id' => $temp3[0], 'colvo' => (int)$temp3[1]]; + } + $swapAct['add'] = $add_items; + } elseif ($t[0] == 'uses') { // Если нужна репутация в подземельи + $swapAct['uses'] = $t[1]; + } + } // Цикл обработки данных разговора. + unset($temp, $temp2, $temp3, $t2, $tr_items, $add_items); + + if ($swapActStatus == 0) { + $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; + $pg = $swapError; + } elseif (isset($swapAct['need_rep'])) { # Проверяем репутацию. + foreach ($swapAct['need_rep'] as $rep) { # Если несколько репутаций + if ($u->rep['rep' . $rep['city']] < $rep['rep']) { + $swapActStatus = 0; + $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; + $pg = $swapError; + } + } + } + + if (isset($swapAct['uses'])) { # Проверяем количество раз использований. + #$swapAct['uses'] = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `room` = "'.$u->info['room'].'" AND `vals` = "masteryUses'.$u->info['dnow'].'" ORDER BY `id` DESC LIMIT '.$swapAct['uses'] .'')); + if (isset($swapAct['uses']['id'])) { + $swapActStatus = 0; + $txt = 'Кто-то уже побывал здесь и испортил кузницу, ничего не получится...'; + $pg = 0; + } + } + + if (isset($swapAct['tr']) and $swapActStatus == 1) { # Проверяем необходимые предметы. + foreach ($swapAct['tr'] as $item) { # Если несколько предметов. + $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $item['item_id'] . '" LIMIT 1')); + if (isset($item_info['id'])) { + $query = mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "' . $item['item_id'] . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . $item['colvo'] . ''); + $j = 0; + while ($t = mysql_fetch_array($query)) { + $j++; + } + if ($j < $item['colvo']) { + $txt .= 'У вас недостаточно предметов "' . $item_info['name'] . '"! (' . $item['item_id'] . ')
'; + $swapActStatus = 3; + $pg = $swapError; + } elseif ($swapActStatus != 3) { + $swapActStatus = 2; + } + } + } + } + + if (isset($swapAct['tr']) and $swapActStatus == 3) { # Забираем предметы del==true. + $mess = 'Израсходованы ресурсы: '; + $qsw = 0; + foreach ($swapAct['tr'] as $item) { # Если несколько предметов. + if ($item['delete'] == true) { + $query = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `item_id` = "' . $item['item_id'] . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT ' . $item['colvo'] . ''); + if ($query) { + $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $item['item_id'] . '" LIMIT 1')); + if ($qsw > 0) $mess .= ', '; + $mess .= '"' . $item_info['name'] . '"'; + if ($item['colvo'] > 1) $mess .= '(' . $item['item_id'] . 'шт)'; + $qsw++; + } + } + } + $mess .= '.
'; + if ($qsw > 0) $txt .= $mess; + } elseif (isset($swapAct['tr']) and $swapActStatus == 2) { # Забираем предметы все. + $mess = 'Израсходованы ресурсы: '; + $qsw = 0; + foreach ($swapAct['tr'] as $item) { + $query = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `item_id` = "' . $item['item_id'] . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT ' . $item['colvo'] . ''); + if ($query) { + $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $item['item_id'] . '" LIMIT 1')); + if ($qsw > 0) $mess .= ', '; + $mess .= '"' . $item_info['name'] . '"'; + if ($item['colvo'] > 1) $mess .= '(' . $item['item_id'] . 'шт)'; + $qsw++; + } + } + $mess .= '.
'; + if ($qsw > 0) $txt .= $mess; + } + + if (isset($swapAct['add']) and $swapActStatus == 2) { # Выдаем предметы. + foreach ($swapAct['add'] as $item) { + $qsw = 0; + while ($qsw < $item['colvo']) { + $txt .= '
Вы получили предмет'; + $u->addItem($item['item_id'], $u->info['id']); + $qsw++; + } + } + + mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $u->info['city'] . '","' . $u->info['room'] . '", "","' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "masteryUses' . $u->info['dnow'] . '")'); + $pg = $swapTrue; + } + if ($txt != '') { + $txt = '
' . $txt . ''; + } + } + } + } + } + + if ($this->info['tr_room'] != 0 && $this->info['tr_room'] != $u->info['room']) { + $go = 0; + } + + if ($this->info['tr_dn'] != 0) { + //требует пещеру + global $d; + if ($this->info['tr_dn'] != $d->info['id2']) { + $go = 0; + } elseif ($this->info['x'] != 0 || $this->info['y'] != 0) { + if ($d->testLike($u->info['x'], $u->info['y'], $this->info['x'], $this->info['y']) != 1) { + $go = 0; + } + //если бот погиб + $dbot = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1')); + if (!isset($dbot['id2'])) { + $go = 0; + } + } + } + + if ($go == 1) { + //dlg_nps:=:3=7 + //квест (с наградой) + $qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:' . $this->info['id'] . '=' . $pg . '=1=e%" LIMIT 1'); + while ($qs_pl = mysql_fetch_array($qs_sp)) { + $q->endq($qs_pl['id'], 'win'); + $gsex = explode('=e' . $this->info['id'] . $pg . '=', $qs_pl['act_date']); + if ($gsex[1] > 0) { + //выдаем добавочный квест + $q->startq($gsex[1]); + $txt .= '
Задание изменилось'; + } + } + + //квест (без наградой) + $qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:' . $this->info['id'] . '=' . $pg . '=0=e%" LIMIT 1'); + while ($qs_pl = mysql_fetch_array($qs_sp)) { + $q->endq($qs_pl['id'], 'end'); + $gsex = explode('=e' . $this->info['id'] . $pg . '=', $qs_pl['act_date']); + if ($gsex[1] > 0) { + //выдаем добавочный квест $gsex[1] + $q->startq($gsex[1]); + $txt .= '
Задание изменилось'; + } + } + + $this->title = $this->info['text']; + $this->youInfo = $u->getInfoPers($u->info['id'], 1); + $this->youInfo = $this->youInfo[0]; + $this->botInfo = $this->infoBot($this->info['bot_id']); + //Диалог + $qpl = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "1" AND `qid` = "0" AND `id_dg` = "' . $this->info['id'] . '" AND `page` = "' . ((int)$pg) . '" LIMIT 1')); + if (!isset($qpl['id'])) { + if ($txt == '') { + $qpl['text'] = 'Диалог не найден ...'; + } else { + $qpl['text'] = $txt . ' (уйти)'; + $txt = ''; + } + } else { + $this->pg = $qpl['id']; + } + + if ($u->info['admin'] > 0) { + if (isset($_GET['add_new_qid'])) { + mysql_query('INSERT INTO `dungeon_dlg` (`type`,`qid`,`id_dg`,`text`) VALUES ("0","' . $qpl['id'] . '","' . $this->info['id'] . '","Новый вариант ответа")'); + } + } + + //Варианты ответа + $a = ''; + $sp = mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `qid` = "' . $qpl['id'] . '" AND `id_dg` = "' . $this->info['id'] . '" ORDER BY `sort` DESC LIMIT 25'); + while ($pl = mysql_fetch_array($sp)) { + $pl['action'] = $this->ltr($pl['action']); + $act = explode('|', $pl['action']); + if (isset($act[1])) { + $pl['action'] = 'main.php?talk=' . $this->info['id'] . '&act=' . $pl['id'] . '&rnd=' . $code; + } + $go1 = ''; + if ($pl['tr'] != '') { + $i = 0; + $x = explode('|', $pl['tr']); + while ($i < count($x)) { + //Требования + $k = explode('=', $x[$i]); + if ($k[0] == 'data') { + $date = explode('-', $k[1]); + $dd1 = $date[0]; + $mm1 = $date[1]; + $dd2 = $date[2]; + $mm2 = $date[3]; + $date1 = strtotime($dd1 . '-' . $mm1 . '-' . date('Y')); + $date2 = strtotime($dd2 . '-' . $mm2 . '-' . date('Y')); + + if ($date1 > time() || $date2 < time()) { + $go1 = 'delete'; + $i = count($x); + } + + } elseif ($k[0] == 'diact') { + //Действия + //user_id # all # all # lukaqst1 # -1 + if ($this->quest_act($k[1]) == false) { + $go1 = 'delete'; + $i = count($x); + } + + } elseif ($k[0] == 'quest_end') { + //Квест можно выполнять несколько раз в текущей пещере + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { + //$go1 .= "Вы уже взяли данное задание\n"; + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'quest_only_one') { + //Квест можно выполнять только один раз + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) { + //$go1 .= "Вы уже взяли данное задание\n"; + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'quest_now') { + //Квест должен быть взят + $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $k[1] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { + } else { + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'tr_itm') { + //Квест требует предмет + $qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . $k[1] . '" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if ($qlst[0] < $k[2]) { + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'tr_itmodet') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (!isset($qlst['id'])) { + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'tr_noitmodet') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inTransfer` = 0 AND `inOdet` > 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (isset($qlst['id'])) { + $go1 = 'delete'; + $i = count($x); + } + } elseif ($k[0] == 'tr_noitm') { + //Квест требует предмет + $k[1] = str_replace(',', '" OR `item_id` = "', $k[1]); + $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "' . $k[1] . '") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); + if (isset($qlst['id'])) { + $go1 = 'delete'; + $i = count($x); + } + } + $i++; + } + } + if ($u->info['admin'] > 0) { + $a .= '(ред.)   '; + } + if ($go1 == '') { + $a .= '• ' . $pl['text'] . '
'; + } elseif ($go1 == 'delete') { + if ($u->info['admin'] > 0) { + $a .= '• ' . $pl['text'] . '
'; + } + } else { + $a .= '' . $pl['text'] . ' [?]
'; + } + } + + + if ($u->info['admin'] > 0) { + $a .= 'Добавить вариант ответа'; + } + + $this->dText = $qpl['text'] . '
' . $txt; + $this->aText = $a; + } else { + $this->aText = '
Диалог не доступен, вернуться назад
'; + } + } else { + $this->aText = '
Диалог не найден, вернуться назад
' . ((int)$id) . '
'; + } + } + + public function dialog_act_update($data) + { + global $u; + $r = [false, '']; + $x = explode('#', $data); + $i = 0; + while ($i < count($x)) { + $k = explode('=', $x[$i]); + $var = $k[0]; + $val = $k[1]; + if ($var == 'take_item') { + //Забираем предмет + $itms = []; + $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "' . mysql_real_escape_string($val) . '" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100'); + while ($pl = mysql_fetch_array($sp)) { + $itms[$pl['item_id']]++; + } + + if ($itms[$val] >= $k[2]) { + //$u->deleteItemID($val,$u->info['id'],$k[2]); + + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `item_id` = "' . mysql_real_escape_string($val) . '" AND `uid` = "' . $u->info['id'] . '" AND `inShop` = 0 AND `inTransfer` = 0 AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = 0 LIMIT ' . round($k[2])); + } else { + $i = count($x); + $r[0] = false; + $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $val . '" LIMIT 1')); + $r[1] = 'У вас нет нужного предмета! Требуется "' . $itm['name'] . '"'; + if ($k[2] > 1) { + $r[1] .= ' (' . $k[2] . ' шт.)'; + } + } + // + } elseif ($var == 'add_item') { + $data_itm = '|frompisher=1'; + $i1 = 0; + while ($i1 < $k[2]) { + if ($val == 4797) { + //Повестка + if ($u->info['level'] >= 4 && $u->info['level'] <= 7) { + $val = 4797; + } elseif ($u->info['level'] >= 8 && $u->info['level'] <= 9) { + $val = 4798; + } else { + $val = 4799; + } + } + $u->addItem($val, $u->info['id'], $data_itm); + $i1++; + } + } elseif ($var == 'up') { + $tqst = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `var` = "' . mysql_real_escape_string($val) . '" ORDER BY `id` DESC LIMIT 1')); + if (!isset($tqst['id'])) { + mysql_query('INSERT INTO `dialog_act` ( + `uid`,`city`,`time`,`var`,`val` + ) VALUES ( + "' . $u->info['id'] . '","' . $u->info['city'] . '","' . time() . '","' . mysql_real_escape_string($val) . '","' . mysql_real_escape_string($k[2]) . '" + )'); + } else { + mysql_query('UPDATE `dialog_act` SET `val` = "' . mysql_real_escape_string($k[2]) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `var` = "' . mysql_real_escape_string($val) . '" ORDER BY `id` DESC LIMIT 1'); + } + } elseif ($var == 'finish') { + $r[0] = true; + $r[1] = $val; + } + $i++; + } + return $r; + } + + public function quest_act($data) + { + global $u; + $r = true; + $f = explode('#', $data); + $ql = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `var` = "' . mysql_real_escape_string($f[3]) . '" AND `uid` = "' . $u->info['id'] . '" ORDER BY `id` DESC LIMIT 1')); + if (isset($ql['id'])) { + //user_id # all # all # lukaqst1 # -1 + if ($f[0] == 'user_id') { + $f[0] = $u->info['id']; + } + // + if ( + $f[0] != $ql['uid'] && $f[0] != 'all' || + $f[1] != $ql['city'] && $f[1] != 'all' || + $f[2] != $ql['time'] && $f[2] != 'all' || + $f[3] != $ql['var'] && $f[3] != 'all' || + $f[4] == -1 || + $f[4] != $ql['val'] || + $f[5] == 1 && $ql['now'] < $ql['max'] + ) { + $r = false; + } + } elseif ($f[4] != -1) { + $r = false; + } + return $r; + } + + public function ltr($v) + { + return $v; + } + + public function infoBot($id) + { + global $c, $code; + $r = ''; + $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . ((int)$id) . '" LIMIT 1')); + if (isset($bot['id'])) { + //Характеристики от предметов и их изображение + $witm = []; + $witm[1] = ''; + $witm[2] = ''; + $witm[3] = ''; + $witm[4] = ''; + $witm[7] = ''; + $witm[8] = ''; + $witm[9] = ''; + $witm[10] = ''; + $witm[11] = ''; + $witm[12] = ''; + $witm[13] = ''; + $witm[14] = ''; + $witm[16] = ''; + $witm[17] = ''; + //40-52 слот под магию + $witm[53] = ''; + $witm[54] = ''; + $witm[55] = ''; + $witm[56] = ''; + $witm[57] = ''; + $witm[58] = ''; + + $pb = ''; + $hpmp = '?? '; + $eff = ''; + $anml = ''; + $oi = ''; + $msl = ''; + $witmg = ''; + + if ($bot['level'] < 0) { + $bot['level'] = '??'; + } + + $r = '
' . $bot['login'] . ' [' . $bot['level'] . ']
+
+
' . $pb . '
+ + + + + + +
+ + + + + + + + + + + + + + + + +
' . $witm[1] . '
' . $witm[2] . '
' . $witm[3] . '
' . $witm[4] . '
' . $witm[7] . '
+
+ + + + + + + + + + +
+ + ' . $hpmp . ' + +
+
+ +
+
' . $eff . '
' . $anml . ' +
+
' . $msl . '
+
+ + + + + + + + + + + + + + + + + + + + + + +
' . $witm[8] . '
' . $witm[9] . '
+ + + + + +
' . $witm[10] . '' . $witm[11] . '' . $witm[12] . '
' . $witm[13] . '
' . $witm[14] . '
' . $witm[16] . '
' . $witm[17] . '
+
' . $witmg . ' +
'; + } else { + $r = 'No information'; + } + return $r; + } +} + diff --git a/_incl_data/class/Dungeon.php b/_incl_data/class/Dungeon.php new file mode 100644 index 00000000..7d9dbfa6 --- /dev/null +++ b/_incl_data/class/Dungeon.php @@ -0,0 +1,1813 @@ + []]; //карта + private $cord = ['x' => 0]; + private $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() + { + global $u, $c, $code; + $this->info = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1')); + $this->id_dng = $this->info['id2']; + $this->gs = $u->info['s']; + if ($this->gs < 1 || $this->gs > 4) { + $this->gs = 1; + } + + if ($this->info['bsid'] > 0) { + $this->bs = mysql_fetch_assoc(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "' . $u->info['city'] . '" AND `id` = "' . $this->info['bsid'] . '" AND `time_start` = "' . $this->info['time_start'] . '" LIMIT 1')); + } + + if (isset($_GET['itm_luck']) && $this->info['bsid'] == 0) { + $this->itm_luck((int)$_GET['itm_luck']); + } elseif (isset($_GET['itm_unluck']) && $this->info['bsid'] == 0) { + $this->itm_unluck((int)$_GET['itm_unluck']); + } elseif (isset($_GET['atack'])) { + $this->atack((int)$_GET['atack']); + } elseif (isset($_GET['take'])) { + $this->takeinv((int)$_GET['take']); + } elseif (isset($_GET['take_obj'])) { + $this->takeit((int)$_GET['take_obj']); + } elseif (isset($_GET['look'])) { + if ((int)$_GET['look'] == 1) { + if ($this->gs == 1) { + $this->gs = 2; + } elseif ($this->gs == 2) { + $this->gs = 3; + } elseif ($this->gs == 3) { + $this->gs = 4; + } elseif ($this->gs == 4) { + $this->gs = 1; + } + } elseif ((int)$_GET['look'] == 2) { + if ($this->gs == 1) { + $this->gs = 4; + } elseif ($this->gs == 2) { + $this->gs = 1; + } elseif ($this->gs == 3) { + $this->gs = 2; + } elseif ($this->gs == 4) { + $this->gs = 3; + } + } + mysql_query('UPDATE `stats` SET `s` = "' . ((int)$this->gs) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['s'] = $this->gs; + } elseif (isset($_GET['go'])) { + //перемещение + $this->testGo((int)$_GET['go']); + } + + /* генерируем вид персонажа (только карта) + $this->gs = 1; //смотрим прямо + 2; //смотрим лево + 3; //смотрим вниз + 4; //смотрим право + ( ( ( `y` >= '.$u->info['y'].' && `y` <= '.($u->info['y']+4).' ) && ( `x` >= '.($u->info['x']-1).' && `x` <= '.($u->info['x']+1).' ) ) || ( (`x` = '.($u->info['x']+2).' || `x` = '.($u->info['x']-2).') && ( `y` = '.($u->info['y']+3).' || `y` = '.($u->info['y']+4).' ) ) ) + */ + + $whr = [1 => ' ((`x` <= ' . ($u->info['x'] + 2) . ' && `x` >= ' . ($u->info['x'] - 2) . ') && (`y` >= ' . $u->info['y'] . ' && `y` <= ' . ($u->info['y'] + 4) . ')) ', //прямо + 3 => ' ((`x` <= ' . ($u->info['x'] + 2) . ' && `x` >= ' . ($u->info['x'] - 2) . ') && (`y` <= ' . $u->info['y'] . ' && `y` >= ' . ($u->info['y'] - 4) . ')) ', //вниз + 2 => ' ((`x` <= ' . $u->info['x'] . ' && `x` >= ' . ($u->info['x'] - 4) . ') && (`y` <= ' . ($u->info['y'] + 2) . ' && `y` >= ' . ($u->info['y'] - 2) . ')) ', //лево + 4 => ' ((`x` >= ' . $u->info['x'] . ' && `x` <= ' . ($u->info['x'] + 4) . ') && (`y` <= ' . ($u->info['y'] + 2) . ' && `y` >= ' . ($u->info['y'] - 2) . ')) ' //право + ]; + + $i = 1; + $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $this->id_dng . '" AND ' . $whr[$this->gs] . ' ORDER BY `y` ASC , `x` ASC LIMIT 25'); + while ($pl = mysql_fetch_assoc($sp)) { + $this->map[0][$pl['y'] . '_' . $pl['x']] = $pl; + $i++; + } + $this->map['good'] = $i; //целых клеток + $this->map[1] = $this->genMatix(); + $this->lookDungeon(); + } + + public function pickitem($obj, $itm, $for, $data = '', $dn_delete = false, $chat = 0) + { + global $u; + $itm = mysql_fetch_assoc(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1')); + if (isset($itm['id'])) { + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmnm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" 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'] . '", и вы решили разыграть его'; + } + if ($dn_delete) { + $dn_delete = 1; + } else { + $dn_delete = 0; + } + if ($chat == 0) { + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $u->info['dnow'] . "','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + } + $ins = 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 $ins; + } + } + + 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 atack($id) + { + global $u, $c, $code; + $bot = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_bots` WHERE `id2` = "' . $id . '" AND `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" AND `delete` = "0" LIMIT 1')); + if (isset($bot['id2'])) { + if (($u->info['x'] != $bot['x'] || $bot['y'] != $u->info['y']) && $this->testLike($u->info['x'], $u->info['y'], $bot['x'], $bot['y']) == 1) { + //Создаем подеинок + $tbtl = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle` WHERE `dn_id` = "' . $this->info['id'] . '" AND `team_win` = "-1" AND `x` = "' . $bot['x'] . '" AND `y` = "' . $bot['y'] . '" LIMIT 1')); + if (isset($tbtl['id'])) { + //вступаем в поединок + mysql_query('UPDATE `users` SET `battle` = "' . $tbtl['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + /*#$this->error = 'Нападаем ... '; // */ + //header('location: main.php'); + die(''); + } else { + $btl_id = 0; + //$expB = -77.77; + $expB = 0; + $btl = ['players' => '', 'timeout' => 120, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; + + $ins = 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'] . '")'); + $btl_id = mysql_insert_id(); + + if ($btl_id > 0) { + //Добавляем ботов + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" AND `x` = "' . $bot['x'] . '" AND `y` = "' . $bot['y'] . '" AND `delete` = "0" LIMIT 1001'); + $j = 0; + $logins_bot = []; + while ($pl = mysql_fetch_assoc($sp)) { + $jui = 1; + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id2` = "' . $pl['id2'] . '" LIMIT 1'); + while ($jui <= $pl['colvo']) { + $k = $u->addNewbot($pl['id_bot'], null, null, $logins_bot); + $logins_bot = $k['logins_bot']; + if ($k != false) { + $upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `x`="' . $bot['x'] . '",`y`="' . $bot['y'] . '",`team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + } + unset($logins_bot); + if ($j > 0) { + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + /*#$this->error = 'Нападаем ...';// */ // + //header('location: main.php'); + die(''); + } else { + $this->error = 'Не удалось напасть, ошибка обьекта нападения ...'; + } + } else { + $this->error = 'Не удалось создать поединок ...'; + } + } + } else { + $this->error = 'Не удалось напасть ...'; + } + } else { + if (isset($this->bs['id']) || $this->info['id2'] == 15) { + $bot = mysql_fetch_assoc(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); + if (($u->info['x'] != $bot['x'] || $bot['y'] != $u->info['y']) && $this->testLike($u->info['x'], $u->info['y'], $bot['x'], $bot['y']) == 1) { + //Создаем подеинок + $tbtl = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle` WHERE `dn_id` = "' . $this->info['id'] . '" AND `team_win` = "-1" AND `x` = "' . $bot['x'] . '" AND `y` = "' . $bot['y'] . '" LIMIT 1')); + //die('Нападения временно запрещены. ['.$tbtl['id'].'] 5-10 мин.'); + if (isset($tbtl['id'])) { + //вступаем в поединок + $lstm = mysql_fetch_assoc(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle`="' . $tbtl['id'] . '" ORDER BY `st`.`team` DESC LIMIT 1')); + mysql_query('UPDATE `users` SET `battle` = "' . $tbtl['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $nextteam = $lstm['team'] + 1; + mysql_query('UPDATE `stats` SET `team` = "' . $nextteam . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `x` = "' . $bot['x'] . '", `y` = "' . $bot['y'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + // + if ($this->info['bsid'] > 0) { + + $me_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $u->info['id'] . '" AND `login` = "' . $u->info['login'] . '" LIMIT 1')); + $usr_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $bot['id'] . '" AND `login` = "' . $bot['login'] . '" LIMIT 1')); + mysql_query('UPDATE `stats` SET `tactic7`= 20.000 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + //Заносим в лог БС + if ($u->info['sex'] == 0) { + $text = '{u1} вмешался в поединок напав на {u2} »»'; + } else { + $text = '{u1} вмешалася в поединок напав на {u2} »»'; + } + if (isset($usr_real['id'])) { + $usrreal = ''; + if ($usr_real['align'] > 0) { + $usrreal .= ''; + } + if ($usr_real['clan'] > 0) { + $usrreal .= ''; + } + $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + if (isset($me_real['id'])) { + $mereal = ''; + if ($me_real['align'] > 0) { + $mereal .= ''; + } + if ($me_real['clan'] > 0) { + $mereal .= ''; + } + $mereal .= '' . $me_real['login'] . '[' . $me_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + $text = str_replace('{u1}', $mereal, $text); + $text = str_replace('{u2}', $usrreal, $text); + //Добавляем в лог БС + 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'] . '", + "' . round($this->bs['money'] * 0.85, 2) . '","' . $i . '" + )'); + // + } + // + $this->error = 'Нападаем ... '; + } else { + $btl_id = 0; + //$expB = -77.77; + if ($this->info['id2'] == 1) { + $expB = 200; + } + $btl = ['players' => '', 'timeout' => 40, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'inTurnir' => 0]; + + if ($this->info['bsid'] > 0) { + $btl['inTurnir'] = $this->info['bsid']; + } + + $ins = mysql_query('INSERT INTO `battle` (`inTurnir`,`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( + "' . $btl['inTurnir'] . '", + "' . $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(); + mysql_query('UPDATE `stats` SET `x` = "' . $bot['x'] . '", `y` = "' . $bot['y'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `x` = "' . $bot['x'] . '", `y` = "' . $bot['y'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + + if ($btl_id > 0) { + //Добавляем ботов + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + + if ($u->stats['hpNow'] < 1) { + $u->stats['hpNow'] = 1; + mysql_query('UPDATE `stats` SET `hpNow` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `lose` = `lose` + 1 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + + if ($bot['hpNow'] < 1) { + $bot['hpNow'] = 1; + mysql_query('UPDATE `stats` SET `hpNow` = "1" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `lose` = `lose` + 1 WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + } + + if ($this->info['bsid'] > 0) { + + $me_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $u->info['id'] . '" AND `login` = "' . $u->info['login'] . '" LIMIT 1')); + $usr_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $bot['id'] . '" AND `login` = "' . $bot['login'] . '" LIMIT 1')); + + //Заносим в лог БС + if ($u->info['sex'] == 0) { + $text = '{u1} напал на {u2} завязался бой »»'; + } else { + $text = '{u1} напала на {u2} завязался бой »»'; + } + if (isset($usr_real['id'])) { + $usrreal = ''; + if ($usr_real['align'] > 0) { + $usrreal .= ''; + } + if ($usr_real['clan'] > 0) { + $usrreal .= ''; + } + $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + if (isset($me_real['id'])) { + $mereal = ''; + if ($me_real['align'] > 0) { + $mereal .= ''; + } + if ($me_real['clan'] > 0) { + $mereal .= ''; + } + $mereal .= '' . $me_real['login'] . '[' . $me_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + $text = str_replace('{u1}', $mereal, $text); + $text = str_replace('{u2}', $usrreal, $text); + //Добавляем в лог БС + 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'] . '", + "' . round($this->bs['money'] * 0.85, 2) . '","' . $i . '" + )'); + // + } + + $this->error = 'Нападаем ... '; + } else { + $this->error = 'Не удалось создать поединок ...'; + } + } + } else { + $this->error = 'Не удалось напасть ...'; + } + } else { + $this->error = 'Не удалось напасть, слишком далеко (id' . $id . ') ...'; + } + } + } + + 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 $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) + { + global $u; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $u->info['dnow'] . "','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + } + + public function takeit($id) + { + global $u, $c, $code, $magic; + $obj = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_obj` WHERE `id` = "' . $id . '" AND `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" LIMIT 1')); + if (isset($obj['id'])) { + $tbot = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "' . $obj['x'] . '" AND `y` = "' . $obj['y'] . '" AND `dn` = "' . $this->info['id'] . '" AND `for_dn` = "0" AND `delete` = "0" LIMIT 1')); + + + $i = 0; + # Создаем МАССИВ { $act_sl['save_pos'] = "save_pos" }или { $act_sl['port'] = "10:20" } + $act_sl = []; + $act_sm = explode('|', $obj['action']); + while ($i < count($act_sm)) { + $s = explode(':', $act_sm[$i]); + if (isset($s[1]) && $s[1] != '') { + $act_sl[$s[0]] = $s[1]; + } else { + $act_sl[$s[0]] = $s[0]; + } + $i++; + } + + if (isset($tbot['id2'])) { + $this->error = 'Не удалось, что-то или кто-то мешает ...'; + } elseif ($this->testLike($u->info['x'], $u->info['y'], $obj['x'], $obj['y']) != 1) { + $this->error = 'Не удалось, слишком далеко ...!'; + } else { + $a = explode('|', $obj['action']); + $r = ''; + $i = 0; + while ($i < count($a)) { + $s = explode(':', $a[$i]); + + if ($s[0] == 'kill_bot') { + //Требуется убить ботов + $t = explode(',', $s[1]); + $tr_gd = 0; + + //Проверяем кого нужно убить и убили-ли + $j = 1; + $jn = 0; + while ($j < count($t)) { + $itm = explode('.', $t[$j]); + //[0] - x , [1] - y + $bot_itm = mysql_fetch_assoc(mysql_query('SELECT `u`.`id2`,`st`.`login` 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`.`x` = "' . $itm[0] . '" AND `u`.`y` = "' . $itm[1] . '" AND `u`.`delete` = "0" LIMIT 10')); + if (isset($bot_itm['id2'])) { + $jn++; + } + $j++; + } + + if ($jn == 0) { + $tr_gd = 1; + } + + unset($itm, $bot_itm, $jn); + if ($tr_gd == 0) { + if ($t[0] == '0') { + $r .= 'Не удалось, что-то или кто-то мешает ...'; + } else { + $r .= $t[0]; + } + $i = count($a); + } + } elseif ($s[0] == 'kill_bot_d') { + //Требуется убить ботов (все боты нападают , если что-то не так ) + $t = explode(',', $s[1]); + $tr_gd = 0; + + //Проверяем кого нужно убить и убили-ли + $j = 1; + $jn = 0; + $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')); + while ($j < count($t)) { + $itm = explode('.', $t[$j]); + //[0] - x , [1] - y + $bot_itm_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`.`x` = "' . $itm[0] . '" AND `u`.`y` = "' . $itm[1] . '" AND `u`.`delete` = "0" LIMIT 50'); + while ($bot_itm = mysql_fetch_assoc($bot_itm_sp)) { + $jn++; + $this->botAtack($bot_itm, $u->info, 1); + } + $j++; + } + + if ($jn == 0) { + $tr_gd = 1; + } + + unset($itm, $bot_itm, $jn); + if ($tr_gd == 0) { + if ($t[0] == '0') { + $r .= 'Не удалось, что-то или кто-то мешает ...'; + } else { + $r .= $t[0]; + } + $r .= ' Монстры начали атаковать вас!'; + $i = count($a); + } + } elseif ($s[0] == 'ditm') { + //требует предмет для действия + $j = 0; + $t = explode(',', $s[1]); + $tr_gd = 1; + while ($j < count($t)) { + $itm = explode('=', $t[$j]); + $uitm = mysql_fetch_array(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]); + $r .= 'Предмет "' . $uitm['name'] . '" (x' . $itm[1] . ') был утрачен...
'; + $j++; + } + } elseif ($s[0] == 'tritm') { + //требует предмет для действия + $j = 0; + $t = explode(',', $s[1]); + $j = 0; + $tr_gd = 1; + while ($j < count($t)) { + $itm = explode('=', $t[$j]); + $uitm = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` 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])); + $uitm = $uitm[0]; + if ($uitm < $itm[1]) { + $tr_gd = 0; + $uitm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itm[0] . '" LIMIT 1')); + $r .= 'Требуется предмет "' . $uitm['name'] . '" (x' . $itm[1] . ')
'; + } + $j++; + } + if (rand(0, 10000) > $itm[2] * 100) { + $tr_gd = 0; + $r .= 'Странно, но ничего не произошло...
'; + } + if ($tr_gd == 1) { + //все отлично + } else { + $i = count($a); + } + } elseif ($s[0] == 'repl_ptp') { + require_once('dnaction/_dungeon_replace.php'); + die(); + //header('Location: ../../modules_data/location/_dungeon_replace.php'); + } elseif ($s[0] == 'add_eff') { + //Кастуем эффект + $t = explode(',', $s[1]); + $j = 0; + while ($j < count($t)) { + $itm = explode('=', $t[$j]); + $ch = $u->testAction('`vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '', 2); //кол-во прошлых попыток + $ch = $ch[0]; + $ch2 = $u->testAction(' `vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[4]) . '', 2); //кол-во прошлых попыток (все юзеры) + $ch2 = $ch2[0]; + if (($ch2 < $itm[4] || $itm[4] == 0) && $ch < $itm[2]) { + if ($itm[1] * 100 >= rand(0, 10000)) { + //удачно + $eff_d = mysql_fetch_assoc(mysql_query('SELECT `id2`,`mname` FROM `eff_main` WHERE `id2` = "' . $itm[0] . '" LIMIT 1')); + if (isset($eff_d['id2'])) { + //добавляем эффект + $us = $magic->add_eff($u->info['id'], $itm[0], 1); + if ($us[0] == 1) { + $r .= '
На Вас наложили заклятие "' . $eff_d['mname'] . '".
'; + } else { + $r .= '
Что-то пошло не так... Ощущается чье-то присутствие...
'; + } + } else { + $r .= '
Что-то пошло не так... Слышен чей-то вой...
'; + } + unset($eff_d, $us); + } else { + //не удачно + $r .= '
Не удалось...
'; + } + $u->addAction(time(), 'add_eff_' . $this->info['id'] . '_' . $obj['id'], $u->info['city']); + } else { + //уже нельзя юзать + $r .= '
Что-то пошло не так...
'; + } + + unset($ch, $ch2); + $j++; + } + } elseif ($s[0] == 'mfast') { + //Добавляем баф //Ловушки и бафы + $j = 0; + $t = explode(',', $s[1]); + while ($j < count($t)) { + $itm = explode('=', $t[$j]); + $ch = $u->testAction('`vars` = "bafit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '', 2); //кол-во прошлых попыток + $ch = $ch[0]; + if ($ch < $itm[3]) { + if ($itm[2] * 1000 >= rand(1, 100000)) { + if ($itm[0] == 'hpNow') { + $mm = explode('r', $itm[1]); + if ($mm[1] != 0) { + $itm[1] = rand($mm[0], $mm[1]); + } + if ($itm[1] < 0) { + $r .= '
Вы попали в ловушку... Здоровье: ' . $itm[1] . ' HP
'; + } elseif ($itm[1] > 0) { + $r .= '
Вы прикоснулись к магии... Здоровье: +' . $itm[1] . ' HP
'; + } + $u->info['hpNow'] += $itm[1]; + if ($u->info['hpNow'] < 1) { + $r .= '
Вы перемещены в точку возрождения...
'; + mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->info['hpNow'] . '",`x` = "' . $u->info['res_x'] . '",`y` = "' . $u->info['res_y'] . '",`s` = "' . $u->info['res_s'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->info['hpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + } + } + $u->addAction(time(), 'bafit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city']); + } + //записываем попытку + $j++; + } + } elseif ($s[0] == 'save_pos') { + if (isset($act_sl['port'])) { + $itm = explode('=', $act_sl['port']); + $obj['x'] = $itm[0]; + $obj['y'] = $itm[1]; + } + #$r .= 'Позиция сохранена. Теперь после смерти вы оживете здесь.'; + mysql_query('UPDATE `stats` SET `res_x` = "' . $obj['x'] . '",`res_y` = "' . $obj['y'] . '",`res_s` = "' . $u->info['s'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } elseif ($s[0] == 'look_text') { + $itm = explode('=', $s[1]); + $r .= $itm[rand(0, count($itm) - 1)]; + } elseif ($s[0] == 'save_pos_xy') { + $itm = explode('=', $s[1]); + $u->info['res_x'] = $itm[0]; + $u->info['res_y'] = $itm[1]; + $upd = mysql_query('UPDATE `stats` SET `res_x` = "' . $u->info['x'] . '",`res_y` = "' . $u->info['y'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($upd) { + $r .= 'Вы куда-то переместились... на этот раз удачно...
'; + } else { + $r .= 'Что-то здесь не так ...'; + } + } elseif ($s[0] == 'port') { + //телепортирует пользователя + $itm = explode('=', $s[1]); + $u->info['x'] = $itm[0]; + $u->info['y'] = $itm[1]; + $upd = mysql_query('UPDATE `stats` SET + `x` = "' . $u->info['x'] . '",`y` = "' . $u->info['y'] . '" + WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($upd) { + $r .= 'Вы куда-то переместились... на этот раз удачно...
'; + } else { + $r .= 'Что-то здесь не так ...'; + } + } elseif ($s[0] == 'save_port') { + $itm = explode('=', $s[1]); + $u->info['res_x'] = $itm[0]; + $u->info['res_y'] = $itm[1]; + $upd = mysql_query('UPDATE `stats` SET `res_x` = "' . $u->info['res_x'] . '", `res_y` = "' . $u->info['res_y'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } elseif ($s[0] == 'itm') { + //Добавляем предмет + $j = 0; + $t = explode(',', $s[1]); + while ($j < count($t)) { + $itm = explode('=', $t[$j]); + $ch = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '', 2); //кол-во прошлых попыток + $ch = $ch[0]; + if ($ch >= $itm[2]) { + //закончились попытки + $r = 'ничего не произошло...
'; + } else { + if ($itm[1] * 1000 >= rand(1, 100000)) { + + //Случайный предмет (Башня смерти) + if ($itm[0] == 'random1') { + $itm[0] = $this->itbs[rand(0, count($this->itbs))]; + } + + //удачная попытка + $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1')); + 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]]); + } + } else { + //неудачная попытка + $r .= 'Вы ничего не нашли ...
'; + } + $u->addAction(time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city']); + } + //записываем попытку + $j++; + } + } elseif ($s[0] == 'itm1') { + //Добавляем предмет , только 1 предмет из всех и все юзеры могут тоже + $nj = 0; + $t = explode(',', $s[1]); + $j = rand(0, count($t)); + if ($nj == 0) { + $itm = explode('=', $t[$j]); + $ch = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '', 2); //кол-во прошлых попыток + $ch = $ch[0]; + if ($ch >= $itm[2]) { + //закончились попытки + $r .= 'Странно, но ничего не произошло...
'; + } else { + if ($itm[1] * 1000 >= rand(1, 100000)) { + + //Случайный предмет (Башня смерти) + if ($itm[0] == 'random1') { + $itm[0] = $this->itbs[rand(0, count($this->itbs))]; + } + + //удачная попытка + $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1')); + if (isset($it['id'])) { + $r .= 'Вы обнаружили предмет "' . $it['name'] . '".
'; + $u->addAction(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]]); + $nj++; + } + } else { + //неудачная попытка + $u->addAction(time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city']); + $r .= 'Вы ничего не нашли ...
'; + } + } + } + } elseif ($s[0] == 'itm2') { + //Добавляем предмет , только 1 предмет из всех и только 1 юзер может поднять + $nj = 0; + $t = explode(',', $s[1]); + $j = rand(0, count($t) - 1); + if ($nj == 0) { + $itm = explode('=', $t[$j]); + $ch = $u->testAction('`vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '', 2); //кол-во прошлых попыток + $ch = $ch[0]; + if ($ch >= $itm[2]) { + //закончились попытки + $r .= 'Ничего не произошло...
'; + } else { + if ($itm[1] * 1000 >= rand(1, 100000)) { + + //Случайный предмет (Башня смерти) + if ($itm[0] == 'random1') { + $itm[0] = $this->itbs[rand(0, count($this->itbs))]; + } + + //удачная попытка + $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1')); + if (isset($it['id'])) { + $r .= 'Вы обнаружили предмет "' . $it['name'] . '".
'; + $u->addAction(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]]); + $nj++; + } + } else { + //неудачная попытка + $u->addAction(time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city']); + $r .= 'Вы ничего не нашли ...
'; + } + } + } + } elseif ($s[0] == 'fileact') { + require('dnaction/' . $s[1] . '.php'); + } + $i++; + } + $r = rtrim($r, '\'); + if ($r == '') { + $r = 'В этот раз не удалось найти что-либо еще'; + } + $this->error = $r; + } + } else { + $this->error = 'Предмет не найден ...'; + } + } + + 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 = $u->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 .= ' (Квест)'; + } + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $u->info['dnow'] . "','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + } + + $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'])) { + //Розыгрыш + if ($this->info['bsid'] == 0) { + $action = 'javascript: top.fartgame(\'' . $pl['id'] . '\',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'\');'; + $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; + $user = mysql_fetch_assoc(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "' . $uid['id'] . '" LIMIT 1')); + + if ($user['battle'] > 0) { + $btli = mysql_fetch_assoc(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $user['battle'] . '" AND `team_win` = "-1" LIMIT 1')); + } + + if (!isset($btli['id'])) { //Создаем поединок + $btl_id = 0; + $expB = 0; + $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'] . '")'); + + $btl_id = mysql_insert_id(); + + if ($btl_id > 0) { //Добавляем ботов + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `delete` = "0" AND `dn` = "' . $this->info['id'] . '" AND `id2` = "' . $bot['id2'] . '" LIMIT 1'); // Только тот, который напал и жив ли он? + $j = 0; + $logins_bot = []; + while ($pl = mysql_fetch_assoc($sp)) { + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1'); + $jui = 1; + while ($jui <= $pl['colvo']) { + $k = $u->addNewbot($pl['id_bot'], null, null, $logins_bot); + $logins_bot = $k['logins_bot']; + if ($k) { + $upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + } + unset($logins_bot); + if ($j > 0) { + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + } + } + } else { + $btl_id = $btli['id']; + //Добавляем ботов + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `delete` = "0" AND `dn` = "' . $this->info['id'] . '" AND `id2` = "' . $bot['id2'] . '" LIMIT 1'); + $j = 0; + $logins_bot = []; + $logins_bot_text = []; + $logins_bot_vars = ['time1=' . time() . '']; + while ($pl = mysql_fetch_assoc($sp)) { + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1'); + $jui = 1; + while ($jui <= $pl['colvo']) { + $k = $u->addNewbot($pl['id_bot'], null, null, $logins_bot); + $logins_bot = $k['logins_bot']; + $logins_bot_text[] = ' ' . $k['login'] . ''; + if ($k != false) { + $upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + if ($j > 0) { + $logins_bot_text = '{tm1} В поединок вмешались: ' . implode(', ', $logins_bot_text) . '.'; + $logins_bot_vars = implode('||', $logins_bot_vars); + $battle_log = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle_logs` WHERE `battle`=' . $btl_id . ' ORDER BY `id_hod` DESC LIMIT 1')); + 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)'); + } + } + } + unset($logins_bot); + if ($j > 0) { + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + } + } + } + + 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; + $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; + } + + $tmap = 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')); + //наличие предмета + if ($tmap['tr_items'] != '') { + $ti = explode(',', $tmap['tr_items']); + $i = 0; + $trnit = ''; + while ($i < count($ti)) { + $ti2 = explode('=', $ti[$i]); + if ($ti2[0] > 0 && $ti2[1] > 0) { + $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "' . ((int)$ti2[0]) . '" LIMIT ' . ((int)$ti2[1]) . '')); + if ($num_rows < (int)$ti2[1]) { + $tgo = $ti2[2]; + if ($tgo != '0000' && $tgo[$ng[$go] - 1] == 1) { + $go = 0; + $trm = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . ((int)$ti2[0]) . '" LIMIT 1')); + $trnit .= '"' . $trm['name'] . '", '; + } + } + } + $i++; + } + if ($trnit != '') { + $trnit = rtrim($trnit, ', '); + $this->error = 'У вас нет подходящего предмета. Требуется ' . $trnit; + } + } + + $tmGo = $u->info['timeGo'] - time(); //сколько секунд осталось + if ($tmGo > 0) { + $go = 0; + $this->error = 'Не так быстро...'; + } + + if ($u->aves['now'] >= $u->aves['max']) { + $go = 0; + $this->error = 'Вы не можете перемещаться, рюкзак переполнен ...'; + } + + if ($go > 0) { + if ($go == 1) { + $u->info['y'] += 1; + } elseif ($go == 2) { + $u->info['x'] -= 1; + } elseif ($go == 3) { + $u->info['y'] -= 1; + } elseif ($go == 4) { + $u->info['x'] += 1; + } + if ($u->stats['speed_dungeon'] > 0) { + $tmap['timeGO'] = round($tmap['timeGO'] / 100 * (100 - $u->stats['speed_dungeon'])); + if ($tmap['timeGO'] < 2) { + $tmap['timeGO'] = 1; + } + } + $u->info['timeGo'] = time() + $tmap['timeGO']; + $u->info['timeGoL'] = time(); + $tmap0 = mysql_fetch_assoc(mysql_query('SELECT `id`,`teleport` FROM `dungeon_map` WHERE `id_dng` = "' . $tmap['id_dng'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" LIMIT 1')); + if ($tmap0['teleport'] > 0) { + $tmap1 = mysql_fetch_assoc(mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id` = "' . $tmap0['teleport'] . '" LIMIT 1')); + if (isset($tmap1['id'])) { + $u->info['x'] = $tmap1['x']; + $u->info['y'] = $tmap1['y']; + $this->error = 'Вы переместились в другую комнату...'; + } + } + mysql_query('UPDATE `stats` SET `x` = "' . $u->info['x'] . '",`y` = "' . $u->info['y'] . '",`timeGo` = "' . $u->info['timeGo'] . '",`timeGoL` = "' . $u->info['timeGoL'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + unset($id); + } + } + + 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; + } + + 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)]; + } + return $r; + } + + public function lookDungeon() + { + global $u, $c, $code, $pd; + /* Генерируем изображение карты */ /* LEVEL 1 */ + + // Исправления от 29/10/2014 относительно D5, 2 этаж, ПТП. Покрутиться и все гуд. и от 22/11/2014 для обратных стен. Если стена к нам задницей, мы её не видим. + if ($this->testSt(2, 4) > 0 /* || $this->testSt(3,2)>0 */) { + $pd[28] = 1; + } + if (/*$this->testSt(1,4)>0 ||*/ $this->testSt(2, 2) > 0) { + $pd[27] = 1; + } + if ($this->testSt(2, 1) > 0 /*|| $this->testSt(5,3)>0*/) { + $pd[26] = 1; + } + if ($this->testSt(3, 1) > 0/* || $this->testSt(6,3)>0*/) { + $pd[25] = 1; + } + if ($this->testSt(1, 1) > 0 /*|| $this->testSt(4,3)>0*/) { + $pd[24] = 1; + } + /* LEVEL 2 */ + if ($this->testSt(5, 4) > 0 /*|| $this->testSt(6,2)>0*/) { + $pd[23] = 1; + } + if (/*$this->testSt(4,4)>0 || */ $this->testSt(5, 2) > 0) { + $pd[22] = 1; + } + if ($this->testSt(5, 1) > 0 /*|| $this->testSt(8,3)>0*/) { + $pd[21] = 1; + } + if ($this->testSt(6, 1) > 0 /*|| $this->testSt(7,3)>0*/) { + $pd[20] = 1; + } + if ($this->testSt(4, 1) > 0/* || $this->testSt(9,3)>0*/) { + $pd[19] = 1; + } + + /* LEVEL 3 */ + if ($this->testSt(8, 4) > 0 /*|| $this->testSt(7,2)>0*/) { + $pd[18] = 1; + } + if (/*$this->testSt(9,4)>0 || */ $this->testSt(8, 2) > 0) { + $pd[17] = 1; + } + if ($this->testSt(8, 1) > 0 /* || $this->testSt(12,3)>0*/) { + $pd[16] = 1; + } + if ($this->testSt(7, 1) > 0 /* || $this->testSt(13,3)>0*/) { + $pd[15] = 1; + } + if ($this->testSt(9, 1) > 0 /*|| $this->testSt(11,3)>0*/) { + $pd[14] = 1; + } + + /* LEVEL 4 */ + + if ($this->testSt(12, 4) > 0 || $this->testSt(13, 2) > 0) { + $pd[13] = 1; + } + if ($this->testSt(12, 2) > 0 || $this->testSt(11, 4) > 0) { + $pd[12] = 1; + } + if ($this->testSt(13, 1) > 0 || $this->testSt(17, 3) > 0) { + $pd[11] = 1; + } //8 + if ($this->testSt(11, 1) > 0 || $this->testSt(16, 3) > 0) { + $pd[10] = 1; + } //7 + if ($this->testSt(12, 1) > 0/* || $this->testSt(15,3)>0*/) { + $pd[9] = 1; + } + if ($this->testSt(14, 1) > 0 || $this->testSt(18, 3) > 0) { + $pd[6] = 1; + } //2 + if ($this->testSt(10, 1) > 0 || $this->testSt(19, 3) > 0) { + $pd[5] = 1; + } //1 + if ($this->testSt(16, 4) > 0 || $this->testSt(15, 2) > 0) { + $pd[4] = 1; + } + if ($this->testSt(15, 4) > 0 || $this->testSt(17, 2) > 0) { + $pd[3] = 1; + } + + /* Генерируем предметы на карте */ + + /* Генерируем персонажей и ботов на карте */ + + } + + 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 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); + } + return $r; + } +} diff --git a/_incl_data/class/DungeonEditor.php b/_incl_data/class/DungeonEditor.php new file mode 100644 index 00000000..4abcb580 --- /dev/null +++ b/_incl_data/class/DungeonEditor.php @@ -0,0 +1,609 @@ + [] //карта + ], $id_dng, $cord = ['x' => 0], $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 function start() + { + global $u, $c, $code, $id; + $this->info = ['id2' => $id, 'id' => 0, 'name' => 'Редактирование Пещеры', 'room' => 0, 'time_start' => time(), 'time_start' => 0, 'uid' => 0, 'type' => 0, 'bsid' => 0]; + + $this->id_dng = $this->info['id2']; + $this->gs = $u->info['psevdo_s']; + if ($this->gs < 1 || $this->gs > 4) { + $this->gs = 1; + } + + if ($this->info['bsid'] > 0) { + $this->bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "' . $u->info['city'] . '" AND `id` = "' . $this->info['bsid'] . '" AND `time_start` = "' . $this->info['time_start'] . '" LIMIT 1')); + //Если БС закончена + if (isset($this->bs['id']) && $this->bs['users'] - $this->bs['users_finish'] < 2) { + $u->bsfinish($this->bs, false, null); + } + } + + /* генерируем вид персонажа (только карта) + $this->gs = 1; //смотрим прямо + 2; //смотрим лево + 3; //смотрим вниз + 4; //смотрим право + ( ( ( `y` >= '.$u->info['psevdo_y'].' && `y` <= '.($u->info['psevdo_y']+4).' ) && ( `x` >= '.($u->info['psevdo_x']-1).' && `x` <= '.($u->info['psevdo_x']+1).' ) ) || ( (`x` = '.($u->info['psevdo_x']+2).' || `x` = '.($u->info['psevdo_x']-2).') && ( `y` = '.($u->info['psevdo_y']+3).' || `y` = '.($u->info['psevdo_y']+4).' ) ) ) + */ + + $whr = [1 => ' ((`x` <= ' . ($u->info['psevdo_x'] + 2) . ' && `x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`y` >= ' . $u->info['psevdo_y'] . ' && `y` <= ' . ($u->info['psevdo_y'] + 4) . ')) ', //прямо + 3 => ' ((`x` <= ' . ($u->info['psevdo_x'] + 2) . ' && `x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`y` <= ' . $u->info['psevdo_y'] . ' && `y` >= ' . ($u->info['psevdo_y'] - 4) . ')) ', //вниз + 2 => ' ((`x` <= ' . $u->info['psevdo_x'] . ' && `x` >= ' . ($u->info['psevdo_x'] - 4) . ') && (`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `y` >= ' . ($u->info['psevdo_y'] - 2) . ')) ', //лево + 4 => ' ((`x` >= ' . $u->info['psevdo_x'] . ' && `x` <= ' . ($u->info['psevdo_x'] + 4) . ') && (`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `y` >= ' . ($u->info['psevdo_y'] - 2) . ')) ' //право + ]; + + $i = 1; + $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $this->id_dng . '" AND ' . $whr[$this->gs] . ' ORDER BY `y` ASC , `x` ASC LIMIT 25'); + while ($pl = mysql_fetch_array($sp)) { + $this->map[0][$pl['y'] . '_' . $pl['x']] = $pl; + $i++; + } + $this->map['good'] = $i; //целых клеток + $this->map[1] = $this->genMatix(); + $this->lookDungeon(); + } + + public function usersDng() + { + global $u, $c; + $r = ''; + /* отображение ботов (бесполезно в данном редакторе) */ + } + + public function atack($id) + { + global $u, $c, $code; + /* нападение, какое нападение может быть в редакторе? :) На самого себя, со стулом? :) */ + } + + public function takeinv($id) + { + global $u, $c, $code; + /* Это редактор, а не майнкрафт, здесь ничего собирать не нужно :) */ + } + + public function takeit($id) + { + global $u, $c, $code, $magic; + /* В редакторе ничего не падает ;) */ + } + + public function addItem($i) + { + //добавляем предмет в пещеру (возможно выпал из бота или из сундука) + /* А что еще? Пульт к управлению Землей?! */ + } + + public function itemsMap() + { + global $u, $c, $code; + /* Да ничего здесь не падает! Говорю же! */ + } + + public function testLike($x1, $y1, $x2, $y2) + { + //из $x1,$y1 в $x2,$y2 + //доступна-ли эта клетка для действий + $r = 0; + $c1 = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "' . $x1 . '" AND `y` = "' . $y1 . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1')); + $c2 = mysql_fetch_array(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 || //право + $x1 == $x2 + 1 && $c1['go_2'] == 1 || //лево + $y1 == $y2 - 1 && $c1['go_3'] == 1 || //верх + $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['psevdo_x'] + 2) . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`u`.`y` >= ' . ($u->info['psevdo_y'] + 1) . ' && `u`.`y` <= ' . ($u->info['psevdo_y'] + 4) . ')) OR (`u`.`y` = ' . $u->info['psevdo_y'] . ' && `u`.`x` = ' . $u->info['psevdo_x'] . ')) ', //прямо + 3 => ' (((`u`.`x` <= ' . ($u->info['psevdo_x'] + 2) . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`u`.`y` <= ' . ($u->info['psevdo_y'] - 1) . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 4) . ')) OR (`u`.`y` = ' . $u->info['psevdo_y'] . ' && `u`.`x` = ' . $u->info['psevdo_x'] . ')) ', //вниз + 2 => ' (((`u`.`x` <= ' . ($u->info['psevdo_x'] - 1) . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 2) . '))OR (`u`.`y` = ' . $u->info['psevdo_y'] . ' && `u`.`x` = ' . $u->info['psevdo_x'] . ')) ', //лево + 4 => ' (((`u`.`x` >= ' . ($u->info['psevdo_x'] + 1) . ' && `u`.`x` <= ' . ($u->info['psevdo_x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 2) . ')) OR (`u`.`y` = ' . $u->info['psevdo_y'] . ' && `u`.`x` = ' . $u->info['psevdo_x'] . ')) ' //право + ]; + $sp = mysql_query('SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "0" AND `u`.`for_dn` = "' . $this->id_dng . '" AND ((`u`.`s` = "0" OR `u`.`s` = "' . $this->gs . '") OR `u`.`s2` = "' . $this->gs . '") AND ' . $whr[$this->gs] . ' LIMIT 76'); + # die('SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "0" AND `u`.`for_dn` = "'.$this->id_dng.'" AND ((`u`.`s` = "0" OR `u`.`s` = "'.$this->gs.'") OR `u`.`s2` = "'.$this->gs.'") AND '.$whr[$this->gs].' LIMIT 76'); + $i = 0; + $pos = []; + while ($pl = mysql_fetch_array($sp)) { + + if ($pl['fix_x_y'] == 0 || ($pl['fix_x_y'] == 1 && $pl['x'] == $u->info['psevdo_x']) || ($pl['fix_x_y'] == 2 && $pl['y'] == $u->info['psevdo_y']) || ($pl['fix_x_y'] == 3 && $pl['x'] == $u->info['psevdo_x'] && $pl['y'] == $u->info['psevdo_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) . ':{\'x\':' . $pl['x'] . ',\'y\':' . $pl['y'] . ',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'] . ',12:' . $pl['type'] . ',13:' . $pl['type2'] . ',14:' . $pl['s'] . ',15:' . $pl['s2'] . ',16:' . $pl['os1'] . ',17:' . $pl['os2'] . ',18:' . $pl['os3'] . ',19:' . $pl['os4'] . ',20:' . $pl['fix_x_y'] . '}'; + } 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['rl2']))$da['rl2'] = -round((int)$da['rl2'] * 0.70); // Слева + if (isset($da['rl2'])) $da['rl2'] = round((int)$da['rl2'] - 230); // Слева + 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) . ':{\'x\':' . $pl['x'] . ',\'y\':' . $pl['y'] . ',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'] . ',12:' . $pl['type'] . ',13:' . $pl['type2'] . ',14:' . $pl['s'] . ',15:' . $pl['s2'] . ',16:' . $pl['os1'] . ',17:' . $pl['os2'] . ',18:' . $pl['os3'] . ',19:' . $pl['os4'] . ',20:' . $pl['fix_x_y'] . '}'; + } 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['rl2']))$da['rl2'] = 355-round((int)$da['rl2'] * 0.30); // Справа + if (isset($da['rl2'])) $da['rl2'] = round((int)$da['rl2'] + 230); // Справа + 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) . ':{\'x\':' . $pl['x'] . ',\'y\':' . $pl['y'] . ',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'] . ',12:' . $pl['type'] . ',13:' . $pl['type2'] . ',14:' . $pl['s'] . ',15:' . $pl['s2'] . ',16:' . $pl['os1'] . ',17:' . $pl['os2'] . ',18:' . $pl['os3'] . ',19:' . $pl['os4'] . ',20:' . $pl['fix_x_y'] . '}'; + } + } + } + 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['psevdo_x'] + 2) . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`u`.`y` >= ' . $u->info['psevdo_y'] . ' && `u`.`y` <= ' . ($u->info['psevdo_y'] + 4) . ')) ', //прямо + 3 => ' ((`u`.`x` <= ' . ($u->info['psevdo_x'] + 2) . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 2) . ') && (`u`.`y` <= ' . $u->info['psevdo_y'] . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 4) . ')) ', //вниз + 2 => ' ((`u`.`x` <= ' . $u->info['psevdo_x'] . ' && `u`.`x` >= ' . ($u->info['psevdo_x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 2) . ')) ', //лево + 4 => ' ((`u`.`x` >= ' . $u->info['psevdo_x'] . ' && `u`.`x` <= ' . ($u->info['psevdo_x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['psevdo_y'] + 2) . ' && `u`.`y` >= ' . ($u->info['psevdo_y'] - 2) . ')) ' //право + ]; + $i = 0; + //отображаем ботов + $sp = mysql_query('SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE ' . $whr[$this->gs] . ' AND `dn` = "0" AND `for_dn` = "' . $this->id_dng . '" AND `u`.`delete` = "0" LIMIT 50'); + while ($pl = mysql_fetch_array($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']; + } + $r .= ',' . ($i - 1) . ':{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 . '}'; + } + return 'count:' . $i . $r; + } + + public function botAtack($bot, $uid, $bs) + { + global $u, $c, $code; + $user = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "' . $uid['id'] . '" LIMIT 1')); + if ($user['battle'] > 0) { + $btli = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $user['battle'] . '" AND `team_win` = "-1" LIMIT 1')); + } + if (!isset($btli['id'])) { + //Создаем поединок + $btl_id = 0; + $expB = 0; + $btl = ['players' => '', 'timeout' => 180, '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'] . '")'); + $btl_id = mysql_insert_id(); + + if ($btl_id > 0) { + //Добавляем ботов + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" AND `x` = "' . $bot['x'] . '" AND `y` = "' . $bot['y'] . '" LIMIT 50'); + $j = 0; + $logins_bot = []; + while ($pl = mysql_fetch_array($sp)) { + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $jui = 1; + while ($jui <= $pl['colvo']) { + $k = $u->addNewbot($pl['id_bot'], null, null, $logins_bot); + $logins_bot = $k['logins_bot']; + if ($k) { + $upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `x`="' . $bot['x'] . '",`y`="' . $bot['y'] . '",`team` = "1" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + } + unset($logins_bot); + if ($j > 0) { + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + } + } + } + } + + public function testGo($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_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "' . $u->info['psevdo_x'] . '" AND `y` = "' . $u->info['psevdo_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_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "' . ($u->info['psevdo_x'] + (int)$tgo[0]) . '" AND `y` = "' . ($u->info['psevdo_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; + } + + $tmap = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "' . $u->info['psevdo_x'] . '" AND `y` = "' . $u->info['psevdo_y'] . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1')); + //наличие предмета + if ($tmap['tr_items'] != '') { + $ti = explode(',', $tmap['tr_items']); + $i = 0; + $trnit = ''; + while ($i < count($ti)) { + $ti2 = explode('=', $ti[$i]); + if ($ti2[0] > 0 && $ti2[1] > 0) { + $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "' . ((int)$ti2[0]) . '" LIMIT ' . ((int)$ti2[1]) . '')); + if ($num_rows < (int)$ti2[1]) { + $tgo = $ti2[2]; + if ($tgo != '0000' && $tgo[$ng[$go] - 1] == 1) { + $go = 0; + $trm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . ((int)$ti2[0]) . '" LIMIT 1')); + $trnit .= '"' . $trm['name'] . '", '; + } + } + } + $i++; + } + if ($trnit != '') { + $trnit = rtrim($trnit, ', '); + $this->error = 'У вас нет подходящего предмета. Требуется ' . $trnit; + } + } + + $tmGo = $u->info['timeGo'] - time(); //сколько секунд осталось + if ($tmGo > 0) { + $go = 0; + $this->error = 'Не так быстро...'; + } + + if ($u->aves['now'] >= $u->aves['max']) { + $go = 0; + $this->error = 'Вы не можете перемещаться, рюкзак переполнен ...'; + } + + if ($go > 0) { + if ($go == 1) { + $u->info['psevdo_y'] += 1; + } elseif ($go == 2) { + $u->info['psevdo_x'] -= 1; + } elseif ($go == 3) { + $u->info['psevdo_y'] -= 1; + } elseif ($go == 4) { + $u->info['psevdo_x'] += 1; + } + $u->info['timeGo'] = time() + $tmap['timeGO']; + $u->info['timeGoL'] = time(); + mysql_query('UPDATE `stats` SET `x` = "' . $u->info['psevdo_x'] . '",`y` = "' . $u->info['psevdo_y'] . '",`timeGo` = "' . $u->info['timeGo'] . '",`timeGoL` = "' . $u->info['timeGoL'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + } + + 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_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "' . $u->info['psevdo_x'] . '" AND `y` = "' . $u->info['psevdo_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_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "' . ($u->info['psevdo_x'] + (int)$tgo[0]) . '" AND `y` = "' . ($u->info['psevdo_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)]; + } + return $r; + } + + public function lookDungeon() + { + global $u, $c, $code, $pd; + /* Генерируем изображение карты */ + /* LEVEL 1 */ + if ($this->testSt(2, 4) > 0 || $this->testSt(3, 2) > 0) { + $pd[28] = 1; + } + if ($this->testSt(1, 4) > 0 || $this->testSt(2, 2) > 0) { + $pd[27] = 1; + } + if ($this->testSt(2, 1) > 0 || $this->testSt(5, 3) > 0) { + $pd[26] = 1; + } + if ($this->testSt(3, 1) > 0 || $this->testSt(6, 3) > 0) { + $pd[25] = 1; + } + if ($this->testSt(1, 1) > 0 || $this->testSt(4, 3) > 0) { + $pd[24] = 1; + } + + /* LEVEL 2 */ + if ($this->testSt(5, 4) > 0 || $this->testSt(6, 2) > 0) { + $pd[23] = 1; + } + if ($this->testSt(4, 4) > 0 || $this->testSt(5, 2) > 0) { + $pd[22] = 1; + } + if ($this->testSt(5, 1) > 0 || $this->testSt(8, 3) > 0) { + $pd[21] = 1; + } + if ($this->testSt(6, 1) > 0 || $this->testSt(7, 3) > 0) { + $pd[20] = 1; + } + if ($this->testSt(4, 1) > 0 || $this->testSt(9, 3) > 0) { + $pd[19] = 1; + } + + /* LEVEL 3 */ + if ($this->testSt(8, 4) > 0 || $this->testSt(7, 2) > 0) { + $pd[18] = 1; + } + if ($this->testSt(9, 4) > 0 || $this->testSt(8, 2) > 0) { + $pd[17] = 1; + } + if ($this->testSt(8, 1) > 0 || $this->testSt(12, 3) > 0) { + $pd[16] = 1; + } + if ($this->testSt(7, 1) > 0 || $this->testSt(13, 3) > 0) { + $pd[15] = 1; + } + if ($this->testSt(9, 1) > 0 || $this->testSt(11, 3) > 0) { + $pd[14] = 1; + } + + /* LEVEL 4 */ + if ($this->testSt(12, 4) > 0 || $this->testSt(13, 2) > 0) { + $pd[13] = 1; + } + if ($this->testSt(12, 2) > 0 || $this->testSt(11, 4) > 0) { + $pd[12] = 1; + } + if ($this->testSt(13, 1) > 0 || $this->testSt(17, 3) > 0) { + $pd[11] = 1; + } //8 + if ($this->testSt(11, 1) > 0 || $this->testSt(16, 3) > 0) { + $pd[10] = 1; + } //7 + if ($this->testSt(12, 1) > 0 || $this->testSt(15, 3) > 0) { + $pd[9] = 1; + } + if ($this->testSt(14, 1) > 0 || $this->testSt(18, 3) > 0) { + $pd[6] = 1; + } //2 + if ($this->testSt(10, 1) > 0 || $this->testSt(19, 3) > 0) { + $pd[5] = 1; + } //1 + if ($this->testSt(16, 4) > 0 || $this->testSt(15, 2) > 0) { + $pd[4] = 1; + } + if ($this->testSt(15, 4) > 0 || $this->testSt(17, 2) > 0) { + $pd[3] = 1; + } + + /* Генерируем предметы на карте */ + + /* Генерируем персонажей и ботов на карте */ + + } + + public function getMatrix($y, $x) + { + global $u; + $this->cord['x']++; + $this->cord[($u->info['psevdo_y'] + $y) . '_' . ($u->info['psevdo_x'] + $x)] = $this->cord['x']; + return $this->map[0][($u->info['psevdo_y'] + $y) . '_' . ($u->info['psevdo_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); + $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 == 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; + } +} \ No newline at end of file diff --git a/_incl_data/class/__zv.php b/_incl_data/class/FightRequest.php similarity index 80% rename from _incl_data/class/__zv.php rename to _incl_data/class/FightRequest.php index ca34e581..1f4a243b 100644 --- a/_incl_data/class/__zv.php +++ b/_incl_data/class/FightRequest.php @@ -1,161 +1,69 @@ - 'групповые', 5 => 'хаотичные']; + private $z2n = [4 => 'группового', 5 => 'хаотичного']; + private $u; + private $zv_see; + public $test_s = ''; + public $error = ''; + + /** + * Заявки на бой. + */ + public function __construct() { - $result = []; + $this->u = User::start(); + unset($_POST['kingfight'], $_POST['nobot'], $_POST['mut_clever']); - $maxWeight = floor(self::sum($items, $key) / 2); - - $numItems = count($items); - - $sack = self::buildSack($numItems, $maxWeight); - - for ($n = 1; $n <= $numItems; $n++) { - // loop all items - for ($weight = 1; $weight <= $maxWeight; $weight++) { - $a = $sack[$n - 1][$weight]['value']; - $b = null; - $value = $items[$n - 1][$key]; - if ($value <= $weight) { - $b = $value + $sack[$n - 1][$weight - $value]['value']; - } - $sack[$n][$weight]['value'] = ($b === null ? $a : max($a, $b)); - $sack[$n][$weight]['take'] = ($b !== null && $b > $a); - } + $this->u->info['no_zv_key'] = true; + if (!isset($_GET['del_z_time']) || $_GET['del_z_time'] == null) { + return; } - - $setA = []; - $setB = []; - - for ($n = $numItems, $weight = $maxWeight; $n > 0; $n--) { - $item = $items[$n - 1]; - $value = $item[$key]; - if ($sack[$n][$weight]['take']) { - $setA[] = $item; - } else { - $setB[] = $item; - } - $weight = $weight - $value; + $zay = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $this->u->info['zv'] . '" AND `creator` = "' . $this->u->info['id'] . '" AND `start` = 0 AND `cancel` = 0 AND `btl_id` = 0 ORDER BY `id` DESC LIMIT 1')); + if (!isset($zay['id']) || $zay['priz'] != 0) { + return; } - - return [$setA, $setB]; - } - - protected static function sum($items, $key) - { - $sum = 0; - foreach ($items as $item) { - $sum += $item[$key]; - } - return $sum; - } - - protected static function buildSack($width, $height) - { - $sack = []; - for ($x = 0; $x <= $width; $x++) { - $sack[$x] = []; - for ($y = 0; $y <= $height; $y++) { - $sack[$x][$y] = [ - 'value' => 0, - 'take' => false - ]; - } - } - return $sack; - } -} - -unset($_POST['kingfight'], $_POST['nobot'], $_POST['mut_clever']); - -session_start(); - -function add_effn($uid, $id) -{ - $g = [0 => 0, 1 => '']; - $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $id . '" LIMIT 1')); - if (isset($eff['id2'])) { - $n = $eff['mname']; - $d = $eff['mdata']; - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . $uid . '","' . $n . '","' . time() . '","' . $d . '")'); - if ($ins) { - $g[0] = 1; - $g[1] = '...'; - } - } - return $g; -} - -$u->info['no_zv_key'] = true; -$moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); - -if (isset($_GET['del_z_time']) && $_GET['del_z_time'] != null) { - $zay = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $u->info['zv'] . '" AND `creator` = "' . $u->info['id'] . '" AND `start` = 0 AND `cancel` = 0 AND `btl_id` = 0 ORDER BY `id` DESC LIMIT 1')); - if (isset($zay['id']) && $zay['priz'] == 0) { $colls = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $zay['id'] . '"')); $cs = $colls[0]; - if ($u->info['zv'] == $zay['id'] && ($zay['creator'] == $u->info['id'])) { - if ($cs == 1) { - mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `zayvki` WHERE `id` = "' . $zay['id'] . '" LIMIT 1'); - $test_s = 'Заявка удалена...'; - } else { - $test_s = 'Кто-то кроме вас уже участвует в данной заявке.'; - } + if ($this->u->info['zv'] != $zay['id'] || $zay['creator'] != $this->u->info['id']) { + $this->test_s = 'Вы не в этой заявке , либо не вы её создали.'; + } elseif ($cs != 1) { + $this->test_s = 'Кто-то кроме вас уже участвует в данной заявке.'; } else { - $test_s = 'Вы не в этой заявке , либо не вы её создали.'; + mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `zayvki` WHERE `id` = "' . $zay['id'] . '" LIMIT 1'); + $this->test_s = 'Заявка удалена...'; } - } -} -class zayvki -{ - public $zv_see, $error, $z1n = [4 => 'групповые', 5 => 'хаотичные'], $z2n = [4 => 'группового', 5 => 'хаотичного']; - - public function testTravm() - { - global $u; - $r = 0; - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if (isset($tr_pl['id'])) { - //Проверяем костыли - if ($tr_pl['v1'] == 1) { - //все ок - } elseif ($tr_pl['v1'] == 2) { - $r = 1; - } elseif ($tr_pl['v1'] == 3) { - $r = 2; - } - } - return $r; + $this->test(); //проверяем заявки } - public function test() + private function add_effn($uid, $id) { - global $code, $c, $u; - - if ($u->info['zv'] > 0) { - $test_zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $u->info['zv'] . '" LIMIT 1')); - if (!isset($test_zv['id'])) { - $u->info['zv'] = 0; - } else { - if ($test_zv['cancel'] > 0 || $test_zv['btl_id'] > 0) { - $u->info['zv'] = 0; - } - if ($test_zv['time'] < time() - 3600) { - $u->info['zv'] = 0; - } - } - if ($u->info['zv'] == 0) { - mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $g = [0 => 0, 1 => '']; + $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $id . '" LIMIT 1')); + if (isset($eff['id2'])) { + $n = $eff['mname']; + $d = $eff['mdata']; + $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . $uid . '","' . $n . '","' . time() . '","' . $d . '")'); + if ($ins) { + $g[0] = 1; + $g[1] = '...'; } } + return $g; + } + private function testTravm() + { + $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->u->info['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); + return isset($tr_pl['id']) ? $tr_pl['v1'] - 1 : 0; + } + + private function testTurnir() + { //Проверяем турниры в этом городе $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"'); while ($pl = mysql_fetch_array($sp)) { @@ -204,9 +112,12 @@ class zayvki } } } + } + private function testGroupAndChaotic() + { //Проверяем хаотичные и групповые бои в этом городе - $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE /*`z`.`city` = "' . $u->info['city'] . '" AND*/ `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 22'); + $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 22'); while ($pl = mysql_fetch_array($sp)) { $uz = mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '"'); $tm1 = []; @@ -226,7 +137,7 @@ class zayvki $toChat .= '' . $t['login'] . ','; $toWhere .= 'OR `id` = "' . $t['id'] . '" '; if ($pl['razdel'] == 5 && $pl['time_start'] - 180 < time() - $pl['time'] && $pl['send'] == 0) { - $toChat2 .= '' . $u->microLogin2($t) . ', '; + $toChat2 .= '' . $this->u->microLogin2($t) . ', '; } $i[$t['team']]++; } @@ -267,45 +178,68 @@ class zayvki } } - public function testCronZv() + /** Проверяем заявки + * @return void + */ + private function test() { - global $code, $c, $u; + if ($this->u->info['zv'] > 0) { + $test_zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $this->u->info['zv'] . '" LIMIT 1')); + if (!isset($test_zv['id'])) { + $this->u->info['zv'] = 0; + } else { + if ($test_zv['cancel'] > 0 || $test_zv['btl_id'] > 0) { + $this->u->info['zv'] = 0; + } + if ($test_zv['time'] < time() - 3600) { + $this->u->info['zv'] = 0; + } + } + if ($this->u->info['zv'] == 0) { + mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + } + } - $back_test = false; + $this->testTurnir(); + $this->testGroupAndChaotic(); + } + + private function testCronTurnir() + { //Проверяем турниры в этом городе $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"'); while ($pl = mysql_fetch_array($sp)) { - //Начало турнира - if ($pl['status'] == 0 && $pl['time'] < time()) { - if ($pl['users_in'] > 1) { - //Начало турнира - mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - - $usp = mysql_query('SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']); - while ($ur = mysql_fetch_array($usp)) { - mysql_query('INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")'); - $uri = mysql_insert_id(); - mysql_query('INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")'); - $zid = 0; - $x1 = 0; - $y1 = 0; - mysql_query('INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')'); - mysql_query('UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1'); - //Добавляем эффекты скорость регена и запрет передвижения - - } - - } else { - //Отмена турнира - mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"'); + if ($pl['status'] != 0 || $pl['time'] >= time()) { + continue; + } + if ($pl['users_in'] > 1) { + //Начало турнира + mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $usp = mysql_query('SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']); + while ($ur = mysql_fetch_array($usp)) { + mysql_query('INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")'); + $uri = mysql_insert_id(); + mysql_query('INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")'); + $zid = 0; + $x1 = 0; + $y1 = 0; + mysql_query('INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')'); + mysql_query('UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1'); + //Добавляем эффекты скорость регена и запрет передвижения } + } else { + //Отмена турнира + mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"'); } } + } + private function testCronGroupAndChaotic() + { //Проверяем хаотичные и групповые бои в этом городе $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 1000'); while ($pl = mysql_fetch_array($sp)) { @@ -327,125 +261,131 @@ class zayvki $toWhere .= 'OR `id` = "' . $t['id'] . '" '; $i[$t['team']]++; } - if ($pl['time_start'] <= time() - $pl['time'] || ($pl['razdel'] == 4 && $i[1] >= $pl['tm1max'] && $i[2] >= $pl['tm2max'])) { - $toChat = rtrim($toChat, ','); - $toWhere = ltrim($toWhere, 'OR '); - if ($pl['razdel'] == 4) { - //группы - if (!isset($i[1]) || !isset($i[2])) { - //группа не набрана - $this->cancelGroup($pl, $toChat); - } else { - //Начинаем поединок - $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); + if ($pl['time_start'] > time() - $pl['time'] && ($pl['razdel'] != 4 || $i[1] < $pl['tm1max'] || $i[2] < $pl['tm2max'])) { + continue; + } + $toChat = rtrim($toChat, ','); + $toWhere = ltrim($toWhere, 'OR '); + if ($pl['razdel'] == 4) { + //группы + if (!isset($i[1]) || !isset($i[2])) { + //группа не набрана + $this->cancelGroup($pl, $toChat); + } else { + //Начинаем поединок + $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); + } + } elseif ($pl['razdel'] == 5) { + //хаоты + $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1')); + if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) { + $rcf = mysql_fetch_array(mysql_query('SELECT `id`,`btl_cof` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" ORDER BY `btl_cof` DESC LIMIT 1')); + $rcf = $rcf['btl_cof']; + //группа не набрана + //Добавляем недостающих игроков + $lvl_btl_exp = [ + 0 => 0, + 1 => 110, + 2 => 420, + 3 => 1300, + 4 => 2500, + 5 => 5000, + 6 => 12500, + 7 => 30000, + 8 => 300000, + 9 => 3000000, + 10 => 10000000, + 11 => 52000000, + 12 => 63000000, + 13 => 182000000, + 14 => 212000000, + 15 => 352000000, + 16 => 504000000, + 17 => 1187000000, + 18 => 2455000000, + 19 => 4387000000, + 20 => 6355000000, + 21 => 15500000000, + 22 => 755500000000 + ]; + $bot_users = []; + + if ($pl['min_lvl_1'] <= 8 && $pl['max_lvl_1'] <= 8 && $pl['nobot'] == 0) { + $bsp = mysql_query('SELECT + `u`.`id`, + `u`.`login`, + `u`.`level`, + `s`.`stats`, + `u`.`cityreg`, + `u`.`sex`, + `u`.`obraz`, + `s`.`upLevel`, + `s`.`priems`, + `s`.`btl_cof` + FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`exp` >= ' . $lvl_btl_exp[$pl['min_lvl_1']] . ' AND `s`.`exp` < ' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ' AND `s`.`bot` = "0" ORDER BY `s`.`btl_cof` DESC LIMIT 50'); + while ($bpl = mysql_fetch_array($bsp)) { + $bot_users[] = $bpl; + } } - } elseif ($pl['razdel'] == 5) { - //хаоты - $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1')); - if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) { - $rcf = mysql_fetch_array(mysql_query('SELECT `id`,`btl_cof` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" ORDER BY `btl_cof` DESC LIMIT 1')); - $rcf = $rcf['btl_cof']; - //группа не набрана - //Добавляем недостающих игроков - $lvl_btl_exp = [ - 0 => 0, - 1 => 110, - 2 => 420, - 3 => 1300, - 4 => 2500, - 5 => 5000, - 6 => 12500, - 7 => 30000, - 8 => 300000, - 9 => 3000000, - 10 => 10000000, - 11 => 52000000, - 12 => 63000000, - 13 => 182000000, - 14 => 212000000, - 15 => 352000000, - 16 => 504000000, - 17 => 1187000000, - 18 => 2455000000, - 19 => 4387000000, - 20 => 6355000000, - 21 => 15500000000, - 22 => 755500000000 - ]; - $bot_users = []; - if ($pl['min_lvl_1'] <= 8 && $pl['max_lvl_1'] <= 8 && $pl['nobot'] == 0) { - $bsp = mysql_query('SELECT - `u`.`id`, - `u`.`login`, - `u`.`level`, - `s`.`stats`, - `u`.`cityreg`, - `u`.`sex`, - `u`.`obraz`, - `s`.`upLevel`, - `s`.`priems`, - `s`.`btl_cof` - FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`exp` >= ' . $lvl_btl_exp[$pl['min_lvl_1']] . ' AND `s`.`exp` < ' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ' AND `s`.`bot` = "0" ORDER BY `s`.`btl_cof` DESC LIMIT 50'); - while ($bpl = mysql_fetch_array($bsp)) { - $bot_users[] = $bpl; - } - } + $mincs = 4; + if ($pl['fastfight'] > 0) { + $mincs = 2; + } - $mincs = 4; - if ($pl['fastfight'] > 0) { - $mincs = 2; - } - - if (count($bot_users) == 0) { - if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) { - $text = ' Не удалось начать поединок по причине: Группа не набрана. (' . $pl['id'] . ': ' . count($bot_users) . ' ' . $lvl_btl_exp[$pl['min_lvl_1']] . '-' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ')'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','LEL','" . $text . "','" . time() . "','6','0')"); - $this->cancelGroup($pl, $toChat); - } - } else { - $j = 0; - $k = 0; - $bot_users_new = []; - while ($j < $mincs - $i[0]) { - $botlg = $bot_users[rand(0, count($bot_users) - 1)]; - $j++; - $clone = [ - 'id' => $botlg['id'], - 'login' => 'Боец (клон ' . $j . ')', - 'level' => $botlg['level'], - 'city' => $pl['city'], - 'cityreg' => $pl['city'], - 'name' => 'Боец', - 'sex' => $botlg['sex'], - 'deviz' => '', - 'hobby' => '', - 'time_reg' => time(), - 'obraz' => $botlg['obraz'], - 'stats' => $botlg['stats'], - 'upLevel' => $botlg['upLevel'], - 'priems' => $botlg['priems'], - 'loclon' => true - ]; - $bot = $u->addNewbot(1, null, $clone, null, true); - if ($bot > 0) { - mysql_query('UPDATE `stats` SET `btl_cof` = "' . $botlg['btl_cof'] . '",`zv` = "' . $pl['id'] . '",`hpNow` = "100000",`mpNow` = "100000" WHERE `id` = "' . $bot . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "303",`battle` = "0" WHERE `id` = "' . $bot . '" LIMIT 1'); - $k++; - } - } - unset($bot_users, $bpl, $bsp, $bot); - if ($k + $i[0] >= 4 || ($pl['fastfight'] == 0 || $k + $i[0] >= 2)) { - $back_test = true; - } + if (empty($bot_users)) { + if ($pl['fastfight'] == 0 || $i[0] < 2) { + $text = ' Не удалось начать поединок по причине: Группа не набрана. (' . $pl['id'] . ': ' . count($bot_users) . ' ' . $lvl_btl_exp[$pl['min_lvl_1']] . '-' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ')'; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','LEL','" . $text . "','" . time() . "','6','0')"); + $this->cancelGroup($pl, $toChat); } } else { - //Начинаем поединок - $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); + $j = 0; + $k = 0; + while ($j < $mincs - $i[0]) { + $botlg = $bot_users[rand(0, count($bot_users) - 1)]; + $j++; + $clone = [ + 'id' => $botlg['id'], + 'login' => 'Боец (клон ' . $j . ')', + 'level' => $botlg['level'], + 'city' => $pl['city'], + 'cityreg' => $pl['city'], + 'name' => 'Боец', + 'sex' => $botlg['sex'], + 'deviz' => '', + 'hobby' => '', + 'time_reg' => time(), + 'obraz' => $botlg['obraz'], + 'stats' => $botlg['stats'], + 'upLevel' => $botlg['upLevel'], + 'priems' => $botlg['priems'], + 'loclon' => true + ]; + $bot = $this->u->addNewbot(1, null, $clone, null, true); + if ($bot > 0) { + mysql_query('UPDATE `stats` SET `btl_cof` = "' . $botlg['btl_cof'] . '",`zv` = "' . $pl['id'] . '",`hpNow` = 100000,`mpNow` = 100000 WHERE `id` = ' . $bot . ' LIMIT 1'); + mysql_query('UPDATE `users` SET `room` = 303,`battle` = 0 WHERE `id` = ' . $bot . ' LIMIT 1'); + $k++; + } + } + unset($bot_users, $bpl, $bsp, $bot); + if ($k + $i[0] >= 4 || ($pl['fastfight'] == 0 || $k + $i[0] >= 2)) { + $back_test = true; + } } + } else { + //Начинаем поединок + $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); } } } + return isset($back_test)? $back_test : false; + } + public function testCronZv() + { + $this->testCronTurnir(); + $back_test = $this->testCronGroupAndChaotic(); if ($back_test) { $this->testCronZv(); @@ -455,29 +395,28 @@ class zayvki public function userInfo() { - global $u, $c; $r = ''; - if ($u->stats['mpAll'] > 0) { - $pm = $u->stats['mpNow'] / $u->stats['mpAll'] * 100; + if ($this->u->stats['mpAll'] > 0) { + $pm = $this->u->stats['mpNow'] / $this->u->stats['mpAll'] * 100; } - $ph = $u->stats['hpNow'] / $u->stats['hpAll'] * 100; + $ph = $this->u->stats['hpNow'] / $this->u->stats['hpAll'] * 100; $dp = ''; - if ($u->stats['mpAll'] <= 0) { + if ($this->u->stats['mpAll'] <= 0) { $dp = 'margin-top:13px;'; } $r .= ' - +
  ' . $u->microLogin($u->info['id'], 1) . '  
  ' . $this->u->microLogin($this->u->info['id'], 1) . '   -
' . floor($u->stats['hpNow']) . '/' . $u->stats['hpAll'] . '
+
' . floor($this->u->stats['hpNow']) . '/' . $this->u->stats['hpAll'] . '
-
+
'; - if ($u->stats['mpAll'] > 0) { - $r .= '
' . floor($u->stats['mpNow']) . '/' . $u->stats['mpAll'] . '
+ if ($this->u->stats['mpAll'] > 0) { + $r .= '
' . floor($this->u->stats['mpNow']) . '/' . $this->u->stats['mpAll'] . '
-
+
'; } $r .= '
'; @@ -487,55 +426,54 @@ class zayvki public function cancelGroup($zv, $uids) { - global $u; - if ($zv['priz'] > 0) { $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $zv['id'] . '"'); } $upd = mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `zv` = "' . $zv['id'] . '"'); - if ($upd) { - $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '"'); - if ($upd && $uids != '') { - if ($zv['priz'] > 0) { - while ($pl = mysql_fetch_array($sp)) { - //Выдаем по 1 жетону - if ($zv['type'] == 33) //ТУТ група не набранна удаляем персонажа и выдаем жетон - { - $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "' . $pl['id'] . '"')); - if (isset($pld['id'])) { - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); - $u->addItem(4754, $pld['id'], ''); - $uids = $pld['id']; - mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); - } - } else { - $u->addItem(4754, $pl['id'], ''); - } - } - $text = ' Не удалось начать поединок по причине: Группа не набрана. Вы получаете Призовой Жетон (х1)'; - } else { - $text = ' Не удалось начать поединок по причине: Группа не набрана.'; - } - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','" . $uids . "','" . $text . "','" . time() . "','6','0')"); - } + if (!$upd) { + return; } + $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '"'); + if (!$upd || $uids == '') { + return; + } + if ($zv['priz'] > 0) { + while ($pl = mysql_fetch_array($sp)) { + //Выдаем по 1 жетону + if ($zv['type'] == 33) //ТУТ група не набранна удаляем персонажа и выдаем жетон + { + $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "' . $pl['id'] . '"')); + if (isset($pld['id'])) { + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); + $this->u->addItem(4754, $pld['id'], ''); + $uids = $pld['id']; + mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); + } + } else { + $this->u->addItem(4754, $pl['id'], ''); + } + } + $text = ' Не удалось начать поединок по причине: Группа не набрана. Вы получаете Призовой Жетон (х1)'; + } else { + $text = ' Не удалось начать поединок по причине: Группа не набрана.'; + } + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','" . $uids . "','" . $text . "','" . time() . "','6','0')"); } public function add() { - global $u, $c, $code; - if (isset($_GET['r']) && $u->info['inTurnirnew'] == 0) { + if (isset($_GET['r']) && $this->u->info['inTurnirnew'] == 0) { $r = round(intval($_GET['r'])); if (in_array($r, [1, 4, 5, 8, 10])) { $az = 1; - if ($r == 1 && $u->info['level'] > 0) { + if ($r == 1 && $this->u->info['level'] > 0) { $az = 0; $this->error = 'Вы уже выросли из ползунков ;)'; } - if (($r == 4 || $r == 5) && $u->info['level'] < 2) { + if (($r == 4 || $r == 5) && $this->u->info['level'] < 2) { $az = 0; $this->error = 'В ' . $this->z1n[$r] . ' бои только со второго уровня.'; } @@ -546,18 +484,18 @@ class zayvki } elseif ($this->testTravm() == 2) { $this->error = 'Вы травмированы. С такими увечьями невозможно сражаться.'; $az = 0; - } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { + } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { $this->error = 'Вы еще слишком ослаблены чтобы начать новый бой'; $az = 0; } - if ($u->info['zv'] > 0) { + if ($this->u->info['zv'] > 0) { $az = 0; $this->error = 'Вы уже находите в заявке.'; } if ($az == 1) { $nz = []; - $nz['city'] = $u->info['city']; - $nz['creator'] = $u->info['id']; + $nz['city'] = $this->u->info['city']; + $nz['creator'] = $this->u->info['id']; $nz['type'] = 0; if ($_POST['k'] == 1) { $nz['type'] = 1; @@ -589,7 +527,7 @@ class zayvki $nz['otmorozok'] = 0; $gad = 1; - if ($r == 5 && $u->info['level'] > 1) { + if ($r == 5 && $this->u->info['level'] > 1) { //хаотичный бой if ($_POST['startime2']) { $nz['time_start'] = (int)$_POST['startime2']; @@ -651,13 +589,13 @@ class zayvki $nz['min_lvl_1'] = 2; $nz['max_lvl_1'] = 21; } elseif ($lvl == 3) { - $nz['min_lvl_1'] = $u->info['level']; - $nz['max_lvl_1'] = $u->info['level']; + $nz['min_lvl_1'] = $this->u->info['level']; + $nz['max_lvl_1'] = $this->u->info['level']; $nz['min_lvl_2'] = $nz['min_lvl_1']; $nz['max_lvl_2'] = $nz['min_lvl_2']; } elseif ($lvl == 6) { - $nz['min_lvl_1'] = $u->info['level'] - 1; - $nz['max_lvl_2'] = $u->info['level'] + 1; + $nz['min_lvl_1'] = $this->u->info['level'] - 1; + $nz['max_lvl_2'] = $this->u->info['level'] + 1; } else { $nz['min_lvl_1'] = 2; $nz['max_lvl_1'] = 2; @@ -673,9 +611,9 @@ class zayvki $nz['travmaChance'] = 1; } $nz['timeout'] = $nz['timeout'] * 60; - $nz['tm1'] = $u->stats['reting']; + $nz['tm1'] = $this->u->stats['reting']; - if (!$u->info['no_zv_key'] && ($_POST['code21'] == 0 || $_POST['code21'] != $_SESSION['code2'] || $_SESSION['code2'] == 0 || !isset($_SESSION['code2']))) { + if (!$this->u->info['no_zv_key'] && ($_POST['code21'] == 0 || $_POST['code21'] != $_SESSION['code2'] || $_SESSION['code2'] == 0 || !isset($_SESSION['code2']))) { $this->error = 'Неправильный код подтверждения'; $gad = 0; } @@ -683,7 +621,7 @@ class zayvki $gad = 0; $this->error = 'Что-то не так...
'; } - } elseif ($r == 4 && $u->info['level'] > 1) { + } elseif ($r == 4 && $this->u->info['level'] > 1) { //групповой бой //здесь заносим и проверяем данные на гурпповой бой if ($_POST['startime']) { @@ -731,22 +669,22 @@ class zayvki $nz['max_lvl_1'] = 21; } elseif ($lvl == 1) { $nz['min_lvl_1'] = 2; - $nz['max_lvl_1'] = $u->info['level']; + $nz['max_lvl_1'] = $this->u->info['level']; } elseif ($lvl == 2) { $nz['min_lvl_1'] = 2; - $nz['max_lvl_1'] = $u->info['level'] - 1; + $nz['max_lvl_1'] = $this->u->info['level'] - 1; } elseif ($lvl == 3) { - $nz['min_lvl_1'] = $u->info['level']; - $nz['max_lvl_1'] = $u->info['level']; + $nz['min_lvl_1'] = $this->u->info['level']; + $nz['max_lvl_1'] = $this->u->info['level']; } elseif ($lvl == 4) { - $nz['min_lvl_1'] = $u->info['level']; - $nz['max_lvl_1'] = $u->info['level'] + 1; + $nz['min_lvl_1'] = $this->u->info['level']; + $nz['max_lvl_1'] = $this->u->info['level'] + 1; } elseif ($lvl == 5) { - $nz['min_lvl_1'] = $u->info['level'] - 1; - $nz['max_lvl_1'] = $u->info['level']; + $nz['min_lvl_1'] = $this->u->info['level'] - 1; + $nz['max_lvl_1'] = $this->u->info['level']; } elseif ($lvl == 6) { - $nz['min_lvl_1'] = $u->info['level'] - 1; - $nz['max_lvl_1'] = $u->info['level'] + 1; + $nz['min_lvl_1'] = $this->u->info['level'] - 1; + $nz['max_lvl_1'] = $this->u->info['level'] + 1; $nz['min_lvl_1'] = 99; } else { $this->error = 'Что-то не так...
'; @@ -760,22 +698,22 @@ class zayvki $nz['max_lvl_2'] = 21; } elseif ($lvl == 1) { $nz['min_lvl_2'] = 2; - $nz['max_lvl_2'] = $u->info['level']; + $nz['max_lvl_2'] = $this->u->info['level']; } elseif ($lvl == 2) { $nz['min_lvl_2'] = 2; - $nz['max_lvl_2'] = $u->info['level'] - 1; + $nz['max_lvl_2'] = $this->u->info['level'] - 1; } elseif ($lvl == 3) { - $nz['min_lvl_2'] = $u->info['level']; - $nz['max_lvl_2'] = $u->info['level']; + $nz['min_lvl_2'] = $this->u->info['level']; + $nz['max_lvl_2'] = $this->u->info['level']; } elseif ($lvl == 4) { - $nz['min_lvl_2'] = $u->info['level']; - $nz['max_lvl_2'] = $u->info['level'] + 1; + $nz['min_lvl_2'] = $this->u->info['level']; + $nz['max_lvl_2'] = $this->u->info['level'] + 1; } elseif ($lvl == 5) { - $nz['min_lvl_2'] = $u->info['level'] - 1; - $nz['max_lvl_2'] = $u->info['level']; + $nz['min_lvl_2'] = $this->u->info['level'] - 1; + $nz['max_lvl_2'] = $this->u->info['level']; } elseif ($lvl == 6) { - $nz['min_lvl_2'] = $u->info['level'] - 1; - $nz['max_lvl_2'] = $u->info['level'] + 1; + $nz['min_lvl_2'] = $this->u->info['level'] - 1; + $nz['max_lvl_2'] = $this->u->info['level'] + 1; $nz['min_lvl_2'] = 99; } else { $this->error = 'Что-то не так...
'; @@ -812,12 +750,12 @@ class zayvki } $bt2 = (int)$_POST['bots2']; - if ($bt2 != 0 && $r == 4 && $u->info['level'] > 1) { + if ($bt2 != 0 && $r == 4 && $this->u->info['level'] > 1) { $bt2 = 1; - $nz['min_lvl_2'] = $u->info['level']; - $nz['max_lvl_2'] = $u->info['level']; - $nz['min_lvl_1'] = $u->info['level']; - $nz['max_lvl_1'] = $u->info['level']; + $nz['min_lvl_2'] = $this->u->info['level']; + $nz['max_lvl_2'] = $this->u->info['level']; + $nz['min_lvl_1'] = $this->u->info['level']; + $nz['max_lvl_1'] = $this->u->info['level']; } else { $bt2 = 0; } @@ -844,11 +782,11 @@ class zayvki $nz['max_lvl_1'] = 21; $nz['max_lvl_2'] = 21; // - if (floor($u->info['align']) == 3) { + if (floor($this->u->info['align']) == 3) { $nz['align1'] = 3; $nz['align2'] = 1; $nz['align3'] = 7; - } elseif (floor($u->info['align']) == 7) { + } elseif (floor($this->u->info['align']) == 7) { $nz['align1'] = 7; $nz['align2'] = 1; $nz['align3'] = 3; @@ -921,8 +859,8 @@ class zayvki "' . $nz['withUser'] . '","' . $nz['tm1'] . '","' . $nz['tm2'] . '")'); $zid = mysql_insert_id(); if ($ins) { - mysql_query('UPDATE `stats` SET `zv`="' . $zid . '",`team`="1" WHERE `id`="' . $u->info['id'] . '" LIMIT 1'); - $u->info['zv'] = $zid; + mysql_query('UPDATE `stats` SET `zv`="' . $zid . '",`team`="1" WHERE `id`="' . $this->u->info['id'] . '" LIMIT 1'); + $this->u->info['zv'] = $zid; $this->error = 'Заявка на бой подана'; } else { $this->error = 'Вы не смогли подать заявку...' . $ins; @@ -936,19 +874,19 @@ class zayvki //тренеровочный бой public function addBot() { - global $u, $c, $code; + global $c; - if (($u->info['level'] <= $c['bot_level'] || $u->info['admin'] > 0) && $u->info['exp'] != 12499) { - $bot = $u->addNewbot($id['id'], null, $u->info['id'], null, true); + if (($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) && $this->u->info['exp'] != 12499) { + $bot = $this->u->addNewbot($id['id'], null, $this->u->info['id'], null, true); } else { $bot = false; } if (!$bot) { $this->error = 'Бои с монстрами, нежитью, клонами и прочими вурдалаками проводятся только для персонажей младше 8 уровня...
Со стороны посматривает Общий Враг, ему явно что-то не понравилось...
'; - } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r == 1)) { + } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r == 1)) { $this->error = 'Вы еще слишком ослаблены чтобы начать новый бой'; $az = 0; - } elseif ($u->info['align'] == 2) { + } elseif ($this->u->info['align'] == 2) { $this->error = 'Хаосники не могут сражаться здесь'; $az = 0; } elseif (!$bot) { @@ -968,7 +906,7 @@ class zayvki "' . $btl['nobot'] . '", "' . $btl['fastfight'] . '", "1", - "' . $u->info['city'] . '", + "' . $this->u->info['city'] . '", "' . time() . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", @@ -983,14 +921,14 @@ class zayvki if ($ins) { $btl_id = mysql_insert_id(); //обновляем данные о поединке - $u->info['enNow'] -= $trEn; - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $u->info['enNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpAll'] . '",`team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'); + $this->u->info['enNow'] -= $trEn; + $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); + mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->u->stats['hpAll'] . '",`team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'); //обновляем заявку, что бой начался - $u->info['battle'] = $btl_id; + $this->u->info['battle'] = $btl_id; //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')"); + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); die(''); } else { $this->error = 'Cannot start battle (no prototype "ABD0Clone")'; @@ -1001,19 +939,17 @@ class zayvki //тренеровочный бой public function addBotClone($uid) { - global $u, $c, $code; - - if ($u->info['online'] > 0) { - $bot = $u->addNewbot($id['id'], null, $uid, null, false); + if ($this->u->info['online'] > 0) { + $bot = $this->u->addNewbot($id['id'], null, $uid, null, false); } else { $bot = false; } if (!$bot) { $this->error = 'Не получилось начать поединок'; - } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { + } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { $this->error = 'Вы еще слишком ослаблены чтобы начать новый бой'; $az = 0; - } elseif ($u->info['align'] == 2) { + } elseif ($this->u->info['align'] == 2) { $this->error = 'Хаосники не могут сражаться здесь'; $az = 0; } elseif (!$bot) { @@ -1034,7 +970,7 @@ class zayvki "' . $btl['nobot'] . '", "' . $btl['fastfight'] . '", "1", - "' . $u->info['city'] . '", + "' . $this->u->info['city'] . '", "' . time() . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", @@ -1048,20 +984,20 @@ class zayvki if ($ins) { $btl_id = mysql_insert_id(); //обновляем данные о поединке - $u->info['enNow'] -= $trEn; - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $u->info['enNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $this->u->info['enNow'] -= $trEn; + $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); + mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'); //Если бой кулачный, то снимаем вещи if ($btl['type'] == 1) { - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $u->info['id'] . '" AND `inOdet`!=0'); + mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'); mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $bot . '" AND `inOdet`!=0'); } //обновляем заявку, что бой начался - $u->info['battle'] = $btl_id; + $this->u->info['battle'] = $btl_id; //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')"); + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); die(''); } else { $this->error = 'Cannot start battle (no prototype "ABD0Clone")'; @@ -1072,7 +1008,6 @@ class zayvki //Изломы public function startIzlom($id2, $lvl) { - global $u, $c, $code; $lvl = (int)$lvl; if ($lvl == 8) { @@ -1086,9 +1021,9 @@ class zayvki } $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); $logins_bot = []; - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null); + $bot = $this->u->addNewbot($id['id'], null, null, $logins_bot, null); if (isset($id['id']) && $bot) { $logins_bot = $bot['logins_bot']; @@ -1106,7 +1041,7 @@ class zayvki "' . $btl['kingfight'] . '", "' . $btl['nobot'] . '", "' . $btl['fastfight'] . '", - "' . $u->info['city'] . '", + "' . $this->u->info['city'] . '", "' . time() . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", @@ -1120,25 +1055,25 @@ class zayvki if ($ins) { $btl_id = mysql_insert_id(); //обновляем данные о поединке - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot['id'] . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot['id'] . '" LIMIT 2'); + mysql_query('UPDATE `stats` SET `team`="1" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); //обновляем заявку, что бой начался - $u->info['battle'] = $btl_id; + $this->u->info['battle'] = $btl_id; //Добавляем еще 2 бота $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $this->u->addNewbot($id['id'], null, null, $logins_bot, null); if (isset($id['id']) && $bot) { $logins_bot = $bot['logins_bot']; mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); } $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $this->u->addNewbot($id['id'], null, null, $logins_bot, null); if (isset($id['id']) && $bot) { $logins_bot = $bot['logins_bot']; mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); @@ -1146,7 +1081,7 @@ class zayvki } //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')"); + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); die(''); } else { $this->error = 'Cannot start battle (no prototype "ABD0' . $id['id'] . '")'; @@ -1158,7 +1093,6 @@ class zayvki public function startBattle($id, $vars = null) { - global $c, $code, $u; $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . $id . '" AND `start` = "0" AND `cancel` = "0" AND (`time` > "' . (time() - 60 * 60 * 2) . '" OR `razdel` > 3) LIMIT 1')); if ($z['type'] == 33) { sleep(5); @@ -1364,20 +1298,20 @@ class zayvki //обновляем заявку, что бой начался $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'); - $u->info['battle'] = $btl_id; + $this->u->info['battle'] = $btl_id; //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','-1','" . $vars[0] . "','" . time() . "','11','0','117')"); + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','-1','" . $vars[0] . "','" . time() . "','11','0','117')"); } } elseif ($z['razdel'] >= 1 && $z['razdel'] <= 3) { //начало PvP - if ($u->info['team'] == 1 && $u->info['zv'] == $z['id']) { + if ($this->u->info['team'] == 1 && $this->u->info['zv'] == $z['id']) { $zu = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1')); if (isset($zu['id'])) { $uz = mysql_fetch_array(mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1')); if ($zu['clone'] > 0) { //обновляем клона - $bot = $u->addNewbot(1, null, $zu['clone'], null, true); + $bot = $this->u->addNewbot(1, null, $zu['clone'], null, true); if ($bot > 0) { mysql_query('DELETE FROM `users` WHERE `id` = "' . $zu['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `stats` WHERE `id` = "' . $zu['id'] . '" LIMIT 1'); @@ -1393,7 +1327,7 @@ class zayvki //создаем поединок $btl_id = 0; - if ($uz['money'] < $z['money'] || $u->info['money'] < $z['money']) { + if ($uz['money'] < $z['money'] || $this->u->info['money'] < $z['money']) { $z['money'] = 0; } $btl = ['otmorozok' => $z['otmorozok'], 'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => 0, 'noinc' => 0, 'typeBattle' => 0, 'addExp' => 0, 'money' => round($z['money'], 2), 'money3' => 0]; @@ -1407,7 +1341,7 @@ class zayvki "' . mysql_real_escape_string($btl['kingfight']) . '", "' . mysql_real_escape_string($btl['nobot']) . '", "' . mysql_real_escape_string($btl['fastfight']) . '", - "' . $u->info['city'] . '", + "' . $this->u->info['city'] . '", "' . time() . '", "' . mysql_real_escape_string($btl['players']) . '", "' . mysql_real_escape_string($btl['timeout']) . '", @@ -1422,21 +1356,21 @@ class zayvki if ($ins) { //обновляем данные о поединке $upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '" LIMIT 2'); - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $zu['id'] . '" LIMIT 2'); + $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $zu['id'] . '" LIMIT 2'); //Если бой кулачный, то снимаем вещи if ($z['type'] == 1) { - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $u->info['id'] . '" AND `inOdet`!=0'); + mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'); mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $zu['id'] . '" AND `inOdet`!=0'); } //обновляем заявку, что бой начался $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'); - $u->info['battle'] = $btl_id; + $this->u->info['battle'] = $btl_id; //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $uz['login'] . "','" . time() . "','11','0','117')"); + mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $uz['login'] . "','" . time() . "','11','0','117')"); die(''); } else { $this->error = 'Ошибка создания битвы.'; @@ -1455,11 +1389,11 @@ class zayvki public function cancelzv() { - global $u, $c, $code, $zi; + global $zi; if (isset($_GET['cancelzv'], $zi['id']) && $zi['razdel'] >= 1 && $zi['razdel'] <= 3) { $enemy = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "2" LIMIT 1')); if (isset($enemy['id'])) { - if ($u->info['team'] == 1) { + if ($this->u->info['team'] == 1) { //выкидываем из заявки + пишем сообщение в чат $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1'); if ($upd) { @@ -1467,13 +1401,13 @@ class zayvki $this->error = 'Вы отказали ' . $enemy['login'] . ' в поединке'; //отправляем сообщение в чат $sa = ''; - if ($u->info['sex'] == 2) { + if ($this->u->info['sex'] == 2) { $sa = 'а'; } - $text = ' [login:' . $u->info['login'] . '] отказал' . $sa . ' вам в поединке.'; + $text = ' [login:' . $this->u->info['login'] . '] отказал' . $sa . ' вам в поединке.'; mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $enemy['city'] . "','','','" . $enemy['login'] . "','" . $text . "','" . time() . "','6','0')"); } - } elseif ($u->info['id'] == $enemy['id'] && $zi['start'] == 0) { + } elseif ($this->u->info['id'] == $enemy['id'] && $zi['start'] == 0) { //выкидываем из заявки + пишем сообщение в чат $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1'); if ($upd) { @@ -1482,14 +1416,14 @@ class zayvki $this->error = 'Вы отозвали свой запрос на бой.'; //отправляем сообщение в чат $sa = ''; - if ($u->info['sex'] == 2) { + if ($this->u->info['sex'] == 2) { $sa = 'а'; } - $text = ' [login:' . $u->info['login'] . '] отозвал' . $sa . ' свой запрос на бой.'; + $text = ' [login:' . $this->u->info['login'] . '] отозвал' . $sa . ' свой запрос на бой.'; mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz['city'] . "','','','" . $uz['login'] . "','" . $text . "','" . time() . "','6','0')"); } - $u->info['zv'] = 0; - $u->info['team'] = 0; + $this->u->info['zv'] = 0; + $this->u->info['team'] = 0; } } if ($enemy['bot'] == 1) { @@ -1500,14 +1434,14 @@ class zayvki mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100'); } } else { - if ($u->info['team'] == 1) { + if ($this->u->info['team'] == 1) { //удаляем заявку на бой $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zi['id'] . '" LIMIT 1'); if ($upd) { - mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); $this->error = 'Вы отозвали свою заявку'; $zi = false; - $u->info['zv'] = 0; + $this->u->info['zv'] = 0; } } } @@ -1516,27 +1450,27 @@ class zayvki public function see() { - global $u, $c, $code, $zi, $cron; + global $c, $code, $zi; if (isset($_GET['r']) && ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id']))) { $r = round(intval($_GET['r'])); if (in_array($r, [1, 4, 5, 8, 10])) { $this->zv_see = 1; - if ($u->room['FR'] == 0 && $u->room['zvsee'] == 0) { + if ($this->u->room['FR'] == 0 && $this->u->room['zvsee'] == 0) { echo '


Подать заявку можно только в комнатах бойцовского клуба
'; $this->zv_see = 0; - } elseif ($r == 1 && $u->info['level'] > 0) { + } elseif ($r == 1 && $this->u->info['level'] > 0) { echo '


Вы уже выросли из ползунков ;)
'; $this->zv_see = 0; - } elseif ($r > 1 && $r < 6 && $u->info['level'] < 1) { + } elseif ($r > 1 && $r < 6 && $this->u->info['level'] < 1) { echo '


Вы еще не выросли из ползунков ;)
'; $this->zv_see = 0; - } elseif ($r > 3 && $r < 6 && $u->info['level'] < 2) { + } elseif ($r > 3 && $r < 6 && $this->u->info['level'] < 2) { echo '


В ' . $this->z1n[$r] . ' бои только со второго уровня.
'; $this->zv_see = 0; - } elseif ($r == 1 && $u->info['level'] > 0) { + } elseif ($r == 1 && $this->u->info['level'] > 0) { echo '


Вы уже выросли из ползунков ;)
'; $this->zv_see = 0; - } elseif ($r == 8 && $u->info['level'] < 1) { + } elseif ($r == 8 && $this->u->info['level'] < 1) { echo '


Принимать участие в турнире только с первого уровня.
'; $this->zv_see = 0; } elseif ($r == 10) { @@ -1549,7 +1483,7 @@ class zayvki if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) { unset($_SESSION['bypass']); if (array_key_exists('tournament_start', $_POST)) { - (new \Insallah\Tournament())->join($u->info['id']); + (new \Insallah\Tournament())->join($this->u->info['id']); } } ## @@ -1573,10 +1507,10 @@ class zayvki Внимание!
  • В случае создания либо присоединения к Турниру, покинуть его - невозможно!
  • - info['id'])): ?> -
  • Стоимость предметов, одетых на вас не должна превышать info['level']) ?> еврокредитов.
  • + u->info['id'])): ?> +
  • Стоимость предметов, одетых на вас не должна превышать u->info['level']) ?> еврокредитов.
  • - info['exp'] < \Insallah\Tournament::MIN_EXP): ?> + u->info['exp'] < \Insallah\Tournament::MIN_EXP): ?>
  • У вас должно быть не менее опыта.
  • Турнир начнётся, когда в заявке наберётся человек.
  • @@ -1589,7 +1523,7 @@ class zayvki - info['id']) || !\Insallah\TournamentModel::isStarted($u->info['level'])): ?> + u->info['id']) || !\Insallah\TournamentModel::isStarted($this->u->info['level'])): ?>
    @@ -1606,14 +1540,14 @@ class zayvki info['zv'] > 0 && $u->info['battle'] == 0 && $r != 8) { + } elseif ($this->u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) { if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) { echo '
    '; - if ($u->info['team'] == 1) { + if ($this->u->info['team'] == 1) { $uz = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="2" LIMIT 1')); if (!isset($uz['id'])) { //если никто не принял @@ -1624,12 +1558,12 @@ class zayvki if ($uz['sex'] == 2) { $sa = 'а'; } - echo 'Вашу заявку принял' . $sa . ' ' . $ca . ' ' . $u->microLogin($uz['id'], 1) . ' Хотите подтвердить бой? '; + echo 'Вашу заявку принял' . $sa . ' ' . $ca . ' ' . $this->u->microLogin($uz['id'], 1) . ' Хотите подтвердить бой? '; } } else { $uz = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="1" LIMIT 1')); if (isset($uz['id'])) { - echo 'Ожидаем подтверждения боя от ' . $u->microLogin($uz['id'], 1) . ' '; + echo 'Ожидаем подтверждения боя от ' . $this->u->microLogin($uz['id'], 1) . ' '; } } echo '
    '; @@ -1648,13 +1582,13 @@ class zayvki 2 => 'Захват ключа!' ]; - if (isset($_POST['trn1']) && $u->room['zvsee'] == 0) { - if ($u->info['inTurnirnew'] == 0) { + if (isset($_POST['trn1']) && $this->u->room['zvsee'] == 0) { + if ($this->u->info['inTurnirnew'] == 0) { $totr = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string($_POST['trn1']) . '" AND `status` = "0" LIMIT 1')); if (isset($totr['id'])) { - mysql_query('UPDATE `users` SET `inTurnirnew` = "' . $totr['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `inTurnirnew` = "' . $totr['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` + 1 WHERE `id` = "' . $totr['id'] . '" LIMIT 1'); - $u->info['inTurnirnew'] = $totr['id']; + $this->u->info['inTurnirnew'] = $totr['id']; $this->error = 'Вы записались на участие в турнире.'; } else { $this->error = 'Заявка на турнир не найдена.'; @@ -1662,13 +1596,13 @@ class zayvki } else { $this->error = 'Вы уже находитесь в заявке на турнир.'; } - } elseif (isset($_GET['cancel13']) && $u->room['zvsee'] == 0) { - if ($u->info['inTurnirnew'] > 0) { - $totr = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string($u->info['inTurnirnew']) . '" AND `status` = "0" LIMIT 1')); + } elseif (isset($_GET['cancel13']) && $this->u->room['zvsee'] == 0) { + if ($this->u->info['inTurnirnew'] > 0) { + $totr = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string($this->u->info['inTurnirnew']) . '" AND `status` = "0" LIMIT 1')); if (isset($totr['id'])) { - mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` - 1 LIMIT 1'); - $u->info['inTurnirnew'] = 0; + $this->u->info['inTurnirnew'] = 0; $this->error = 'Вы отказались от заявки на турнир.'; } else { $this->error = 'Нельзя отказаться от заявки находясь в турнире.'; @@ -1681,8 +1615,8 @@ class zayvki $dv = ''; $trse = ''; - if ($u->info['inTurnirnew'] > 0) { - $pl = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $u->info['inTurnirnew'] . '" LIMIT 1')); + if ($this->u->info['inTurnirnew'] > 0) { + $pl = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1')); if (!isset($pl['id'])) { mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); echo 'Что-то не так... Обновите страницу.'; @@ -1691,7 +1625,7 @@ class zayvki $spu = mysql_query('SELECT `u`.`id`,`u`.`align`,`u`.`login`,`u`.`clan`,`u`.`level`,`u`.`city`,`u`.`online`,`u`.`sex`,`u`.`cityreg`,`u`.`palpro`,`u`.`invis` FROM `users` AS `u` WHERE `u`.`inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']); $i = 1; while ($plu = mysql_fetch_array($spu)) { - $dv .= '
    ' . $i . '. ' . $u->microLogin($plu, 2) . '
    '; + $dv .= '
    ' . $i . '. ' . $this->u->microLogin($plu, 2) . '
    '; $i++; } echo ' @@ -1708,7 +1642,7 @@ class zayvki ' . $this->error . '
    - Начало турнира через ' . $u->timeOut($pl['time'] - time()) . ' + Начало турнира через ' . $this->u->timeOut($pl['time'] - time()) . '
    ' . $dv . ' @@ -1738,9 +1672,9 @@ class zayvki $j = 0; while ($pl = mysql_fetch_array($sp)) { $j++; - $dinf = 'Начало через ' . $u->timeOut($pl['time'] - time()) . ''; + $dinf = 'Начало через ' . $this->u->timeOut($pl['time'] - time()) . ''; $dv .= ''; @@ -1784,11 +1718,11 @@ class zayvki 1 => 'Если вы не достигли первого уровня, то для вас это единственный способ для проведения битв.', ]; $dv = ''; - if ($u->room['zvsee'] == 0) { - if ($u->info['level'] <= $c['bot_level'] || $u->info['admin'] > 0) { - $dv = 'Тренировочные бои доступны до ' . ($c['bot_level'] + 1) . '-го уровня. '; + if ($this->u->room['zvsee'] == 0) { + if ($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) { + $dv = 'Тренировочные бои доступны до ' . ($c['bot_level'] + 1) . '-го уровня. '; } else { - if ($u->info['level'] < 9) { + if ($this->u->info['level'] < 9) { $tstw = ' для 8 левелов недоступны'; } else { $tstw = ''; @@ -1802,12 +1736,12 @@ class zayvki
    '; } - if ($u->info['admin'] > 0) { + if ($this->u->info['admin'] > 0) { if (isset($_GET['adminbotatack'])) { $bot_atack = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . mysql_real_escape_string($_GET['adminbotatack']) . '" LIMIT 1')); if (isset($bot_atack['id'])) { $logins_bot = []; - $k = $u->addNewbot($bot_atack['id'], null, null, $logins_bot); + $k = $this->u->addNewbot($bot_atack['id'], null, null, $logins_bot); if (isset($k['id'])) { $expB = 0; $btl = [ @@ -1827,7 +1761,7 @@ class zayvki "0", "0", "0", - "' . $u->info['city'] . '", + "' . $this->u->info['city'] . '", "' . time() . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", @@ -1839,9 +1773,9 @@ class zayvki "' . $btl['addExp'] . '", "' . $btl['money'] . '")'); $btl_id = mysql_insert_id(); - mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" OR `id` = "' . $u->info['id'] . '" LIMIT 2'); + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" OR `id` = "' . $this->u->info['id'] . '" LIMIT 2'); mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); die(''); } } @@ -1882,7 +1816,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
    '; } } elseif ($r == 4) { - if ($u->room['zvsee'] == 0) { //групповые ?> + if ($this->u->room['zvsee'] == 0) { //групповые ?> @@ -2036,7 +1970,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $j = 0; while ($j < count($tmu[$tms[$j]])) { if ($tmu[$tms[$i]][$j] > 0) { - $tmsu .= $u->microLogin($tmu[$tms[$i]][$j], 1) . ', '; + $tmsu .= $this->u->microLogin($tmu[$tms[$i]][$j], 1) . ', '; } $j++; } @@ -2084,7 +2018,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $dt = round((int)$_GET['logs2']); } $dt = strtotime(date('d F Y', $dt) . ' 00:00:00'); - $slogin = $u->info['login']; + $slogin = $this->u->info['login']; if (isset($_GET['filter'])) { $slogin = $_GET['filter']; } @@ -2193,35 +2127,32 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 public function rzInfo($id) { - global $u; $r = ''; - $w = mysql_num_rows(mysql_query('SELECT * FROM `zayvki` WHERE `time` > ' . (time() - 7200) . ' AND `cancel` = "0" AND `start` = "0" AND `razdel` = "' . $id . '" AND (`min_lvl_1` <= ' . $u->info['level'] . ' OR `min_lvl_2` <= ' . $u->info['level'] . ') AND (`max_lvl_1` >= ' . $u->info['level'] . ' OR `max_lvl_2` >= ' . $u->info['level'] . ')')); + $w = mysql_num_rows(mysql_query('SELECT * FROM `zayvki` WHERE `time` > ' . (time() - 7200) . ' AND `cancel` = "0" AND `start` = "0" AND `razdel` = "' . $id . '" AND (`min_lvl_1` <= ' . $this->u->info['level'] . ' OR `min_lvl_2` <= ' . $this->u->info['level'] . ') AND (`max_lvl_1` >= ' . $this->u->info['level'] . ' OR `max_lvl_2` >= ' . $this->u->info['level'] . ')')); if ($w > 0) { $r = ' (' . $w . ')'; } return $r; } - public function testzvu($id, $tm, $bt) + public function testzvu($id, $tm, $bt = 0) { - $r = 0; - if ($bt == 0) { - $r = mysql_num_rows(mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $id . '" AND `team` = "' . $tm . '"')); - } else { - $r = mysql_num_rows(mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $id . '" AND `team` = "' . $tm . '" AND `bot` = "2"')); + $query = "select id from stats where zv = $id and team = $tm"; + if ($bt) { + $query .= " and bot = 2"; } - return $r; + return mysql_num_rows(mysql_query($query)); } public function seeZv() { - global $u, $c, $code, $zi; + global $c, $code, $zi; if (isset($_GET['r']) && $this->zv_see == 1) { $r = round(intval($_GET['r'])); if ($r >= 1 && $r <= 5) { //Список заявок $i = 0; - $cl = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "' . mysql_real_escape_string($r) . '" AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" /*AND `city` = "' . $u->info['city'] . '"*/ ORDER BY `id` DESC'); + $cl = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "' . mysql_real_escape_string($r) . '" AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" /*AND `city` = "' . $this->u->info['city'] . '"*/ ORDER BY `id` DESC'); $zvb = ''; while ($pl = mysql_fetch_array($cl)) { @@ -2243,11 +2174,11 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"')); $cols = $col_p[0]; while ($s = mysql_fetch_array($users)) { - $tm .= $u->microLogin($s['id'], 1) . ', '; + $tm .= $this->u->microLogin($s['id'], 1) . ', '; } $rad = ''; $tm = rtrim($tm, ', '); - if (!isset($zi['id']) && $u->room['zvsee'] == 0 && $u->info['inTurnirnew'] == 0) { + if (!isset($zi['id']) && $this->u->room['zvsee'] == 0 && $this->u->info['inTurnirnew'] == 0) { $rad = ' '; } $n1tv = ''; @@ -2258,16 +2189,16 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $unvs = 0; $usrszv = ''; - //if( $u->info['admin'] > 0 ) { + //if( $this->u->info['admin'] > 0 ) { $spzm = mysql_query('SELECT `id`,`team` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" AND `id` != "' . $pl['creator'] . '"'); while ($plzm = mysql_fetch_array($spzm)) { - if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) { - $usrszv .= ',' . $u->microLogin($plzm['id'], 1) . ''; + if ($this->u->info['admin'] > 0 || ($this->u->info['align'] > 1 && $this->u->info['align'] < 2) || ($this->u->info['align'] > 3 && $this->u->info['align'] < 4)) { + $usrszv .= ',' . $this->u->microLogin($plzm['id'], 1) . ''; } $unvs++; } //} - $tm = '' . $u->microLogin($pl['creator'], 1) . '' . $usrszv . ' - ' . $tm; + $tm = '' . $this->u->microLogin($pl['creator'], 1) . '' . $usrszv . ' - ' . $tm; $unvs = ' Участников: ' . (1 + $unvs) . ' чел. '; $n1tv = ' '; @@ -2301,18 +2232,18 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } if ($pl['comment'] != '') { $dl = ''; - if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) { - $dl .= ' (удалить комментарий)'; - if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $u->newAct($_GET['key']) == true) { - mysql_query('UPDATE `zayvki` SET `dcom` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - $pl['dcom'] = $u->info['id']; + if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) { + $dl .= ' (удалить комментарий)'; + if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct($_GET['key']) == true) { + mysql_query('UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $pl['dcom'] = $this->u->info['id']; } } if ($pl['dcom'] > 0) { $dl = 'Комментарий удален модератором'; } if ($pl['dcom'] > 0) { - if ($moder['boi'] == 1 || $u->info['admin'] > 0) { + if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) { $pl['comment'] = '[ Текст комментария : ' . $pl['comment'] . '] '; } else { $pl['comment'] = ''; @@ -2329,7 +2260,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } $zv_comm = ' (Героическое Сражение' . $imn . ')'; } - if ($r == 5 && ($pl['creator'] == $u->info['id']) && $cols < 2 && $pl['priz'] == 0) { + if ($r == 5 && ($pl['creator'] == $this->u->info['id']) && $cols < 2 && $pl['priz'] == 0) { $del_q = '  '; } else { $del_q = ''; @@ -2370,7 +2301,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $logins_bot = []; while ($plb = mysql_fetch_array($spb)) { if ($xx2 < $pl['tm2max'] && rand(0, 10000) < 5000 && rand(0, 10000) > 5000) { - $bt = $u->addNewbot(0, '', $plb['id']); + $bt = $this->u->addNewbot(0, '', $plb['id']); $logins_bot = $bt['logins_bot']; if ($bt > 0) { mysql_query('UPDATE `stats` SET `zv` = "' . $pl['id'] . '",`team` = "2" WHERE `id` = "' . $bt . '" LIMIT 1'); @@ -2386,7 +2317,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $users = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`admin`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`zv` = "' . $pl['id'] . '"'); $tmc = []; while ($s = mysql_fetch_array($users)) { - ${'tm' . $s['team']} .= $u->microLogin($s['id'], 1) . ', '; + ${'tm' . $s['team']} .= $this->u->microLogin($s['id'], 1) . ', '; $tmc[$s['team']]++; } @@ -2442,23 +2373,23 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } // $rad = ''; - if (!isset($zi['id']) && $u->room['zvsee'] == 0) { + if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) { $rad = ' '; } if ($pl['comment'] != '') { $dl = ''; - if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) { - $dl .= ' (удалить комментарий)'; - if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $u->newAct($_GET['key']) == true) { - mysql_query('UPDATE `zayvki` SET `dcom` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - $pl['dcom'] = $u->info['id']; + if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) { + $dl .= ' (удалить комментарий)'; + if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct($_GET['key']) == true) { + mysql_query('UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $pl['dcom'] = $this->u->info['id']; } } if ($pl['dcom'] > 0) { $dl = 'Комментарий удален модератором'; } if ($pl['dcom'] > 0) { - if ($moder['boi'] == 1 || $u->info['admin'] > 0) { + if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) { $pl['comment'] = '[ Текст комментария : ' . $pl['comment'] . '] '; } else { $pl['comment'] = ''; @@ -2500,13 +2431,13 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 if (isset($uz['id'])) { $uze = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '" AND `st`.`team` = "2" LIMIT 1')); $d1 = ''; - if ($uz['id'] == $u->info['id'] || $uze['id'] == $u->info['id'] || $u->info['level'] <= $c['bot_level']) { + if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= $c['bot_level']) { $d1 = 'disabled="disabled"'; } - if (!isset($uze['id']) || $u->info['zv'] == $pl['id']) { + if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) { $enm = ''; if (isset($uze['id'])) { - $enm = ' против ' . $u->microLogin($uze['id'], 1) . ''; + $enm = ' против ' . $this->u->microLogin($uze['id'], 1) . ''; } if ($uz['banned'] > 0) { $pl['id'] = 0; @@ -2515,16 +2446,16 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } $dp1 = ''; if ($pl['money'] > 0) { - $dp1 = ' Бой на деньги, ставка: ' . $u->round2($pl['money']) . ' кр.'; + $dp1 = ' Бой на деньги, ставка: ' . $this->u->round2($pl['money']) . ' кр.'; } - if ($u->room['zvsee'] == 0) { + if ($this->u->room['zvsee'] == 0) { $zvb .= ''; } $mbcom = ''; if ($pl['comment'] != '') { $mbcom = ' ' . $pl['comment'] . ''; } - $zvb .= '' . date('H:i', $pl['time']) . ' ' . $u->microLogin($uz['id'], 1) . ' ' . $enm . ' тип боя: ( таймаут ' . round($pl['timeout'] / 60) . ' мин.' . $dp1 . ' ' . $mon . ')' . $mbcom . '
    '; + $zvb .= '' . date('H:i', $pl['time']) . ' ' . $this->u->microLogin($uz['id'], 1) . ' ' . $enm . ' тип боя: ( таймаут ' . round($pl['timeout'] / 60) . ' мин.' . $dp1 . ' ' . $mon . ')' . $mbcom . '
    '; if ($uz['banned'] > 0) { $zvb .= ''; } @@ -2535,13 +2466,13 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } if ($i == 0) { //заявок нет - if ($u->room['zvsee'] > 0) { + if ($this->u->room['zvsee'] > 0) { echo '


    В данном разделе нет ни одной заявки
    '; } } else { - if (!isset($zi['id']) && $u->room['zvsee'] == 0) { + if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) { if ($_GET['r'] == 5) { - if (!$u->info['no_zv_key']) { + if (!$this->u->info['no_zv_key']) { echo '

    Код подтверждения:
    ' . $zvb . ' Код подтверждения: @@ -2553,7 +2484,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
    '; } } else { - if ($zvb != '' && $u->info['level'] > $c['bot_level']) { + if ($zvb != '' && $this->u->info['level'] > $c['bot_level']) { echo '


    ' . $zvb . '
    '; } else { echo '
    ' . $zvb . '
    '; @@ -2569,10 +2500,13 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 public function go($id) { - global $u, $c, $code, $zi, $filter; - if (!isset($zi['id'])) { - if ($u->info['battle'] == 0 && $u->info['inTurnirnew'] == 0) { - $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . mysql_real_escape_string(intval($id)) . '" /*AND `city` = "' . $u->info['city'] . '"*/ AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" LIMIT 1')); + global $zi; + $filter = new Filter(); + if (isset($zi['id'])) { + $this->error = 'Вы не можете принять бой. Сначала отзовите свою заявку.'; + } else { + if ($this->u->info['battle'] == 0 && $this->u->info['inTurnirnew'] == 0) { + $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . mysql_real_escape_string(intval($id)) . '" /*AND `city` = "' . $this->u->info['city'] . '"*/ AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" LIMIT 1')); if (isset($z['id'])) { if ($z['razdel'] >= 1 && $z['razdel'] <= 3) { //новички, физы, договорные @@ -2585,19 +2519,19 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } elseif ($this->testTravm() == 2) { $this->error = 'Вы травмированы. С такими увечьями невозможно сражаться.'; $az = 0; - } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($z['razdel'] >= 1 || $z['razdel'] <= 3)) { + } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($z['razdel'] >= 1 || $z['razdel'] <= 3)) { $this->error = 'Вы еще слишком ослаблены чтобы начать новый бой'; $az = 0; - } elseif ($uz1['clan'] == $u->info['clan'] && $u->info['clan'] != 0 && $u->info['admin'] == 0 && true == false) { + } elseif ($uz1['clan'] == $this->u->info['clan'] && $this->u->info['clan'] != 0 && $this->u->info['admin'] == 0 && true == false) { $this->error = 'Вы не можете сражаться против сокланов'; - } elseif ($z['withUser'] != '' && $filter->mystr($u->info['login']) != $filter->mystr($z['withUser']) && $z['razdel'] == 3) { + } elseif ($z['withUser'] != '' && $filter->mystr($this->u->info['login']) != $filter->mystr($z['withUser']) && $z['razdel'] == 3) { $this->error = 'Вы не можете принять эту заявку'; - } elseif ($z['money'] > 0 && $z['money'] > $u->info['money']) { + } elseif ($z['money'] > 0 && $z['money'] > $this->u->info['money']) { $this->error = 'У Вас недостаточно денег, чтобы принять эту заявку'; - } elseif ($u->stats['hpNow'] < ceil($u->stats['hpMax'] / 100 * 30)) { + } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { $this->error = 'Вы слишком ослаблены, восстановитесь'; } elseif (!isset($uz2['id'])) { - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "2" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "2" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); if ($upd) { $ca = ''; if ($uz1['clan'] != 0) { @@ -2612,14 +2546,14 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } $this->error = 'Ожидаем подтверждения боя от ' . $ca . ' ' . $uz1['login'] . ' [' . $uz1['level'] . ']'; $sa = ''; - if ($u->info['sex'] == 2) { + if ($this->u->info['sex'] == 2) { $sa = 'а'; } - $text = ' [login:' . $u->info['login'] . '] принял' . $sa . ' вашу заявку на бой.[reflesh_main_zv_priem:' . $u->info['id'] . ']'; + $text = ' [login:' . $this->u->info['login'] . '] принял' . $sa . ' вашу заявку на бой.[reflesh_main_zv_priem:' . $this->u->info['id'] . ']'; mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz1['city'] . "','','','" . $uz1['login'] . "','" . $text . "','" . time() . "','6','0')"); $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = 2; + $this->u->info['zv'] = $z['id']; + $this->u->info['team'] = 2; } else { $this->error = 'Невозможно принять заявку.'; } @@ -2629,7 +2563,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } else { $this->error = 'Заявка на бой заблокирована.'; } - } elseif ($z['razdel'] == 4 && $u->info['level'] > 1) { + } elseif ($z['razdel'] == 4 && $this->u->info['level'] > 1) { $tm = 0; //групповые if (isset($_GET['tm1'])) { @@ -2649,7 +2583,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $cl111 = mysql_query('SELECT `u`.`clan`,`st`.`team`,`st`.`id`,`st`.`zv` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv` = "' . $z['id'] . '" LIMIT 200'); $cln = 0; while ($pc111 = mysql_fetch_array($cl111)) { - if ($pc111['clan'] == $u->info['clan'] && $u->info['clan'] != 0 && $pc111['team'] == $t2) { + if ($pc111['clan'] == $this->u->info['clan'] && $this->u->info['clan'] != 0 && $pc111['team'] == $t2) { $cln++; } if ($pc111['team'] == $t1) { @@ -2660,31 +2594,31 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $this->error = 'Вы не можете сражаться против сокланов'; } elseif ($z['bot2'] == 1 && $t1 == 2) { $this->error = 'Вы не можете сражаться на стороне ботов'; - } elseif ($z['money3'] > 0 && $z['money3'] > $u->info['money3']) { + } elseif ($z['money3'] > 0 && $z['money3'] > $this->u->info['money3']) { $this->error = 'У Вас недостаточно денег, чтобы принять эту заявку'; - } elseif (($z['money'] > 0 || $z['money3'] > 0) && $u->info['level'] < 4) { + } elseif (($z['money'] > 0 || $z['money3'] > 0) && $this->u->info['level'] < 4) { $this->error = 'Бои на деньги проводятся с 4-го уровня'; } elseif ($z['tm' . $t1 . 'max'] > $tmmax) { - if ($z['min_lvl_' . $t1] > $u->info['level'] || $z['max_lvl_' . $t1] < $u->info['level']) { + if ($z['min_lvl_' . $t1] > $this->u->info['level'] || $z['max_lvl_' . $t1] < $this->u->info['level']) { $this->error = 'Вы не подходите по уровню, за эту команду могут зайти персонажи ' . $z['min_lvl_' . $t1] . ' - ' . $z['max_lvl_' . $t1] . ' уровня'; - } elseif ($u->stats['hpNow'] < ceil($u->stats['hpMax'] / 100 * 30)) { + } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { $this->error = 'Вы слишком ослаблены, восстановитесь'; } else { - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . mysql_real_escape_string((int)$t1) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . mysql_real_escape_string((int)$t1) . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); if (!$upd) { $this->error = 'Ошибка приема заявки...'; } else { $this->error = 'Вы приняли групповой бой...'; $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = mysql_real_escape_string((int)$t1); + $this->u->info['zv'] = $z['id']; + $this->u->info['team'] = mysql_real_escape_string((int)$t1); } } } else { $this->error = 'Группа уже набрана (' . ($z['tm' . $t1 . 'max'] - $tmmax) . ')'; } } - } elseif ($z['razdel'] == 5 && $u->info['level'] > 1) { + } elseif ($z['razdel'] == 5 && $this->u->info['level'] > 1) { //хаотичные $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"')); $cols = $col_p[0]; @@ -2694,13 +2628,13 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $this->error = 'Вы травмированы. С такими увечьями доступны кулачные бои.'; } elseif ($this->testTravm() == 2) { $this->error = 'Вы травмированы. С такими увечьями невозможно сражаться.'; - } elseif (!$u->info['no_zv_key'] && (!isset($_SESSION['code2']) || $_SESSION['code2'] < 1 || ($_POST['code21'] != $_SESSION['code2'] && $_POST['code22'] != $_SESSION['code2']))) { + } elseif (!$this->u->info['no_zv_key'] && (!isset($_SESSION['code2']) || $_SESSION['code2'] < 1 || ($_POST['code21'] != $_SESSION['code2'] && $_POST['code22'] != $_SESSION['code2']))) { $this->error = 'Неправильный код подтверждения'; - } elseif ($z['min_lvl_1'] > $u->info['level'] || $z['max_lvl_1'] < $u->info['level']) { + } elseif ($z['min_lvl_1'] > $this->u->info['level'] || $z['max_lvl_1'] < $this->u->info['level']) { $this->error = 'Вы не подходите по уровню, за эту команду могут зайти персонажи ' . $z['min_lvl_1'] . ' - ' . $z['max_lvl_1'] . ' уровня'; - } elseif ($u->stats['hpNow'] < ceil($u->stats['hpMax'] / 100 * 30)) { + } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { $this->error = 'Вы слишком ослаблены, восстановитесь'; - } elseif ($z['money'] > 0 && $u->info['level'] < 4) { + } elseif ($z['money'] > 0 && $this->u->info['level'] < 4) { $this->error = 'Бои на деньги проводятся с 4-го уровня'; } else { $t1 = 0; @@ -2711,12 +2645,12 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 mysql_query('INSERT INTO `users` (`name`,`align`,`real`,`login`,`host_reg`,`pass`,`ip`,`ipreg`,`city`,`cityreg`,`room`,`timereg`, `activ`,`mail`,`bithday`,`sex`,`fnq`,`battle`,`design`,`molch2`,`level` ) VALUES ( - "' . $u->info['name'] . '", - "' . $u->info['align'] . '", + "' . $this->u->info['name'] . '", + "' . $this->u->info['align'] . '", "1", - "' . $u->info['login'] . '", + "' . $this->u->info['login'] . '", "0", - "' . $u->info['pass'] . '", + "' . $this->u->info['pass'] . '", "' . mysql_real_escape_string(IP) . '", "' . mysql_real_escape_string(IP) . '", "capitalcity", @@ -2726,7 +2660,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 "0", "haot@new-combats.com", "01.01.1980", - "' . $u->info['sex'] . '", + "' . $this->u->info['sex'] . '", "0", "0", "1", @@ -2735,84 +2669,84 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 )'); $uidb = mysql_insert_id(); - mysql_query('UPDATE `users` SET `inUser` = "' . $uidb . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `inUser` = "' . $uidb . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); //тут классы $sellclass = rand(1, 6); if ($sellclass == 1) { //уворот класс 1 - $us = add_effn($uidb, 8); // ловка - $us = add_effn($uidb, 20); // сокрушение + $us = $this->add_effn($uidb, 8); // ловка + $us = $this->add_effn($uidb, 20); // сокрушение mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=21|s2=31|s3=16|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=10|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',-75,-9,100000)"); - $re = $u->addItem(525, $uidb); + $re = $this->u->addItem(525, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "525" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(539, $uidb); + $re = $this->u->addItem(539, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "539" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(523, $uidb); + $re = $this->u->addItem(523, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "523" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(523, $uidb); + $re = $this->u->addItem(523, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "523" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(290, $uidb); + $re = $this->u->addItem(290, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "290" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(541, $uidb); + $re = $this->u->addItem(541, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "541" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(633, $uidb); + $re = $this->u->addItem(633, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "633" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(647, $uidb); + $re = $this->u->addItem(647, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "647" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(680, $uidb); + $re = $this->u->addItem(680, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "680" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(685, $uidb); + $re = $this->u->addItem(685, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(685, $uidb); + $re = $this->u->addItem(685, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(685, $uidb); + $re = $this->u->addItem(685, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(1151, $uidb); + $re = $this->u->addItem(1151, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1151" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(707, $uidb); + $re = $this->u->addItem(707, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "707" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(712, $uidb); + $re = $this->u->addItem(712, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "712" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -2820,78 +2754,78 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 //уворот класс закончен } elseif ($sellclass == 2) { //крит класс 2 - $us = add_effn($uidb, 7); // инта - $us = add_effn($uidb, 20); // сокрушение + $us = $this->add_effn($uidb, 7); // инта + $us = $this->add_effn($uidb, 20); // сокрушение mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=24|s2=20|s3=24|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=9|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(527, $uidb); + $re = $this->u->addItem(527, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "527" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(537, $uidb); + $re = $this->u->addItem(537, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "537" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(567, $uidb); + $re = $this->u->addItem(567, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "567" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(723, $uidb); + $re = $this->u->addItem(723, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "723" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(291, $uidb); + $re = $this->u->addItem(291, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(544, $uidb); + $re = $this->u->addItem(544, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "544" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(626, $uidb); + $re = $this->u->addItem(626, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "626" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(651, $uidb); + $re = $this->u->addItem(651, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "651" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(683, $uidb); + $re = $this->u->addItem(683, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "683" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(686, $uidb); + $re = $this->u->addItem(686, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(686, $uidb); + $re = $this->u->addItem(686, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(686, $uidb); + $re = $this->u->addItem(686, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(706, $uidb); + $re = $this->u->addItem(706, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "706" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(708, $uidb); + $re = $this->u->addItem(708, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "708" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(717, $uidb); + $re = $this->u->addItem(717, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "717" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -2899,78 +2833,78 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 //193|204|221|138|9|188|240|215|147|232|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0 } elseif ($sellclass == 3) { //танк класс 3 - $us = add_effn($uidb, 1); // сила - $us = add_effn($uidb, 20); // сокрушение + $us = $this->add_effn($uidb, 1); // сила + $us = $this->add_effn($uidb, 20); // сокрушение mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=42|s2=3|s3=3|s4=50|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=9|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(533, $uidb); + $re = $this->u->addItem(533, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "533" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(536, $uidb); + $re = $this->u->addItem(536, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "536" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(558, $uidb); + $re = $this->u->addItem(558, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "558" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(722, $uidb); + $re = $this->u->addItem(722, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "722" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(291, $uidb); + $re = $this->u->addItem(291, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(545, $uidb); + $re = $this->u->addItem(545, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "545" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(628, $uidb); + $re = $this->u->addItem(628, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "628" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(654, $uidb); + $re = $this->u->addItem(654, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "654" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(684, $uidb); + $re = $this->u->addItem(684, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "684" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(689, $uidb); + $re = $this->u->addItem(689, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(689, $uidb); + $re = $this->u->addItem(689, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(689, $uidb); + $re = $this->u->addItem(689, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(700, $uidb); + $re = $this->u->addItem(700, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "700" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(710, $uidb); + $re = $this->u->addItem(710, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "710" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(718, $uidb); + $re = $this->u->addItem(718, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "718" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -2978,79 +2912,79 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } elseif ($sellclass == 4) { //топор класс 4 - $us = add_effn($uidb, 1); // сила - $us = add_effn($uidb, 20); // сокрушение + $us = $this->add_effn($uidb, 1); // сила + $us = $this->add_effn($uidb, 20); // сокрушение mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=43|s2=15|s3=15|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=10|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',-75,-9,100000)"); - $re = $u->addItem(528, $uidb); + $re = $this->u->addItem(528, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "528" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(538, $uidb); + $re = $this->u->addItem(538, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "538" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(552, $uidb); + $re = $this->u->addItem(552, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "552" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(552, $uidb); + $re = $this->u->addItem(552, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "552" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(291, $uidb); + $re = $this->u->addItem(291, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(543, $uidb); + $re = $this->u->addItem(543, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "543" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(627, $uidb); + $re = $this->u->addItem(627, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "627" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(653, $uidb); + $re = $this->u->addItem(653, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "653" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(681, $uidb); + $re = $this->u->addItem(681, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "681" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(687, $uidb); + $re = $this->u->addItem(687, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(687, $uidb); + $re = $this->u->addItem(687, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(687, $uidb); + $re = $this->u->addItem(687, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(320, $uidb); + $re = $this->u->addItem(320, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "320" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(709, $uidb); + $re = $this->u->addItem(709, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "709" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(716, $uidb); + $re = $this->u->addItem(716, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "716" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -3060,77 +2994,77 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } elseif ($sellclass == 5) { //м земля класс 5 //кастим эфекты - $us = add_effn($uidb, 9); // интелект - $us = add_effn($uidb, 32); // Холодный разум - $us = add_effn($uidb, 54); // Маг уселок земля - $us = add_effn($uidb, 439); // Маг уселок + $us = $this->add_effn($uidb, 9); // интелект + $us = $this->add_effn($uidb, 32); // Холодный разум + $us = $this->add_effn($uidb, 54); // Маг уселок земля + $us = $this->add_effn($uidb, 439); // Маг уселок mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=0|mg4=6|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uidb); + $re = $this->u->addItem(531, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(534, $uidb); + $re = $this->u->addItem(534, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(1026, $uidb); + $re = $this->u->addItem(1026, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(291, $uidb); + $re = $this->u->addItem(291, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(548, $uidb); + $re = $this->u->addItem(548, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(629, $uidb); + $re = $this->u->addItem(629, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(699, $uidb); + $re = $this->u->addItem(699, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "699" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(711, $uidb); + $re = $this->u->addItem(711, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(714, $uidb); + $re = $this->u->addItem(714, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); ///------- юва - $re = $u->addItem(657, $uidb); + $re = $this->u->addItem(657, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "657" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(674, $uidb); + $re = $this->u->addItem(674, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "674" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(692, $uidb); + $re = $this->u->addItem(692, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(692, $uidb); + $re = $this->u->addItem(692, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(692, $uidb); + $re = $this->u->addItem(692, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -3140,77 +3074,77 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 } elseif ($sellclass == 6) { //м воздух 6 //кастим эфекты - $us = add_effn($uidb, 9); // интелект - $us = add_effn($uidb, 32); // Холодный разум - $us = add_effn($uidb, 53); // Маг уселок воздух - $us = add_effn($uidb, 439); // Маг уселок + $us = $this->add_effn($uidb, 9); // интелект + $us = $this->add_effn($uidb, 32); // Холодный разум + $us = $this->add_effn($uidb, 53); // Маг уселок воздух + $us = $this->add_effn($uidb, 439); // Маг уселок mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=6|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uidb); + $re = $this->u->addItem(531, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(534, $uidb); + $re = $this->u->addItem(534, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(1026, $uidb); + $re = $this->u->addItem(1026, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(291, $uidb); + $re = $this->u->addItem(291, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(548, $uidb); + $re = $this->u->addItem(548, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(629, $uidb); + $re = $this->u->addItem(629, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(699, $uidb); + $re = $this->u->addItem(699, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "699" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(711, $uidb); + $re = $this->u->addItem(711, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(714, $uidb); + $re = $this->u->addItem(714, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); ///------- юва - $re = $u->addItem(658, $uidb); + $re = $this->u->addItem(658, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "658" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(675, $uidb); + $re = $this->u->addItem(675, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "675" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(693, $uidb); + $re = $this->u->addItem(693, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(693, $uidb); + $re = $this->u->addItem(693, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(693, $uidb); + $re = $this->u->addItem(693, $uidb); mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); @@ -3221,17 +3155,17 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 // классы кончились //кастим эфекты - $us = add_effn($uidb, 37);//нектар - $us = add_effn($uidb, 38);//нектар отрицания - $us = add_effn($uidb, 283);//Бутерброд -Завтрак Рыцаря- толстый - $us = add_effn($uidb, 25);//Защита от оружия - $us = add_effn($uidb, 296);//Жажда Жизни +6 + $us = $this->add_effn($uidb, 37);//нектар + $us = $this->add_effn($uidb, 38);//нектар отрицания + $us = $this->add_effn($uidb, 283);//Бутерброд -Завтрак Рыцаря- толстый + $us = $this->add_effn($uidb, 25);//Защита от оружия + $us = $this->add_effn($uidb, 296);//Жажда Жизни +6 mysql_query('UPDATE `users` SET `money` = -3000 , `money2` = 0 WHERE `id` = "' . $uidb . '" LIMIT 1'); //Корекция хп в призовых $hpclon = mysql_fetch_array(mysql_query('SELECT `hpAll`,`mpAll` FROM `stats` WHERE `id` = "' . $uidb . '" LIMIT 1')); mysql_query('UPDATE `stats` SET `hpNow` = "' . $hpclon['hpAll'] . '" `mpNow` = "' . $hpclon['mpAll'] . '" WHERE `id` = "' . $uidb . '" LIMIT 1'); - $u->info['id'] = $uidb; + $this->u->info['id'] = $uidb; //============================================================================================= $this->error = 'Вы вселены в клона 8го левела'; //ТУТ вселяем в клона призовые хаоты echo ''; @@ -3241,22 +3175,22 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"')); $nxtID = $nxtID[0]; } - $u->info['login2'] = ''; + $this->u->info['login2'] = ''; - $blnc = $u->stats['reting']; + $blnc = $this->u->stats['reting']; $z['tm' . $t1] += $blnc; - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . $t1 . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . $t1 . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); if (!$upd) { $this->error = 'Ошибка приема заявки...'; } else { - mysql_query('UPDATE `users` SET `login2` = "' . $u->info['login2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `login2` = "' . $this->u->info['login2'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `zayvki` SET `tm1` = "' . $z['tm1'] . '", `tm2` = "' . $z['tm2'] . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'); $this->error = 'Вы приняли хаотичный бой...'; $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = mysql_real_escape_string((int)$t1); + $this->u->info['zv'] = $z['id']; + $this->u->info['team'] = mysql_real_escape_string((int)$t1); } } } @@ -3264,11 +3198,6 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0 $this->error = 'Заявка на бой не найдена.'; } } - } else { - $this->error = 'Вы не можете принять бой. Сначала отзовите свою заявку.'; } } } - -$zv = new zayvki; -$zv->test(); //проверяем заявки \ No newline at end of file diff --git a/_incl_data/class/__filter_class.php b/_incl_data/class/Filter.php similarity index 62% rename from _incl_data/class/__filter_class.php rename to _incl_data/class/Filter.php index 8dfeeb81..56a58846 100644 --- a/_incl_data/class/__filter_class.php +++ b/_incl_data/class/Filter.php @@ -1,7 +1,4 @@ 1, "fingal" => 1, "eek" => 1, "smoke" => 1, "hi" => 1, "bye" => 1, "king" => 1, "king2" => 1, "boks2" => 1, "boks" => 1, "gent" => 1, "lady" => 1, "tongue" => 1, "smil" => 1, "rotate" => 1, "ponder" => 1, "bow" => 1, "angel" => 1, "angel2" => 1, "hello" => 1, "dont" => 1, "idea" => 1, "mol" => 1, "super" => 1, "beer" => 1, "drink" => 1, "baby" => 1, "tongue2" => 1, "sword" => 1, "agree" => 1, "loveya" => 1, "kiss" => 1, "kiss2" => 1, "kiss3" => 1, "kiss4" => 1, "rose" => 1, "love" => 1, "love2" => 1, "confused" => 1, "yes" => 1, "no" => 1, "shuffle" => 1, "nono" => 1, "maniac" => 1, "privet" => 1, "ok" => 1, "ninja" => 1, "pif" => 1, "smash" => 1, "alien" => 1, "pirate" => 1, "gun" => 1, "trup" => 1, "mdr" => 1, "sneeze" => 1, "mad" => 1, "friday" => 1, "cry" => 1, "grust" => 1, "rupor" => 1, "fie" => 1, "nnn" => 1, "row" => 1, "red" => 1, "lick" => 1, "help" => 1, "wink" => 1, "jeer" => 1, "tease" => 1, "nunu" => 1, "inv" => 1, "duel" => 1, "susel" => 1, "nun" => 1, "kruger" => 1, "flowers" => 1, "horse" => 1, "hug" => 1, "str" => 1, "alch" => 1, "pal" => 1, "mag" => 1, "sniper" => 1, "vamp" => 1, "doc" => 1, "doc2" => 1, "sharp" => 1, "naem" => 1, "naem2" => 1, "naem3" => 1, "invis" => 1, "chtoza" => 1, "beggar" => 1, "sorry" => 1, "sorry2" => 1, - "creator" => 1, "grace" => 1, "dustman" => 1, "carreat" => 1, "lordhaos" => 1, "ura" => 1, "elix" => 1, "dedmoroz" => 1, "snegur" => 1, "showng" => 1, "superng" => 1, "podz" => 1, "sten" => 1, "devil" => 1, "cat" => 1, "owl" => 1, "lightfly" => 1, "snowfight" => 1, "rocket" => 1, "ball" => 1, "smile" => 1, "fuck" => 1]; + private $sm = ["laugh" => 1, "fingal" => 1, "eek" => 1, "smoke" => 1, "hi" => 1, "bye" => 1, "king" => 1, "king2" => 1, "boks2" => 1, "boks" => 1, "gent" => 1, "lady" => 1, "tongue" => 1, "smil" => 1, "rotate" => 1, "ponder" => 1, "bow" => 1, "angel" => 1, "angel2" => 1, "hello" => 1, "dont" => 1, "idea" => 1, "mol" => 1, "super" => 1, "beer" => 1, "drink" => 1, "baby" => 1, "tongue2" => 1, "sword" => 1, "agree" => 1, "loveya" => 1, "kiss" => 1, "kiss2" => 1, "kiss3" => 1, "kiss4" => 1, "rose" => 1, "love" => 1, "love2" => 1, "confused" => 1, "yes" => 1, "no" => 1, "shuffle" => 1, "nono" => 1, "maniac" => 1, "privet" => 1, "ok" => 1, "ninja" => 1, "pif" => 1, "smash" => 1, "alien" => 1, "pirate" => 1, "gun" => 1, "trup" => 1, "mdr" => 1, "sneeze" => 1, "mad" => 1, "friday" => 1, "cry" => 1, "grust" => 1, "rupor" => 1, "fie" => 1, "nnn" => 1, "row" => 1, "red" => 1, "lick" => 1, "help" => 1, "wink" => 1, "jeer" => 1, "tease" => 1, "nunu" => 1, "inv" => 1, "duel" => 1, "susel" => 1, "nun" => 1, "kruger" => 1, "flowers" => 1, "horse" => 1, "hug" => 1, "str" => 1, "alch" => 1, "pal" => 1, "mag" => 1, "sniper" => 1, "vamp" => 1, "doc" => 1, "doc2" => 1, "sharp" => 1, "naem" => 1, "naem2" => 1, "naem3" => 1, "invis" => 1, "chtoza" => 1, "beggar" => 1, "sorry" => 1, "sorry2" => 1, "creator" => 1, "grace" => 1, "dustman" => 1, "carreat" => 1, "lordhaos" => 1, "ura" => 1, "elix" => 1, "dedmoroz" => 1, "snegur" => 1, "showng" => 1, "superng" => 1, "podz" => 1, "sten" => 1, "devil" => 1, "cat" => 1, "owl" => 1, "lightfly" => 1, "snowfight" => 1, "rocket" => 1, "ball" => 1, "smile" => 1, "fuck" => 1]; public function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("#' . date('d.m.Y') . ' %' . date('H:i:s') . ': ' . mysql_real_escape_string($t) . '","capitalcity","Игромир","6","1","-1")'); + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("#' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ': ' . mysql_real_escape_string($t) . '","capitalcity","Игромир","6","1","-1")' + ); } - public function setOnline($online, $uid, $afk) + public function setOnline($online, $uid) { $add = 0; @@ -45,7 +45,9 @@ class Filter $on['time_today'] += $add; } $add = $on['time_all'] + $add; - mysql_query('UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `id` = "' . $on['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `id` = "' . $on['id'] . '" LIMIT 1' + ); } } } @@ -93,8 +95,7 @@ class Filter $spam = mysql_fetch_array(mysql_query('SELECT * FROM `spam_word` WHERE `id` = 1 LIMIT 1')); $spam = $spam['data']; // - $testEN = preg_replace('/[^a-z]*/i', '', $txt); - $testEN = preg_replace('/[^A-Z]*/i', '', $txt); + $testEN = preg_replace('/[^A-z]*/i', '', $txt); $testEN2 = $txt; $testEN2 = str_replace('"', '', $testEN2); @@ -116,10 +117,8 @@ class Filter $testEN2 = str_replace('я', '9', $testEN2); $testEN2 = str_replace('()', 'o', $testEN2); $testEN2 = str_replace('0', 'o', $testEN2); - $testEN2 = preg_replace('/[^a-z]*/i', '', $testEN2); - $testEN2 = preg_replace('/[^A-Z]*/i', '', $testEN2); - $testRU = preg_replace('/[^а-я]*/i', '', $txt); - $testRU = preg_replace('/[^А-Я]*/i', '', $txt); + $testEN2 = preg_replace('/[^A-z]*/i', '', $testEN2); + $testRU = preg_replace('/[^А-я]*/i', '', $txt); $testRU2 = $txt; $testRU2 = str_replace('a', 'а', $testRU2); @@ -143,15 +142,9 @@ class Filter $i = 0; $spe = explode('|', $spam); while ($i <= count($spe)) { - if ( - isset($spe[$i]) && - $spe[$i] != '' && - $spe[$i] != 'new-combats.com' && - ( - stristr($testEN, $spe[$i]) || - stristr($testRU, $spe[$i]) - ) - ) { + if (isset($spe[$i]) && $spe[$i] != '' && $spe[$i] != 'new-combats.com' && (stristr( + $testEN, $spe[$i] + ) || stristr($testRU, $spe[$i]))) { $nospam .= '%' . $spe[$i]; } $i++; @@ -164,5 +157,3 @@ class Filter trigger_error('Дублирование не допускается.', E_USER_ERROR); } } - -$filter = new Filter(); \ No newline at end of file diff --git a/_incl_data/class/GameDealer.php b/_incl_data/class/GameDealer.php new file mode 100644 index 00000000..b0b13bb5 --- /dev/null +++ b/_incl_data/class/GameDealer.php @@ -0,0 +1,245 @@ + 'pay_operations', //Таблица в которую заносятся данные + 'db_host' => 'localhost', + 'db_user' => 'newcom1_abk', + 'db_pass' => '4nWYsIM[c?}P', + 'db_base' => 'newcom1_abk', /* Настройки платежей */ + 'ip_list' => ['127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'], //Указывать через запятую (Разрешенные IP) + 'key' => 'qtzl0igb', //gamedealer key + 'id' => '65643' //ID проекта + ], $BACK = []; //Результат который возвращаем в конце + + //Кодируем из ЮТФ-8 в Кирилицу + public function in($text) + { + return iconv("UTF-8", "cp1251", $text); + } + + //Кодируем из Кирилицу в ЮТФ-8 + public function out($text) + { + return iconv("cp1251", "UTF-8", $text); + } + + //Добавляем данные в базу данных + public function add($type, $value, $money) + { + mysql_query('INSERT INTO `' . $this->c['db_name'] . '` (`time`,`type`,`ip`,`value`,`money`,`project`) VALUES ("' . time() . '","' . mysql_real_escape_string($type) . '","' . $_SERVER['HTTP_X_REAL_IP'] . '","' . mysql_real_escape_string($value) . '","' . mysql_real_escape_string($money) . '","' . mysql_real_escape_string($this->id) . '")'); + } + + //Подключаемся к базе данных + public function connect_db() + { + $db = mysql_connect($this->c['db_host'], $this->c['db_user'], $this->c['db_pass']) or die('Ошибка подключения к MySQL серверу!'); + mysql_select_db($this->c['db_base'], $db) or die('Ошибка подключения к базе данных!'); + mysql_query('SET NAMES cp1251'); + } + + public function output($a, $v = null) + { + $r = ''; + $i = 0; + while ($i < count($a)) { + $rn = ''; + $tb = ''; + if ($v != null) { + $rn = "\r\n"; + $tb = " "; + } + $r .= $rn . '<' . $a[$i][0] . '>'; + if (!is_array($a[$i][1])) { + $rn = ''; + $tb = ''; + $r .= $rn . $tb . ($this->out($a[$i][1])); + } else { + if ($i > 0) { + $r .= $rn; + } + $r .= $tb . ($this->output($a[$i][1], 1)); + } + $r .= $rn . ''; + $i++; + } + return $r; + } + + //Генерируем XML-файл + public function backInformation() + { + header('Content-Type: text/html/force-download'); + echo ''; + echo $this->output($this->BACK, 1); + } + + //Проверка существования персонажа + public function test_accaunt($nick) + { + $r = false; + $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `id` = "' . mysql_real_escape_string($nick) . '" LIMIT 1')); + if (isset($nick['id'])) { + $r = true; + } + return $r; + } + + //Получает счет в банке по логину + public function getBank($nick) + { + $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "' . mysql_real_escape_string($nick) . '" LIMIT 1')); + $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `uid` = "' . mysql_real_escape_string($nick['id']) . '" LIMIT 1')); + return $nick['id']; + } + + //Поиск логина + public function bank_user($nick) + { + $nick = mysql_fetch_array(mysql_query('SELECT `id`,`uid FROM `bank` WHERE `id` = "' . mysql_real_escape_string($nick) . '" LIMIT 1')); + $nick = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `login` = "' . mysql_real_escape_string($nick['uid']) . '" LIMIT 1')); + return $nick['login']; + } + + //Начинаем обработку запросов + public function start_session() + { + + $ip = ''; + $ip = $_SERVER['HTTP_X_REAL_IP']; + + //Подключаемся к БД + $this->connect_db(); + + //Получаем данные запроса + //$xml = file_get_contents('php://input'); + + //Парсинг XML запроса + if (function_exists('simplexml_load_string')) { + $xml = simplexml_load_string($xml); + } else { + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Не удалось произвести обработку запроса']]]]; + die($this->backInformation()); + } + + $this->id = $xml->projectid; + + if (!in_array($ip, $this->c['ip_list'])) { + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Нет доступа с данного IP']]]]; + die($this->backInformation()); + } + + //Обработка запросов + if ($xml->method == 'check_balance') { + //MD5(method+MD5(gdKey)) + + $sign = md5($xml->method . md5($this->c['key'])); + + if ($sign == $xml->sign) { + //Баланс дилера + $balance = 1000000; + $this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Баланс дилера: ' . $balance], ['balance', $balance]]]]; + $this->add('4', 'check:' . $xml->nick . ':1' . $r, 0); + } + + } elseif ($xml->method == 'check') { + /* + nick - логин персонажа MD5(nick+method+MD5(gdKey)) */ + + $sign = md5($xml->nick . $xml->method . md5($this->c['key'])); + + if ($sign == $xml->sign) { + $xml->nick = $this->in($xml->nick); + if ($this->test_accaunt($xml->nick) == true) { + //Персонаж найден и зачисляем ему игровую валюту + $this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Банковский счет найден']]]]; + $this->add('3', 'check:' . $xml->nick . ':1' . $r, 0); + } else { + //Персонаж не найден + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Платеж не обработан. Банковский счет не найден.']]]]; + $this->add('-1', 'Персонаж не найден:pay:' . $xml->nick . ':0', 0); + } + } + } elseif ($xml->method == 'pay') { + /* Проводим платеж + nick - логин аккаунта , projectid - id проекта , sign , amount - деньги , payid - id платежа */ + + $sign = md5($xml->nick . $xml->projectid . $xml->amount . $xml->payid . $xml->method . md5($this->c['key'])); + + if ($sign == $xml->sign) { + $xml->nick = $this->in($xml->nick); + if ($this->test_accaunt($xml->nick)) { + //Персонаж найден и зачисляем ему игровую валюту + $bank = $this->test_accaunt($xml->nick); + if ($bank > 0) { + mysql_query('UPDATE `bank` SET `money2` = `money2` + ' . mysql_real_escape_string($xml->amount) . ' WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1'); + $this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Платеж прошел успешно'], ['id', $this->c['id']]]]]; + $this->add('2', 'pay:' . $xml->nick . ':' . $xml->projectid . ':' . $xml->sign . ':' . $xml->amount . ':' . $xml->payid . ':' . $bank['id'], $xml->amount); + + $user = mysql_fetch_array(mysql_query('SELECT `id`,`uid` FROM `bank` WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1')); + $user = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`city`,`sex`,`room` FROM `users` WHERE `id` = "' . mysql_real_escape_string($user['uid']) . '" LIMIT 1')); + + mysql_query('UPDATE `users` SET `catch` = `catch` + ' . mysql_real_escape_string(floor($xml->amount)) . ' WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1'); + + $r = '' . date('d.m.Y H:i') . ' Алхимик Enchanter / Автоматическая оплата сообщает: '; + + if ($user['sex'] == 1) { + $r .= 'Уважаемая'; + } else { + $r .= 'Уважаемый'; + } + + $r .= ' ' . $user['login'] . ', на Ваш банковский счет №' . $bank . ' зачислено ' . $xml->amount . ' Ekr. Благодарим Вас за покупку!'; + + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $user['city'] . "','" . $user['room'] . "','','" . $user['login'] . "','" . $r . "','-1','5','0')"); + + } else { + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'У пользователя отсутствует банк'], ['id', $this->c['id']]]]]; + $this->add('-1', 'У персонажа отсутствует банк:pay:' . $xml->nick . ':' . $xml->projectid . ':' . $xml->sign . ':' . $xml->amount . ':' . $xml->payid . ':' . $bank['id'], $xml->amount); + } + } else { + //Персонаж не найден + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Платеж не обработан. Персонаж не найден.']]]]; + $this->add('-1', 'Персонаж не найден:pay:' . $xml->nick . ':0', 0); + } + } else { + //Ошибка сигнатуры + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Ошибка сигнатуры']]]]; + $this->add('-1', 'Ошибка сигнатуры:pay:' . $xml->nick . ':0', 0); + } + } elseif ($xml->method == 'check_login') { + /* Проверка аккаунта + nick - логин аккаунта , projectid - id проекта , sign */ + $sign = md5($xml->nick . $xml->method . md5($this->c['key'])); + + if ($sign == $xml->sign) { + $xml->nick = $this->in($xml->nick); + if ($this->test_accaunt($xml->nick)) { + //Персонаж найден + $this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Счет найден'], ['addinfo', $this->bank_user($xml->nick)]]]]; + $this->add('1', 'check_login:' . $xml->nick . ':1' . $r, 0); + } else { + //Персонаж не найден + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Счет не найден']]]]; + $this->add('-1', 'Персонаж не найден:check_login:' . $xml->nick . ':0', 0); + } + } else { + //Ошибка сигнатуры + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Ошибка сигнатуры']]]]; + $this->add('-1', 'Ошибка сигнатуры:pay:' . $xml->nick . ':0', 0); + } + } else { + $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Неизвестный тип запроса']]]]; + $this->add('-1', 'Неизвестный тип запроса:error_method:gamedealer', 0); + } + + //Возвращаем результат + $this->backInformation(); + } +} + +$pay = new GameDealer; +$pay->start_session(); diff --git a/_incl_data/class/Insallah/Achievements.php b/_incl_data/class/Insallah/Achievements.php index 9fdbd3eb..ac26441f 100644 --- a/_incl_data/class/Insallah/Achievements.php +++ b/_incl_data/class/Insallah/Achievements.php @@ -93,7 +93,7 @@ class Achievements ], ]; - public function __construct(\user $user) + public function __construct(\User $user) { $this->user = $user; $this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]); diff --git a/_incl_data/class/Insallah/Config.php b/_incl_data/class/Insallah/Config.php new file mode 100644 index 00000000..02d1d4f9 --- /dev/null +++ b/_incl_data/class/Insallah/Config.php @@ -0,0 +1,16 @@ +startAllBattles(); +} \ No newline at end of file diff --git a/_incl_data/class/Insallah/Core/Db.php b/_incl_data/class/Insallah/Core/Db.php index fcdcc9fe..f4b24e48 100644 --- a/_incl_data/class/Insallah/Core/Db.php +++ b/_incl_data/class/Insallah/Core/Db.php @@ -3,6 +3,7 @@ namespace Insallah; use Exception; +use http\Message; use PDO; use PDOException; use PDOStatement; @@ -35,17 +36,18 @@ class Db * DB constructor. * @throws Exception */ - public function __construct(){ - if (self::$instance === null){ + public function __construct() + { + if (self::$instance === null) { try { self::$db = new PDO( - 'mysql:host='.self::DB_HOST.';dbname='.self::DB_NAME, + 'mysql:host=' . self::DB_HOST . ';dbname=' . self::DB_PREFIX . self::DB_NAME, self::DB_USER, self::DB_PASSWORD, - $options = [ + [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES ".self::CHARSET + PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES " . self::CHARSET, ] ); } catch (PDOException $e) { @@ -59,7 +61,8 @@ class Db * @param $stmt * @return PDOStatement */ - public static function query($stmt) { + public static function query($stmt) + { return self::$db->query($stmt); } @@ -67,7 +70,8 @@ class Db * @param $stmt * @return PDOStatement */ - public static function prepare($stmt) { + public static function prepare($stmt) + { return self::$db->prepare($stmt); } @@ -75,25 +79,28 @@ class Db * @param $query * @return int */ - static public function exec($query) { + static public function exec($query) + { return self::$db->exec($query); } /** * @return string */ - static public function lastInsertId() { + static public function lastInsertId() + { return self::$db->lastInsertId(); } /** - * @param $query + * @param $query * @param array $args * @return PDOStatement * @throws Exception */ - public static function run($query, $args = []) { - try{ + public static function run($query, $args = []) + { + try { if (!$args) { return self::query($query); } @@ -106,29 +113,35 @@ class Db } /** - * @param $query + * @param $query * @param array $args * @return mixed + * @throws Exception */ - public static function getRow($query, $args = []) { + public static function getRow($query, $args = []) + { return self::run($query, $args)->fetch(); } /** - * @param $query + * @param $query * @param array $args * @return array + * @throws Exception */ - public static function getRows($query, $args = []) { + public static function getRows($query, $args = []) + { return self::run($query, $args)->fetchAll(); } /** - * @param $query + * @param $query * @param array $args * @return mixed + * @throws Exception */ - public static function getValue($query, $args = []) { + public static function getValue($query, $args = []) + { $result = self::getRow($query, $args); if (!empty($result)) { $result = array_shift($result); @@ -137,14 +150,19 @@ class Db } /** - * @param $query + * @param $query * @param array $args * @return array + * @throws Exception */ - public static function getColumn($query, $args = []) { + public static function getColumn($query, $args = []) + { return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN); } + /** + * @throws Exception + */ public static function sql($query, $args = []) { self::run($query, $args); diff --git a/_incl_data/class/Insallah/Core/Math.php b/_incl_data/class/Insallah/Core/Math.php index 790d8573..d8430f07 100644 --- a/_incl_data/class/Insallah/Core/Math.php +++ b/_incl_data/class/Insallah/Core/Math.php @@ -21,7 +21,12 @@ class Math { return [ 'min' => $number * ((100 - 20) / 100), - 'max' => $number * ((100 + 20) / 100) + 'max' => $number * ((100 + 20) / 100), ]; } + + public static function addPercent($num, $percent) + { + return $num + (($percent / 100) * $num); + } } \ No newline at end of file diff --git a/_incl_data/class/Insallah/Tournament/TournamentModel.php b/_incl_data/class/Insallah/Tournament/TournamentModel.php index 3a3b90a6..6a06e5f1 100644 --- a/_incl_data/class/Insallah/Tournament/TournamentModel.php +++ b/_incl_data/class/Insallah/Tournament/TournamentModel.php @@ -207,6 +207,11 @@ class TournamentModel battle_users.battle = last_battle.id and battle_users.team != last_battle.team_win and battle_users.uid in (select uid from tournaments_users where death_time = 0)'; + + $query2 = 'select bu.uid from battle b + inner join battle_users bu on b.team_win != bu.team and b.id = bu.battle + inner join tournaments_users tu on bu.uid = tu.uid + where typeBattle = 25000 and death_time = 0 order by b.time_start desc limit 1'; $db = new Db; $row = $db::getRow($query); return $row['uid']; @@ -222,9 +227,9 @@ class TournamentModel public static function removeFighter($uid, $winner = false) { if (!$uid) return; - $winner_timer_add = $winner? 500 : 0; # Последный ДОЛЖЕН быть последним. + //$winner_timer_add = $winner? 500 : 0; # Последный ДОЛЖЕН быть последним. $db = new Db(); - $db::sql('update tournaments_users set death_time = unix_timestamp() + ? where death_time = 0 and uid = ?', [$winner_timer_add, $uid]); + $db::sql('update tournaments_users set death_time = unix_timestamp() + 500 where death_time = 0 and uid = ?', [$uid]); self::teleport($uid, 9); //fixme: Классы не подключаются друг к другу. Нужно менять архитектуру игры. :( Db::sql("update users_achiv set trn = trn + 1 where id = ?", [$uid]); diff --git a/_incl_data/class/__magic.php b/_incl_data/class/Magic.php similarity index 99% rename from _incl_data/class/__magic.php rename to _incl_data/class/Magic.php index a4c869fd..17a69186 100644 --- a/_incl_data/class/__magic.php +++ b/_incl_data/class/Magic.php @@ -1,11 +1,4 @@ info['id'] . '" AND `iu`.`inShop`="0" AND `iu`.`delete`="0" AND `iu`.`id` = "' . mysql_real_escape_string((int)$id) . '" LIMIT 1')); $bs_is = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $u->info['inTurnir'] . '" LIMIT 1')); if (isset($itm['id'])) { - if ($itm['group'] == 1) { - //Группа предметов - if ($u->itemsX($itm['id']) > 1) { - //вытаскиваем предмет РёР· РіСЂСѓРїРїС‹ - $u->unstack($itm['id'], 1); - } + //Группа предметов + if ($itm['group'] == 1 && $u->itemsX($itm['id']) > 1) { + //вытаскиваем предмет РёР· РіСЂСѓРїРїС‹ + $u->unstack($itm['id'], 1); } $st = $u->lookStats($itm['data']); if (isset($st['tr_lvl']) && $st['tr_lvl'] > $u->info['level']) { $u->error = 'Р’С‹ слишком малы чтобы использовать данный предмет '; - $err = 'Р’С‹ слишком малы чтобы использовать данный предмет'; - return $err; + return 'Р’С‹ слишком малы чтобы использовать данный предмет'; } if ($itm['magic_chance'] > 0 && $itm['magic_chance'] < 100) { @@ -58,14 +55,14 @@ class Magic $itm['magic_chance'] = 99; } } - if (isset($bs_is['id'])) { - if (in_array($itm['item_id'], $e_magic) || in_array($itm['item_id'], $c_magic)) { - $itm['magic_chance'] += $bs_is['users']; - if ($itm['magic_chance'] >= 99) { - $itm['magic_chance'] = 99; + if (isset($bs_is['id']) && (in_array($itm['item_id'], $this->e_magic) || in_array( + $itm['item_id'], $this->c_magic + ))) { + $itm['magic_chance'] += $bs_is['users']; + if ($itm['magic_chance'] >= 99) { + $itm['magic_chance'] = 99; + } } - } - } if ($itm['iznosNOW'] >= $itm['iznosMAX']) { $u->error = 'РќРµ осталось зарядов...'; @@ -1993,7 +1990,3 @@ class Magic return $good; } } - -$magic = new Magic; - -?> \ No newline at end of file diff --git a/_incl_data/class/MobileDetect.php b/_incl_data/class/MobileDetect.php new file mode 100644 index 00000000..43559ebe --- /dev/null +++ b/_incl_data/class/MobileDetect.php @@ -0,0 +1,1004 @@ +, Nick Ilyin + * Original author: Victor Stanciu + * + * @license Code and contributions have 'MIT License' + * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt + * + * @link Homepage: http://mobiledetect.net + * GitHub Repo: https://github.com/serbanghita/Mobile-Detect + * Google Code: http://code.google.com/p/php-mobile-detect/ + * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md + * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples + * + * @version 2.8.2 + */ + +class MobileDetect +{ + /** + * Mobile detection type. + * + * @deprecated since version 2.6.9 + */ + const DETECTION_TYPE_MOBILE = 'mobile'; + + /** + * Extended detection type. + * + * @deprecated since version 2.6.9 + */ + const DETECTION_TYPE_EXTENDED = 'extended'; + + /** + * A frequently used regular expression to extract version #s. + * + * @deprecated since version 2.6.9 + */ + const VER = '([\w._\+]+)'; + + /** + * Top-level device. + */ + const MOBILE_GRADE_A = 'A'; + + /** + * Mid-level device. + */ + const MOBILE_GRADE_B = 'B'; + + /** + * Low-level device. + */ + const MOBILE_GRADE_C = 'C'; + + /** + * Stores the version number of the current release. + */ + const VERSION = '2.8.2'; + + /** + * A type for the version() method indicating a string return value. + */ + const VERSION_TYPE_STRING = 'text'; + + /** + * A type for the version() method indicating a float return value. + */ + const VERSION_TYPE_FLOAT = 'float'; + + /** + * The User-Agent HTTP header is stored in here. + * @var string + */ + protected $userAgent = null; + + /** + * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE. + * @var array + */ + protected $httpHeaders = []; + + /** + * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED. + * + * @deprecated since version 2.6.9 + * + * @var string + */ + protected $detectionType = self::DETECTION_TYPE_MOBILE; + + /** + * HTTP headers that trigger the 'isMobile' detection + * to be true. + * + * @var array + */ + protected static $mobileHeaders = [ + + 'HTTP_ACCEPT' => ['matches' => [// Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/ + 'application/x-obml2d', // BlackBerry devices. + 'application/vnd.rim.html', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml']], 'HTTP_X_WAP_PROFILE' => null, 'HTTP_X_WAP_CLIENTID' => null, 'HTTP_WAP_CONNECTION' => null, 'HTTP_PROFILE' => null, // Reported by Opera on Nokia devices (eg. C3). + 'HTTP_X_OPERAMINI_PHONE_UA' => null, 'HTTP_X_NOKIA_GATEWAY_ID' => null, 'HTTP_X_ORANGE_ID' => null, 'HTTP_X_VODAFONE_3GPDPCONTEXT' => null, 'HTTP_X_HUAWEI_USERID' => null, // Reported by Windows Smartphones. + 'HTTP_UA_OS' => null, // Reported by Verizon, Vodafone proxy system. + 'HTTP_X_MOBILE_GATEWAY' => null, // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e. + 'HTTP_X_ATT_DEVICEID' => null, // Seen this on a HTC. + 'HTTP_UA_CPU' => ['matches' => ['ARM']],]; + + /** + * List of mobile devices (phones). + * + * @var array + */ + protected static $phoneDevices = ['iPhone' => '\biPhone.*Mobile|\biPod', // |\biTunes + 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+', 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m', 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile', // @todo: Is 'Dell Streak' a tablet or a phone? ;) + 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b', 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925', 'Samsung' => 'Samsung|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E', 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)', 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i', 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile', // @ref: http://www.micromaxinfo.com/mobiles/smartphones + // Added because the codes might conflict with Acer Tablets. + 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b', 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. + 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) + // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH) + // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android. + 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790', // @ref: http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones. + 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250', 'iMobile' => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)', // Added simvalley mobile just for fun. They have some interesting devices. + // @ref: http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html + 'SimValley' => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b', // @Tapatalk is a mobile app; @ref: http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039 + 'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser']; + + /** + * List of tablet devices. + * + * @var array + */ + protected static $tabletDevices = ['iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. + 'NexusTablet' => 'Android.*Nexus[\s]+(7|10)|^.*Android.*Nexus(?:(?!Mobile).)*$', 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. + // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/ + 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE)\b', // Only the Surface tablets with Windows RT are considered mobile. + // @ref: http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx + 'SurfaceTablet' => 'Windows NT [0-9.]+; ARM;', // @ref: http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT + 'HPTablet' => 'HP Slate 7|HP ElitePad 900|hp-tablet|EliteBook.*Touch', // @note: watch out for PadFone, see #132 + 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|TX201LA', 'BlackBerryTablet' => 'PlayBook|RIM Tablet', 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2', // @ref: http://www.acer.ro/ac/ro/RO/content/drivers + // @ref: http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer) + // @ref: http://us.acer.com/ac/en/US/content/group/tablets + // @note: Can conflict with Micromax and Motorola phones codes. + 'AcerTablet' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810)\b|W3-810|\bA3-A10\b', // @ref: http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/ + // @ref: http://us.toshiba.com/tablets/tablet-finder + // @ref: http://www.toshiba.co.jp/regza/tablet/ + 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO', // @ref: http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html + 'LGTablet' => '\bL-06C|LG-V900|LG-V500|LG-V909\b', 'FujitsuTablet' => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b', // Prestigio Tablets http://www.prestigio.com/support + 'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD', // @ref: http://support.lenovo.com/en_GB/downloads/default.page?# + 'LenovoTablet' => 'IdeaTab|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A1000|A2107|A2109|A1107|B6000|B8000|B8080-F)', // @ref: http://www.yarvik.com/en/matrix/tablets/ + 'YarvikTablet' => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b', 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB', 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT', // http://www.intenso.de/kategorie_en.php?kategorie=33 + // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate + 'IntensoTablet' => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab', // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/ + 'IRUTablet' => 'M702pro', 'MegafonTablet' => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b', // @ref: http://www.e-boda.ro/tablete-pc.html + 'EbodaTablet' => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)', // @ref: http://www.allview.ro/produse/droseries/lista-tablete-pc/ + 'AllViewTablet' => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)', // @reference: http://wiki.archosfans.com/index.php?title=Main_Page + 'ArchosTablet' => '\b(101G9|80G9|A101IT)\b|Qilive 97R|ARCHOS 101G10', // @ref: http://www.ainol.com/plugin.php?identifier=ainol&module=product + 'AinolTablet' => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark', // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER + // @ref: Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser + // @ref: http://www.sony.jp/support/tablet/ + 'SonyTablet' => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551', // @ref: db + http://www.cube-tablet.com/buy-products.html + 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT', // @ref: http://www.cobyusa.com/?p=pcat&pcat_id=3001 + 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010', // @ref: http://www.match.net.cn/products.asp + 'MIDTablet' => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733', // @ref: http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets) + // @ref: http://www.imp3.net/14/show.php?itemid=20454 + 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)', // @ref: http://www.rock-chips.com/index.php?do=prod&pid=2 + 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A', // @ref: http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/ + 'FlyTablet' => 'IQ310|Fly Vision', // @ref: http://www.bqreaders.com/gb/tablets-prices-sale.html + 'bqTablet' => 'bq.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant)|Maxwell.*Lite|Maxwell.*Plus', // @ref: http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290 + // @ref: http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets) + 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim', // Nec or Medias Tab + 'NecTablet' => '\bN-06D|\bN-08D', // Pantech Tablets: http://www.pantechusa.com/phones/ + 'PantechTablet' => 'Pantech.*P4100', // Broncho Tablets: http://www.broncho.cn/ (hard to find) + 'BronchoTablet' => 'Broncho.*(N701|N708|N802|a710)', // @ref: http://versusuk.com/support.html + 'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b', // @ref: http://www.zync.in/index.php/our-products/tablet-phablets + 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900', // @ref: http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/ + 'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA', // @ref: https://www.nabitablet.com/ + 'NabiTablet' => 'Android.*\bNabi', 'KoboTablet' => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build', // French Danew Tablets http://www.danew.com/produits-tablette.php + 'DanewTablet' => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b', // Texet Tablets and Readers http://www.texet.ru/tablet/ + 'TexetTablet' => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE', // @note: Avoid detecting 'PLAYSTATION 3' as mobile. + 'PlaystationTablet' => 'Playstation.*(Portable|Vita)', // @ref: http://www.trekstor.de/surftabs.html + 'TrekstorTablet' => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2', // @ref: http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets + 'PyleAudioTablet' => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b', // @ref: http://www.advandigital.com/index.php?link=content-product&jns=JP001 + // @Note: because of the short codenames we have to include whitespaces to reduce the possible conflicts. + 'AdvanTablet' => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ', // @ref: http://www.danytech.com/category/tablet-pc + 'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1', // @ref: http://www.galapad.net/product.html + 'GalapadTablet' => 'Android.*\bG1\b', // @ref: http://www.micromaxinfo.com/tablet/funbook + 'MicromaxTablet' => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b', // http://www.karbonnmobiles.com/products_tablet.php + 'KarbonnTablet' => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b', // @ref: http://www.myallfine.com/Products.asp + 'AllFineTablet' => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide', // @ref: http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr= + 'PROSCANTablet' => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b', // @ref: http://www.yonesnav.com/products/products.php + 'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026', // @ref: http://www.cjshowroom.com/eproducts.aspx?classcode=004001001 + // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html) + 'ChangJiaTablet' => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503', // @ref: http://www.gloryunion.cn/products.asp + // @ref: http://www.allwinnertech.com/en/apply/mobile.html + // @ref: http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB) + // @todo: Softwiner tablets? + // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions. + 'GUTablet' => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G + // @ref: http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118 + 'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10', // @ref: http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/ + // @todo: add more tests. + 'OvermaxTablet' => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)', // @ref: http://hclmetablet.com/India/index.php + 'HCLTablet' => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync', // @ref: http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html + 'DPSTablet' => 'DPS Dream 9|DPS Dual 7', // @ref: http://www.visture.com/index.asp + 'VistureTablet' => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10', // @ref: http://www.mijncresta.nl/tablet + 'CrestaTablet' => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989', // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309 + 'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b', // Concorde tab + 'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan', // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/ + 'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042', // Modecom Tablets - http://www.modecom.eu/tablets/portal/ + 'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003', // Vonino Tablets - http://www.vonino.eu/tablets + 'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b', // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0 + 'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1', // Storex Tablets - http://storex.fr/espace_client/support.html + // @note: no need to add all the tablet codes since they are guided by the first regex. + 'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab', // Generic Vodafone tablets. + 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10', // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb + // Aka: http://www.essentielb.fr/ + 'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2', // Ross & Moor - http://ross-moor.ru/ + 'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711', // i-mobile http://product.i-mobilephone.com/Mobile_Device + 'iMobileTablet' => 'i-mobile i-note', // @ref: http://www.tolino.de/de/vergleichen/ + 'TolinoTablet' => 'tolino tab [0-9.]+|tolino shine', // AudioSonic - a Kmart brand + // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72¤tPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1 + 'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b', // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/ + // @todo: add them gradually to avoid conflicts. + 'AMPETablet' => 'Android.* A78 ', // Skk Mobile - http://skkmobile.com.ph/product_tablets.php + 'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)', // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1 + 'TecnoTablet' => 'TECNO P9', // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3 + 'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b', // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/ + 'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)', // @ref: http://www.tesco.com/direct/hudl/ + 'Hudl' => 'Hudl HT7S3', // @ref: http://www.telstra.com.au/home-phone/thub-2/ + 'TelstraTablet' => 'T-Hub2', 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|ViewPad7|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab',]; + + /** + * List of mobile Operating Systems. + * + * @var array + */ + protected static $operatingSystems = ['AndroidOS' => 'Android', 'BlackBerryOS' => 'blackberry|\bBB10\b|rim tablet os', 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino', 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b', // @reference: http://en.wikipedia.org/wiki/Windows_Mobile + 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;', // @reference: http://en.wikipedia.org/wiki/Windows_Phone + // http://wifeng.cn/?r=blog&a=view&id=106 + // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx + 'WindowsPhoneOS' => 'Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7', 'iOS' => '\biPhone.*Mobile|\biPod|\biPad', // http://en.wikipedia.org/wiki/MeeGo + // @todo: research MeeGo in UAs + 'MeeGoOS' => 'MeeGo', // http://en.wikipedia.org/wiki/Maemo + // @todo: research Maemo in UAs + 'MaemoOS' => 'Maemo', 'JavaOS' => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135 + 'webOS' => 'webOS|hpwOS', 'badaOS' => '\bBada\b', 'BREWOS' => 'BREW',]; + + /** + * List of mobile User Agents. + * + * @var array + */ + protected static $browsers = [// @reference: https://developers.google.com/chrome/mobile/docs/user-agent + 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?', 'Dolfin' => '\bDolfin\b', 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+', 'Skyfire' => 'Skyfire', 'IE' => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+ + 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', 'Bolt' => 'bolt', 'TeaShark' => 'teashark', 'Blazer' => 'Blazer', // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3 + 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile', // @ref: http://en.wikipedia.org/wiki/Midori_(web_browser) + //'Midori' => 'midori', + 'Tizen' => 'Tizen', 'UCBrowser' => 'UC.*Browser|UCWEB', // @ref: https://github.com/serbanghita/Mobile-Detect/issues/7 + 'DiigoBrowser' => 'DiigoBrowser', // http://www.puffinbrowser.com/index.php + 'Puffin' => 'Puffin', // @ref: http://mercury-browser.com/index.html + 'Mercury' => '\bMercury\b', // @reference: http://en.wikipedia.org/wiki/Minimo + // http://en.wikipedia.org/wiki/Vision_Mobile_Browser + 'GenericBrowser' => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger']; + + /** + * Utilities. + * + * @var array + */ + protected static $utilities = [// Experimental. When a mobile device wants to switch to 'Desktop Mode'. + // @ref: http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/ + // @ref: https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011 + 'DesktopMode' => 'WPDesktop', 'TV' => 'SonyDTV|HbbTV', // experimental + 'WebKit' => '(webkit)[ /]([\w.]+)', 'Bot' => 'Googlebot|DoCoMo|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit', 'MobileBot' => 'Googlebot-Mobile|DoCoMo|YahooSeeker/M1A1-R2D2', // @todo: Include JXD consoles. + 'Console' => '\b(Nintendo|Nintendo WiiU|PLAYSTATION|Xbox)\b', 'Watch' => 'SM-V700',]; + + /** + * All possible HTTP headers that represent the + * User-Agent string. + * + * @var array + */ + protected static $uaHttpHeaders = [// The default User-Agent string. + 'HTTP_USER_AGENT', // Header can occur on devices using Opera Mini. + 'HTTP_X_OPERAMINI_PHONE_UA', // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/ + 'HTTP_X_DEVICE_USER_AGENT', 'HTTP_X_ORIGINAL_USER_AGENT', 'HTTP_X_SKYFIRE_PHONE', 'HTTP_X_BOLT_PHONE_UA', 'HTTP_DEVICE_STOCK_UA', 'HTTP_X_UCBROWSER_DEVICE_UA']; + + /** + * The individual segments that could exist in a User-Agent string. VER refers to the regular + * expression defined in the constant self::VER. + * + * @var array + */ + protected static $properties = [ + + // Build + 'Mobile' => 'Mobile/[VER]', 'Build' => 'Build/[VER]', 'Version' => 'Version/[VER]', 'VendorID' => 'VendorID/[VER]', + + // Devices + 'iPad' => 'iPad.*CPU[a-z ]+[VER]', 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]', 'iPod' => 'iPod.*CPU[a-z ]+[VER]', //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'), + 'Kindle' => 'Kindle/[VER]', + + // Browser + 'Chrome' => ['Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'], 'Coast' => ['Coast/[VER]'], 'Dolfin' => 'Dolfin/[VER]', // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference + 'Firefox' => 'Firefox/[VER]', 'Fennec' => 'Fennec/[VER]', // @reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx + 'IE' => ['IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];'], // http://en.wikipedia.org/wiki/NetFront + 'NetFront' => 'NetFront/[VER]', 'NokiaBrowser' => 'NokiaBrowser/[VER]', 'Opera' => [' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]'], 'Opera Mini' => 'Opera Mini/[VER]', 'Opera Mobi' => 'Version/[VER]', 'UC Browser' => 'UC Browser[VER]', 'MQQBrowser' => 'MQQBrowser/[VER]', 'MicroMessenger' => 'MicroMessenger/[VER]', // @note: Safari 7534.48.3 is actually Version 5.1. + // @note: On BlackBerry the Version is overwriten by the OS. + 'Safari' => ['Version/[VER]', 'Safari/[VER]'], 'Skyfire' => 'Skyfire/[VER]', 'Tizen' => 'Tizen/[VER]', 'Webkit' => 'webkit[ /][VER]', + + // Engine + 'Gecko' => 'Gecko/[VER]', 'Trident' => 'Trident/[VER]', 'Presto' => 'Presto/[VER]', + + // OS + 'iOS' => ' \bOS\b [VER] ', 'Android' => 'Android [VER]', 'BlackBerry' => ['BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'], 'BREW' => 'BREW [VER]', 'Java' => 'Java/[VER]', // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx + // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases + 'Windows Phone OS' => ['Windows Phone OS [VER]', 'Windows Phone [VER]'], 'Windows Phone' => 'Windows Phone [VER]', 'Windows CE' => 'Windows CE/[VER]', // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd + 'Windows NT' => 'Windows NT [VER]', 'Symbian' => ['SymbianOS/[VER]', 'Symbian/[VER]'], 'webOS' => ['webOS/[VER]', 'hpwOS/[VER];'],]; + + /** + * Construct an instance of this class. + * + * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored. + * If left empty, will use the global _SERVER['HTTP_*'] vars instead. + * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT + * from the $headers array instead. + */ + public function __construct(array $headers = null, $userAgent = null) + { + $this->setHttpHeaders($headers); + $this->setUserAgent($userAgent); + } + + /** + * Get the current script version. + * This is useful for the demo.php file, + * so people can check on what version they are testing + * for mobile devices. + * + * @return string The version number in semantic version format. + */ + public static function getScriptVersion() + { + return self::VERSION; + } + + /** + * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. + * + * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract + * the headers. The default null is left for backwards compatibilty. + */ + public function setHttpHeaders($httpHeaders = null) + { + //use global _SERVER if $httpHeaders aren't defined + if (!is_array($httpHeaders) || !count($httpHeaders)) { + $httpHeaders = $_SERVER; + } + + //clear existing headers + $this->httpHeaders = []; + + //Only save HTTP headers. In PHP land, that means only _SERVER vars that + //start with HTTP_. + foreach ($httpHeaders as $key => $value) { + if (substr($key, 0, 5) == 'HTTP_') { + $this->httpHeaders[$key] = $value; + } + } + } + + /** + * Retrieves the HTTP headers. + * + * @return array + */ + public function getHttpHeaders() + { + return $this->httpHeaders; + } + + /** + * Retrieves a particular header. If it doesn't exist, no exception/error is caused. + * Simply null is returned. + * + * @param string $header The name of the header to retrieve. Can be HTTP compliant such as + * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the + * all-caps, HTTP_ prefixed, underscore seperated awesomeness. + * + * @return string|null The value of the header. + */ + public function getHttpHeader($header) + { + //are we using PHP-flavored headers? + if (strpos($header, '_') === false) { + $header = str_replace('-', '_', $header); + $header = strtoupper($header); + } + + //test the alternate, too + $altHeader = 'HTTP_' . $header; + + //Test both the regular and the HTTP_ prefix + if (isset($this->httpHeaders[$header])) { + return $this->httpHeaders[$header]; + } elseif (isset($this->httpHeaders[$altHeader])) { + return $this->httpHeaders[$altHeader]; + } + } + + public function getMobileHeaders() + { + return self::$mobileHeaders; + } + + /** + * Get all possible HTTP headers that + * can contain the User-Agent string. + * + * @return array List of HTTP headers. + */ + public function getUaHttpHeaders() + { + return self::$uaHttpHeaders; + } + + /** + * Set the User-Agent to be used. + * + * @param string $userAgent The user agent string to set. + */ + public function setUserAgent($userAgent = null) + { + if (!empty($userAgent)) { + return $this->userAgent = $userAgent; + } else { + + $this->userAgent = null; + + foreach ($this->getUaHttpHeaders() as $altHeader) { + if (!empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow. (Serban) + $this->userAgent .= $this->httpHeaders[$altHeader] . " "; + } + } + + return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null); + + } + } + + /** + * Retrieve the User-Agent. + * + * @return string|null The user agent if it's set. + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or + * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set. + * + * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default + * parameter is null which will default to self::DETECTION_TYPE_MOBILE. + * @deprecated since version 2.6.9 + * + */ + public function setDetectionType($type = null) + { + if ($type === null) { + $type = self::DETECTION_TYPE_MOBILE; + } + + if ($type != self::DETECTION_TYPE_MOBILE && $type != self::DETECTION_TYPE_EXTENDED) { + return; + } + + $this->detectionType = $type; + } + + /** + * Retrieve the list of known phone devices. + * + * @return array List of phone devices. + */ + public static function getPhoneDevices() + { + return self::$phoneDevices; + } + + /** + * Retrieve the list of known tablet devices. + * + * @return array List of tablet devices. + */ + public static function getTabletDevices() + { + return self::$tabletDevices; + } + + /** + * Alias for getBrowsers() method. + * + * @return array List of user agents. + */ + public static function getUserAgents() + { + return self::getBrowsers(); + } + + /** + * Retrieve the list of known browsers. Specifically, the user agents. + * + * @return array List of browsers / user agents. + */ + public static function getBrowsers() + { + return self::$browsers; + } + + /** + * Retrieve the list of known utilities. + * + * @return array List of utilities. + */ + public static function getUtilities() + { + return self::$utilities; + } + + /** + * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). + * + * @return array All the rules (but not extended). + * @deprecated since version 2.6.9 + * + */ + public static function getMobileDetectionRules() + { + static $rules; + + if (!$rules) { + $rules = array_merge(self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers); + } + + return $rules; + + } + + /** + * Method gets the mobile detection rules + utilities. + * The reason this is separate is because utilities rules + * don't necessary imply mobile. This method is used inside + * the new $detect->is('stuff') method. + * + * @return array All the rules + extended. + * @deprecated since version 2.6.9 + * + */ + public function getMobileDetectionRulesExtended() + { + static $rules; + + if (!$rules) { + // Merge all rules together. + $rules = array_merge(self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers, self::$utilities); + } + + return $rules; + } + + /** + * Retrieve the current set of rules. + * + * @return array + * @deprecated since version 2.6.9 + * + */ + public function getRules() + { + if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) { + return self::getMobileDetectionRulesExtended(); + } else { + return self::getMobileDetectionRules(); + } + } + + /** + * Retrieve the list of mobile operating systems. + * + * @return array The list of mobile operating systems. + */ + public static function getOperatingSystems() + { + return self::$operatingSystems; + } + + /** + * Check the HTTP headers for signs of mobile. + * This is the fastest mobile check possible; it's used + * inside isMobile() method. + * + * @return bool + */ + public function checkHttpHeadersForMobile() + { + + foreach ($this->getMobileHeaders() as $mobileHeader => $matchType) { + if (isset($this->httpHeaders[$mobileHeader])) { + if (is_array($matchType['matches'])) { + foreach ($matchType['matches'] as $_match) { + if (strpos($this->httpHeaders[$mobileHeader], $_match) !== false) { + return true; + } + } + return false; + } else { + return true; + } + } + } + + return false; + + } + + /** + * Magic overloading method. + * + * @method boolean is[...]() + * @param string $name + * @param array $arguments + * @return mixed + * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is' + */ + public function __call($name, $arguments) + { + //make sure the name starts with 'is', otherwise + if (substr($name, 0, 2) != 'is') { + throw new BadMethodCallException("No such method exists: $name"); + } + + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + $key = substr($name, 2); + + return $this->matchUAAgainstKey($key); + } + + /** + * Find a detection rule that matches the current User-agent. + * + * @param null $userAgent deprecated + * @return boolean + */ + protected function matchDetectionRulesAgainstUA($userAgent = null) + { + // Begin general search. + foreach ($this->getRules() as $_regex) { + if (empty($_regex)) { + continue; + } + if ($this->match($_regex, $userAgent)) { + return true; + } + } + + return false; + } + + /** + * Search for a certain key in the rules array. + * If the key is found the try to match the corresponding + * regex agains the User-Agent. + * + * @param string $key + * @param null $userAgent deprecated + * @return mixed + */ + protected function matchUAAgainstKey($key, $userAgent = null) + { + // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc. + $key = strtolower($key); + + //change the keys to lower case + $_rules = array_change_key_case($this->getRules()); + + if (array_key_exists($key, $_rules)) { + if (empty($_rules[$key])) { + return null; + } + + return $this->match($_rules[$key], $userAgent); + } + + return false; + } + + /** + * Check if the device is mobile. + * Returns true if any type of mobile device detected, including special ones + * @param null $userAgent deprecated + * @param null $httpHeaders deprecated + * @return bool + */ + public function isMobile($userAgent = null, $httpHeaders = null) + { + + if ($httpHeaders) { + $this->setHttpHeaders($httpHeaders); + } + + if ($userAgent) { + $this->setUserAgent($userAgent); + } + + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + if ($this->checkHttpHeadersForMobile()) { + return true; + } else { + return $this->matchDetectionRulesAgainstUA(); + } + + } + + /** + * Check if the device is a tablet. + * Return true if any type of tablet device is detected. + * + * @param string $userAgent deprecated + * @param array $httpHeaders deprecated + * @return bool + */ + public function isTablet($userAgent = null, $httpHeaders = null) + { + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + foreach (self::$tabletDevices as $_regex) { + if ($this->match($_regex, $userAgent)) { + return true; + } + } + + return false; + } + + /** + * This method checks for a certain property in the + * userAgent. + * @param $key + * @param string $userAgent deprecated + * @param string $httpHeaders deprecated + * @return bool|int|null + * @todo: The httpHeaders part is not yet used. + * + */ + public function is($key, $userAgent = null, $httpHeaders = null) + { + // Set the UA and HTTP headers only if needed (eg. batch mode). + if ($httpHeaders) { + $this->setHttpHeaders($httpHeaders); + } + + if ($userAgent) { + $this->setUserAgent($userAgent); + } + + $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); + + return $this->matchUAAgainstKey($key); + } + + /** + * Some detection rules are relative (not standard), + * because of the diversity of devices, vendors and + * their conventions in representing the User-Agent or + * the HTTP headers. + * + * This method will be used to check custom regexes against + * the User-Agent string. + * + * @param $regex + * @param string $userAgent + * @return bool + * + * @todo: search in the HTTP headers too. + */ + public function match($regex, $userAgent = null) + { + // Escape the special character which is the delimiter. + $regex = str_replace('/', '\/', $regex); + + return (bool)preg_match('/' . $regex . '/is', (!empty($userAgent) ? $userAgent : $this->userAgent)); + } + + /** + * Get the properties array. + * + * @return array + */ + public static function getProperties() + { + return self::$properties; + } + + /** + * Prepare the version number. + * + * @param string $ver The string version, like "2.6.21.2152"; + * + * @return float + * @todo Remove the error supression from str_replace() call. + * + */ + public function prepareVersionNo($ver) + { + $ver = str_replace(['_', ' ', '/'], '.', $ver); + $arrVer = explode('.', $ver, 2); + + if (isset($arrVer[1])) { + $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions. + } + + return (float)implode('.', $arrVer); + } + + /** + * Check the version of the given property in the User-Agent. + * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) + * + * @param string $propertyName The name of the property. See self::getProperties() array + * keys for all possible properties. + * @param string $type Either self::VERSION_TYPE_STRING to get a string value or + * self::VERSION_TYPE_FLOAT indicating a float value. This parameter + * is optional and defaults to self::VERSION_TYPE_STRING. Passing an + * invalid parameter will default to the this type as well. + * + * @return string|float The version of the property we are trying to extract. + */ + public function version($propertyName, $type = self::VERSION_TYPE_STRING) + { + if (empty($propertyName)) { + return false; + } + + //set the $type to the default if we don't recognize the type + if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) { + $type = self::VERSION_TYPE_STRING; + } + + $properties = self::getProperties(); + + // Check if the property exists in the properties array. + if (array_key_exists($propertyName, $properties)) { + + // Prepare the pattern to be matched. + // Make sure we always deal with an array (string is converted). + $properties[$propertyName] = (array)$properties[$propertyName]; + + foreach ($properties[$propertyName] as $propertyMatchString) { + + $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); + + // Escape the special character which is the delimiter. + $propertyPattern = str_replace('/', '\/', $propertyPattern); + + // Identify and extract the version. + preg_match('/' . $propertyPattern . '/is', $this->userAgent, $match); + + if (!empty($match[1])) { + $version = ($type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]); + + return $version; + } + + } + + } + + return false; + } + + /** + * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants. + * + * @return string One of the self::MOBILE_GRADE_* constants. + */ + public function mobileGrade() + { + $isMobile = $this->isMobile(); + + if (// Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) + $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT) >= 4.3 || $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT) >= 3.1 || $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT) >= 3.1 || + + // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) + // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM + // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices + // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 + ($this->version('Android', self::VERSION_TYPE_FLOAT) > 2.1 && $this->is('Webkit')) || + + // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 + $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT) >= 7.0 || + + // Blackberry 7 - Tested on BlackBerry Torch 9810 + // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 + $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 6.0 || // Blackberry Playbook (1.0-2.0) - Tested on PlayBook + $this->match('Playbook.*Tablet') || + + // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) + ($this->version('webOS', self::VERSION_TYPE_FLOAT) >= 1.4 && $this->match('Palm|Pre|Pixi')) || // Palm WebOS 3.0 - Tested on HP TouchPad + $this->match('hp.*TouchPad') || + + // Firefox Mobile (12 Beta) - Tested on Android 2.3 device + ($this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 12) || + + // Chrome for Android - Tested on Android 4.0, 4.1 device + ($this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 4.0) || + + // Skyfire 4.1 - Tested on Android 2.3 device + ($this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT) >= 4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3) || + + // Opera Mobile 11.5-12: Tested on Android 2.3 + ($this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) > 11 && $this->is('AndroidOS')) || + + // Meego 1.2 - Tested on Nokia 950 and N9 + $this->is('MeeGoOS') || + + // Tizen (pre-release) - Tested on early hardware + $this->is('Tizen') || + + // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser + // @todo: more tests here! + $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT) >= 2.0 || + + // UC Browser - Tested on Android 2.3 device + (($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3) || + + // Kindle 3 and Fire - Tested on the built-in WebKit browser for each + ($this->match('Kindle Fire') || $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT) >= 3.0) || + + // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet + $this->is('AndroidOS') && $this->is('NookTablet') || + + // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 + $this->version('Chrome', self::VERSION_TYPE_FLOAT) >= 11 && !$isMobile || + + // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 + $this->version('Safari', self::VERSION_TYPE_FLOAT) >= 5.0 && !$isMobile || + + // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 + $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 4.0 && !$isMobile || + + // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 + $this->version('MSIE', self::VERSION_TYPE_FLOAT) >= 7.0 && !$isMobile || + + // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 + // @reference: http://my.opera.com/community/openweb/idopera/ + $this->version('Opera', self::VERSION_TYPE_FLOAT) >= 10 && !$isMobile + + ) { + return self::MOBILE_GRADE_A; + } + + if ($this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT) < 4.3 || $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT) < 3.1 || $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT) < 3.1 || + + // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 + $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) < 6 || + + //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 + ($this->version('Opera Mini', self::VERSION_TYPE_FLOAT) >= 5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT) <= 6.5 && ($this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 || $this->is('iOS'))) || + + // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) + $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || + + // @todo: report this (tested on Nokia N71) + $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) >= 11 && $this->is('SymbianOS')) { + return self::MOBILE_GRADE_B; + } + + if (// Blackberry 4.x - Tested on the Curve 8330 + $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) < 5.0 || // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) + $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT) <= 5.2 + + ) { + return self::MOBILE_GRADE_C; + } + + //All older smartphone platforms and featurephones - Any device that doesn't support media queries + //will receive the basic, C grade experience. + return self::MOBILE_GRADE_C; + } +} diff --git a/_incl_data/class/Priems.php b/_incl_data/class/Priems.php new file mode 100644 index 00000000..e3a8abdc --- /dev/null +++ b/_incl_data/class/Priems.php @@ -0,0 +1,2848 @@ +users[]['eff'] после использования, в противном случаи некотрые приемы используются через 1 ход +*/ + +class Priems +{ + private $btl; + private $u; + const FIRE = 'fire'; + const WATER = 'water'; + const AIR = 'air'; + const EARTH = 'earth'; + private $mname = [ + 'огонь' => 1, + 'воздух' => 2, + 'вода' => 3, + 'земля' => 4, + 'свет' => 5, + 'тьма' => 6, + 'серая' => 7, + ]; + public $ue = []; + private $logColor = [ + 'crit' => '#f00', + 'miss' => '#888', + self::FIRE => '#a00', + self::WATER => '#00a', + self::EARTH => '#0a0', + self::AIR => '#0af', + ]; + + public function __construct() + { + global $btl; + $this->btl = $btl; + $this->u = User::start(); + } + + /**@deprecated try to use getDynamicInfo()*/ + private function getdr($s, $v, $d) + { + $i = 0; + while ($i < count($v)) { + if (isset($v[$i])) { + $s = str_replace('{' . $v[$i] . '}', $d[$i], $s); + } + $i++; + } + $s = eval("return (" . $s . ");"); + return floor($s); + } + + /** + * @param $match + * @return false|float + */ + private function getDynamicInfo($match) + { + $tmpl = [ + 'lvl1' => $this->u->info['level'], + 'ts5' => $this->u->stats['s5'], + 'mpAll' => $this->u->stats['mpAll'], + ]; + foreach ($tmpl as $k => $v) { + $match = str_ireplace('{' . $k . '}', $v, $match); + } + $p = $match[2]; + + if (preg_match('/(\d+)(?:\s*)([+\-*\/])(?:\s*)(\d+)/', $match[2], $matches) !== false) { + $operator = $matches[2]; + + switch ($operator) { + case '+': + $p = $matches[1] + $matches[3]; + break; + case '-': + $p = $matches[1] - $matches[3]; + break; + case '*': + $p = $matches[1] * $matches[3]; + break; + case '/': + $p = $matches[1] / $matches[3]; + break; + default: + } + } + return floor($p); + } + + + /** Набив Статики + * @param int $uid если 0, будет использоваться id противника напротив. + * @return void + */ + public function addAirStaticPoints($uid = 0) + { + if ($uid == 0) { + $uid = $this->ue['id']; + } + $x = Db::getValue( + 'select x from eff_users where uid = ? and `delete` = 0 and v2 = 260 and user_use = ? order by id desc limit 1', + [$uid, $this->u->info['id']] + ); + if (empty($x) || $x >= 5) { + return; + } + $x++; + $data['add_mg2static_points'] = $x; + $data = $this->impStats($data); + Db::sql( + 'update eff_users set x = ?, data = ? where uid = ? and `delete` = 0 and v2 = 260 and user_use = ?', + [$x, $data, $uid, $this->u->info['id']] + ); + } + + /** отнимаем ману + * @param $uid + * @param $mp + * @param $tp [not used] + * @return bool + */ + public function minMana($uid, $mp, $tp = null) + { + global $btl; + /* уменьшаем расход маны, если $mp > 0 */ + //с вычетом уменьшения разсхода маныss + $mp -= round($mp / 100 * $btl->stats[$btl->uids[$uid]]['min_use_mp']); + $btl->stats[$btl->uids[$uid]]['mpNow'] -= $mp; + $mpNow = $this->zeromax($btl->stats[$btl->uids[$uid]]['mpNow'], $btl->stats[$btl->uids[$uid]]['mpAll']); + if ($mpNow > 0) { + Db::sql( + 'update stats set mpNow = ? where id = ?', + [$btl->stats[$btl->uids[$uid]]['mpNow'], $uid] + ); + } + return $mpNow > 0; + } + + /** Какой-то нестандартный частный расчет маг.крита + * @param $l2 + * @param $t + * @return int + */ + public function magKrit($l2, $t) + { + $r = $l2 * 2 - 7; + if ($r > $t) { + //магический промах (серый удар, в 2 раза меньше) 6% + //250 ед. защиты от магии дает 1% шанса увернуться от магии + //$r = -1; , промах -- + $r = 0; + } else { + //каждая владелка дает 3% шанс крита + $r = ceil($t * 0.75); + if ($r > 30) { + $r = 30; + } + if (rand(0, 10000) < $r * 100) { + //крит удар + $r = 1; + } else { + $r = 0; + } + } + return $r; + } + + /** используем прием каждый ход + * @param $eff + * @param $pr + * @return bool + */ + public function hodUsePriem($eff, $pr) + { + global $btl; + $return_main = true; + $ue = Db::getRow( + 'select * from users left join stats on (users.id = stats.id) where users.id = ? and battle = ? and hpNow > 0', + [$eff['uid'], $btl->info['id']] + ); + + if (!empty($pr['file'])) { + if (file_exists('../../_incl_data/class/priems/' . $pr['file'] . '.php')) { + $hod = $eff['hod']; + require_once 'priems/' . $pr['file'] . '.php'; + } + } elseif (!empty($pr['file3'])) { + if (file_exists('../../_incl_data/class/priems/' . $pr['file3'] . '.php')) { + $hod = $eff['hod']; + require_once 'priems/' . $pr['file3'] . '.php'; + } + } + return $return_main; + } + + /** Получает строку data c шаблонной записью типа add_m11=2*{lvl1} и конвертирует в реальную строку. + *
    Шаблон:
    lvl1 = $uid[level]
    ts5 = $uid[s5]
    mpAll = $uid[mpAll] + * @param string $pl строка в формате data + * @param int $uid пользователь, параметры которого используются для подставки в шаблон. + * @return string строка в формате data с развёрнутыми шаблонами. + */ + public function redate($pl, $uid) + { + global $btl; + $i = 0; + if ($pl != '') { + $e = explode('|', $pl); + while ($i < count($e)) { + $f = explode('=', $e[$i]); +// $f[1] = $this->getdr( +// $f[1], [0 => 'lvl1', 1 => 'ts5', 2 => 'mpAll'], [ +// 0 => $btl->users[$btl->uids[$uid]]['level'], +// 1 => $btl->stats[$btl->uids[$uid]]['s5'], +// 2 => $btl->stats[$btl->uids[$uid]]['mpAll'], +// ] +// ); + $f[1] = $this->getDynamicInfo($f[1]); + if ($f[0] != '' && $f[1] != '') { + $e[$i] = implode('=', $f); + } + $i++; + } + $pl = implode('|', $e); + } + return $pl; + } + + private function cancelEffects($effects_ids, $uid, Battle $btl) + { + $arr = explode(',', $effects_ids); + if (!is_array($arr) || empty($arr)) { + return; + } + foreach ($arr as $eid) { + if ($eid <= 0) { + continue; + } + $p = Db::getRow( + 'select * from eff_users where uid = ? and v1 = ? and v2 = ? and `delete` = 0', [$uid, 'priem', $eid] + ); + if (!$p['id']) { + continue; + } + $p['priem'] = Db::getRow('select * from priems where id = ?', [$eid]); + $btl->delPriem($p, $btl->users[$btl->uids[$uid]], 2); + } + } + + /* uid - на кого кастуем + pr - id приема + data - дата, если -1, то добавляем дату3 + d2 - добавляем дату3 + tm - время использования, 77 - вечно + h - кол-во "вечных" ходов + uu - id юзера который использовал + tp - тип приема + */ + /** + * @param int $uid на кого кастуем + * @param int $pr id приема + * @param int|string $data дата, если -1, то добавляем дату3 + * @param int $d2 + * @param $tm + * @param int $h ход + * @param int $uu id юзера который использовал + * @param $max + * @param $bj + * @param $tp + * @param $ch + * @param $rdt + * @param $tr_life_user + * @param $noupdatebtl + * @param $noplus + * @param $pname + * @return bool + */ + public function addPriem( + $uid, + $pr, + $data, + $d2, + $tm, + $h, + $uu, + $max, + $bj, + $tp = 0, + $ch = 0, + $rdt = 0, + $tr_life_user = 0, + $noupdatebtl = 0, + $noplus = 0, + $pname = null + ) { + global $btl; + //$pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . (int)$pr)); + $pl = Db::getRow('select * from priems where id = ?', [$pr]); + + $r = false; + + if (!$pl['id']) { + return false; + } + + if ($data == -1) { + $data = $this->redate($pl['date3'], $this->u->info['id']); + } elseif ($d2 == 1) { + $data .= '|' . $this->redate($pl['date3'], $this->u->info['id']); + } + + $this->cancelEffects($pl['cancel_eff2'], $uid, $btl); + + if ($max <= 0) { + return false; + } + + if ($noplus == 0) { + if ($pl['zmu'] == 1) { + $num = Db::getRow( + 'select * from eff_users where bj = ? and user_use = ? and uid = ? and `delete` = 0', + [$bj, $this->u->info['id'], $uid] + ); + } else { + $num = Db::getRow( + 'select * from eff_users where bj = ? and uid = ? and `delete` = 0', + [$bj, $uid] + ); + } + } + + if (isset($num['id']) && ($num['user_use'] != $this->u->info['id'] && $pl['zmu'] != 2)) { + // удаляем эффект + Db::sql( + 'update eff_users set `delete` = unix_timestamp() where id = ?', + [$num['id']] + ); + $i = 0; + while ($i < count($btl->stats[$btl->uids[$uid]]['effects'])) { + if ($btl->stats[$btl->uids[$uid]]['effects'][$i]['id'] == $num['id']) { + //обновляем + $btl->stats[$btl->uids[$uid]]['effects'][$i]['delete'] = time(); + } + $i++; + } + unset($num); + } + if (!isset($num['id'])) { + $q = 'insert into eff_users (tr_life_user, bj, user_use, hod, v2, img2, id_eff, uid, name, data, overType, timeUse, v1) values (?,?,?,?,?,?,?,?,?,?,?,?,?)'; + $image = !empty($pl['img']) ? $pl['img'] : $pl['id']; + $name = !empty($pname) ? $pname : $pl['name']; + $image .= '.gif'; + Db::sql( + $q, [floor($tr_life_user), $bj, $uu, $h, $pl['id'], $image, 22, $uid, $name, $data, 0, $tm, 'priem'] + ); + $lid = Db::lastInsertId(); + if ($lid) { + $r = true; + } + + /* добавляем данные к $btl->eff */ + if ($noupdatebtl == 0) { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($uid, 0); + } + } elseif ($num['x'] < $max) { + //Добавляем еще и обновляем заряды + $num['x']++; + $num['hod'] = $h; + if ($data != -1 && $data != '' && $d2 == 2) { + $num['data'] .= '|' . $data; + Db::sql( + 'update eff_users set x = x + 1, hod = ?, data = ? where id = ?', + [$h, $num['data'], $num['id']] + ); + } else { + Db::sql( + 'update eff_users set x = x + 1, hod = ? where id = ?', + [$h, $num['id']] + ); + } + $r = true; + } else { + //обновляем заряды + $num['hod'] = $h; + if ($data != -1 && $data != '' && $d2 == 2) { + $num['data'] .= '|' . $data; + Db::sql("update eff_users set hod = ?, data = ? where id = ?", [$h, $num['data'], $num['id']]); + } else { + Db::sql( + 'update eff_users set hod = ? where id = ?', + [$h, $num['id']] + ); + } + $r = true; + } + + if (isset($num['id'])) { + foreach ($btl->stats[$btl->uids[$uid]]['effects'] as $effect) { + if ($effect['id'] != $num['id']) { + continue; + } + $effect['data'] = $num['data']; + $effect['hod'] = $num['hod']; + $effect['x'] = $num['x']; + } + } + + return $r; + } + + /** Превращает строку data ('a=1|b=2|c=3') из БД в массив [a=>1, b=>2, c=>3]. + * @param $m + * @return array + */ + public function lookStatsArray($m) + { + $arr = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $m . '}'), true); + return $arr ?: []; + } + + /** Превращает массив [a=>1, b=>2, c=>3] в строку data ('a=1|b=2|c=3') для БД. + * @param array $m + * @return string + */ + private function impStats(array $m) + { + $str = json_encode($m); + return $str ? str_replace(['":', ',"', '{"', '}'], ['=', '|'], $str) : ''; + } + + /** + * @param $data + * @param array $values + * @return string + */ + private function changeStatsData($data, array $values) + { + $arr = $this->lookStatsArray($data); + foreach ($values as $key => $value) { + $arr[$key] = $value; + } + return $this->impStats($arr); + } + + public function magicRegen($ue, $hpmin, $tmp, $pl, $eff, $rp = 0, $dp = 0, $krituet = true, $dopyrn = 0) + { + global $btl; + $rr = []; + $uen = $ue['id']; + $usu = $eff['user_use']; + if ($eff['user_use'] < 1) { + $usu = $this->u->info['id']; + } + $k = $this->magKrit($ue['level'], $btl->stats[$btl->uids[$usu]]['mg' . $tmp]); + + if (!$krituet) { + $k = 0; + } + + $hpmin = $this->testPower($btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $hpmin, $tmp, 2); + $hpmin = round($hpmin); + + $dopyrn = $this->testPower($btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $dopyrn, $tmp, 2); + $dopyrn = round($dopyrn); + + if ($btl->users[$btl->uids[$uen]]['tactic7'] <= 0 && $dp == 0) { + $hpmin = 0; + $k = -1; + $dopyrn = 0; + } + if ($k == 1 && $hpmin != 0 && $krituet) { + //крит + $hpmin = $hpmin * 2; + } elseif ($k == -1 && $hpmin != 0) { + //промах + $hpmin = $hpmin / 2; + $dopyrn = $dopyrn / 2; + } + if ($hpmin < 1) { + $hpmin = 0; + } else { + $hpmin = rand(($hpmin * 0.97), $hpmin); + } + + $hpmin += floor($dopyrn); + + if (isset($btl->stats[$btl->uids[$uen]]['min_heal_proc'])) { + if ($btl->stats[$btl->uids[$uen]]['min_heal_proc'] > 100) { + $btl->stats[$btl->uids[$uen]]['min_heal_proc'] = 100; + } + $hpmin = round($hpmin / 100 * (100 + $btl->stats[$btl->uids[$uen]]['min_heal_proc'])); + } + + if ($btl->users[$btl->uids[$uen]]['tactic7'] > 0 && $dp == 0) { + //Отнимаем тактики, если это возможно + $btl->users[$btl->uids[$uen]]['tactic7'] -= $hpmin / $btl->stats[$btl->uids[$uen]]['hpAll']; + $btl->users[$btl->uids[$uen]]['tactic7'] = round($btl->users[$btl->uids[$uen]]['tactic7'], 2); + $btl->stats[$btl->uids[$uen]]['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; + if ($uen == $this->u->info['id']) { + $this->u->info['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; + $this->u->stats['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; + } + if ($btl->users[$btl->uids[$uen]]['tactic7'] < 0) { + $btl->users[$btl->uids[$uen]]['tactic7'] = 0; + } + } + $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] + $hpmin); + + if ($hp2 > $btl->stats[$btl->uids[$uen]]['hpAll']) { + $hpmin = floor($hp2 - $btl->stats[$btl->uids[$uen]]['hpAll']); + $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; + } elseif ($hp2 < 0) { + $hp2 = 0; + } + $rr[0] = $hpmin; //урон + $rr[1] = $k; //тип + /* проверяем приемы защиты */ + //получаем массив с приемами противника + $miny = 0; //на сколько едениц урон буде меньше (защита приема) + $minu = 0; + $sp1 = mysql_query( + 'SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "' . $uen . '" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25' + ); + while ($pl2 = mysql_fetch_assoc($sp1)) { + $pl2['priem'] = mysql_fetch_assoc( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pl2['v2'] . '" LIMIT 1') + ); + if (isset($pl2['priem']['id'])) { + $dt1 = $this->lookStatsArray($pl2['priem']['date2']); + if (isset($dt1['yron_u2'])) { + + $minu = $this->getdr( + $dt1['yron_u2'], [0 => 'lvl1', 1 => 'yr1', 2 => 'ts5', 3 => 'ts6'], + [0 => $btl->users[$btl->uids[$level]], 1 => $hpmin, 2 => 0, 3 => 0] + ); + $miny -= $minu; + $hpmin += $minu; + $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); + } + } + } + + /* проверяем приемы ослабления */ + + //отнимаем НР + $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; + $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; + mysql_query( + 'UPDATE `stats` SET `hpNow` = ' . $hp2 . ',`tactic7` = ' . $btl->users[$btl->uids[$uen]]['tactic7'] . ' WHERE `id` = "' . $uen . '" LIMIT 1' + ); + + //заносим в лог боя + $vLog = + 'time1=' . time() . + '||s1=' . $this->u->info['sex'] . + '||t1=' . $this->u->info['team'] . + '||login1=' . $this->u->info['login'] . + '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . + '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . + '||login2=' . $btl->users[$btl->uids[$uen]]['login']; + $mas1 = [ + 'time' => time(), + 'battle' => $btl->info['id'], + 'id_hod' => ($btl->hodID + 1), + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($rp == 1) { + $mas1['id_hod']--; + } + + $btl->takeExp($this->u->info['id'], ($hpmin * 0.33), $this->u->info['id'], $uen, true); + + if ($hpmin > 0) { + $hpmin = '+' . ceil($hpmin); + } else { + $hpmin = '--'; + } + $tco = [1 => '006699', 2 => '006699', 3 => '006699', 4 => '006699']; //не крит + $tcl = [1 => 'A00000', 2 => '008080', 3 => '0000FF', 4 => 'A52A2A']; //не крит + $tco = $tco[$tmp]; + $tcl = $tcl[$tmp]; + if ($k == 1) { + //крит + $tco = 'FF0000'; + $tcl = 'FF0000'; + } elseif ($k == -1) { + //промах + $tco = '979797'; + $tcl = '979797'; + } + $nmz = [ + 1 => [0 => 'огня', 1 => 'огненная'], + 2 => [0 => 'воздуха', 1 => 'электрическая'], + 3 => [0 => 'воды', 1 => 'водная'], + 4 => [0 => 'земли', 1 => 'земляная'], + ]; + $nmz = $nmz[$tmp]; + + if ($rp == 1) { + $sx = [0 => '', 1 => 'а']; + $mas1['text'] = '{tm1} Заклинание "' . $pl['name'] . '" восстановило здоровье персонажа {u2}. ' . $hpmin . ' [' . ceil( + $hp2 + ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} заклинание "' . $pl['name'] . '" и восстановил здоровье персонажа {u2} магией ' . $nmz[0] . '. ' . $hpmin . ' [' . ceil( + $hp2 + ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; + } + $btl->add_log($mas1); + $pz[(int)$id] = 1; + return $rr; + } + + /** Проверка есть ли на персонаже призрачные защиты для рассчёта урона через magicAttack + * @return array + */ + private function hasGhostDefence($uid) + { + $def = [ + 'all' => false, + self::FIRE => false, + self::AIR => false, + self::EARTH => false, + self::WATER => false, + ]; + $priems = Db::getRows('select v2 from eff_users where uid = ? and v2 in (141, 142, 144, 145, 146)', [$uid]); + foreach ($priems as $priem) { + if ($priem['v2'] == 141) { + $def['all'] = true; + } + if ($priem['v2'] == 142) { + $def[self::FIRE] = true; + } + if ($priem['v2'] == 144) { + $def[self::AIR] = true; + } + if ($priem['v2'] == 145) { + $def[self::WATER] = true; + } + if ($priem['v2'] == 146) { + $def[self::EARTH] = true; + } + } + return $def; + } + + /** + * Новая функция магического заклинания с приёма. + * Работает с числовыми приёмами в папке [priem]. + * @param int $attackerId кто использует приём + * @param int $defenderId на кого использует приём + * @param float $damage базовый урон приёма + * @param string $damageType тип урона (стихия?) приходит строкой, и конвертируется функцией. + * @param bool $hasCritical флаг, что приём МОЖЕТ критовать + * @return array [0|damage] int урон, [1|crit] bool был ли крит, [2|miss] bool был ли промах, [3|miss_type] int тип промаха (всегда = 2). + * @author Insallah + */ + public function magicAttack(Battle $btl, $attackerId, $defenderId, $damage, $damageType, $hasCritical = false) + { + // Не так паршиво как прошлая, но всё ещё паршиво. Теперь хоть что-то понять можно. + $dmgRuNames = [ + self::FIRE => 'огонь', + self::WATER => 'вода', + self::AIR => 'воздух', + self::EARTH => 'земля', + ]; + if (in_array($damageType, array_keys($dmgRuNames))) { + $damageType = $dmgRuNames[$damageType]; + } + + // Мощь. + // pm# = Мф. мощности магии определенного типа + // m11 = Мф. мощности магии стихий + // m11a = Мф. мощности магии + // ОКАЗЫВАЕТСЯ [pm# = m11 + m11a] где-то выше по коду! + $power = $btl->stats[$btl->uids[$attackerId]]['pm' . $this->mname[$damageType]]; + + // Подавление в процентах. + $suppression = 0; + $suppression += $btl->stats[$btl->uids[$attackerId]]['pzm']; + // Уязвимость магии стихий, из приёма 250. + $suppression += $btl->stats[$btl->uids[$attackerId]]['yzm']; + + // Сколько у использующего умений числом. + $skills = $btl->stats[$btl->uids[$attackerId]]['mg' . $this->mname[$damageType]]; + + // Защита цели числом + // zm# = Защита от магии определенного типа + // zm = Защита от магии стихий + // zma = Защита от магии + // ОКАЗЫВАЕТСЯ [zm# = zm + zma] где-то выше по коду! + $defence = $btl->stats[$btl->uids[$defenderId]]['zm' . $this->mname[$damageType]]; + + // Минимум умений для 100% успеха приёма. + // У 8 екро-мага со старта 20, это очень много: 8 бьёт 10 без промаха. + $requiredSkills = $btl->users[$btl->uids[$defenderId]]['level'] * 2; + + // Чёртово "Следующий каст будет критическим". + $isGarantCrit = $btl->stats[$btl->uids[$attackerId]]['acestar'] > 0; + + // Подавляем защиту, понижая число на процент подавления. + $supressedDefence = Math::addPercent($defence, -min($suppression, 100)); + + // Урон зависит от умений и уровня противника. + $damage *= $skills - $requiredSkills; + + // Увеличиваем урон, повышая число на мощь если урон > 0. + $poweredDamage = $damage > 0 ? $damage + $power : 0; + + // Шанс крита равен уровню магического навыка + $isCritical = $hasCritical && $skills >= mt_rand(0, 100); + + if ($isGarantCrit) { + $isCritical = true; + Db::sql( + 'delete from eff_users where uid = ? and `delete` = 0 and data like ?', + [$attackerId, '%add_acestar%'] + ); + unset($q); + } + + if ($skills >= $requiredSkills || $isCritical) { + $isHit = true; + } else { + $isCritical = false; + $missChance = 3 * ($requiredSkills - $skills); + $isHit = mt_rand(0, 100) > $missChance; + } + + // Для совместимости. Старая функция возвращает это значение, вдруг оно где-то используется. + $pType = 0; + if ($isHit) { + // Урон = Повреждения - Защита, но не меньше 0. Округлено до целых. + //$finalDamage = max(round(Math::addPercent($poweredDamage, -$supressedDefence)), 0); + $finalDamage = $poweredDamage - $supressedDefence; + if ($isCritical) { + $finalDamage *= 2; + } + } else { + $finalDamage = 0; + // Для совместимости. Старая функция возвращает это значение, вдруг оно где-то используется. + $pType = 2; + } + + // Призрачки, режут конечный урон после вычета защиты. + $ghostDefences = $this->hasGhostDefence($defenderId); + if ($ghostDefences['all']) { + $finalDamage /= 4; + } + + // Костыль для призрачек. Когда вызовы русских стихий уберутся, будет не нужен. + if (in_array($damageType, $dmgRuNames)) { + $damageType = array_search($damageType, $dmgRuNames); + } + + if ($ghostDefences[$damageType]) { + $finalDamage /= 2; + } + + $finalDamage = max(round($finalDamage), 0); + + // Для отладки. + if ($btl->users[$btl->uids[$attackerId]]['admin'] > 0) { + $s = "Подавление защиты: $suppression%, Бонус урона: $power, Навыки: $skills, +
    Усиление урона от уровня и скилла: damage x ($skills - $requiredSkills)
    $damageType + Его Защита: ($defence -$suppression%) = $supressedDefence | + Мой Урон: ($damage +$power) = $poweredDamage
    + Мой Удар: ($poweredDamage -$supressedDefence) = $finalDamage"; + $s .= $isCritical ? ' (крит *2)' : ''; + echo "
    $s
    "; + } + + + // !isHit потому что прошлая функуция возвращала Промах. + // pType ни на что не влияет, = 0 и просто становится = 2 при промахе. Зачем - загадка. + // -damage потому что где-то дальше код разворачивает результат меняя ему знак. + return [ + (int)$finalDamage, + $isCritical, + !$isHit, + $pType, // для совместимости + 'damage' => (int)$finalDamage, + 'crit' => $isCritical, + 'miss' => !$isHit, + 'miss_type' => $pType, + ]; + } + + /** Оставлена для совместимости. На неё ссылается куча всего. */ + public function magatack($u1, $u2, $yron, $type, $krit) + { + global $btl; + return $this->magicAttack($btl, $u1, $u2, $yron, $type, $krit); + } + + public function magatackfiz($u1, $u2, $yron, $type, $krit, $ymelki) + { + global $btl; + $cof_mag = [ + 0 => 250, + 1 => 250, + 2 => 250, + 3 => 250, + 4 => 250, + 5 => 250, + 6 => 250, + 7 => 250, + 8 => 250, + 9 => 300, + 10 => 360, + 11 => 475, + 12 => 520, + 13 => 625, + 14 => 750, + 15 => 895, + 16 => 1075, + 17 => 1290, + 18 => 1550, + 19 => 1860, + 20 => 2230, + 21 => 2675, + ]; + + $r = $yron; + // + if (!isset($ymelki) || $ymelki == '0') { + $ymelki = $type; + } + // + $prm = [ + 'ym' => $btl->stats[$btl->uids[$u1]]['mg' . $this->mname[$ymelki]], //умелки (магические умелки) + 'y' => $btl->stats[$btl->uids[$u1]]['a' . $this->mname[$ymelki]], //умелки + 'yv' => 0, //умения, значение коф. + 'max_krit' => 0 //вероятность крита + ]; + // + // (уровень цени)*2 - 7 - минимальное умелок, чтобы не было промахов + /* + Для магии Света/Тьмы по формуле: Уровень Цели * 2 – 9 + каждая умелка выше этой нормы увеличивает маг крит на 3%. но не больше 30% + */ + //Рассчет урона от приема + /* + b - базовый урон + m - мощь + z - защита цели [ед.] + p - подавление [ед.] + k - коэффициент ; k=250 для 8ки, k=300 для 9ки и т.д. +20% на уровень + */ + $prm['b'] = $r; //базовый урон + $prm['m'] = $btl->stats[$btl->uids[$u1]]['pa' . $this->mname[$type]]; //мощь + $prm['z'] = $btl->stats[$btl->uids[$u2]]['za' . $this->mname[$type]]; //защита цели (ед.) + $prm['p'] = $btl->stats[$btl->uids[$u1]]['pza' . $this->mname[$type]]; //подавление (ед.) + $prm['k'] = $cof_mag[$btl->users[$btl->uids[$u1]]['level']]; //коэффицент + // + if ($prm['p'] * 10 > $prm['k']) { + $prm['p'] = floor($prm['k'] / 10); + } + // + $r = $prm['b'] * (1 + $prm['m'] / 100) * pow(2, (($prm['p'] * 10 - $prm['z']) / $prm['k'])); + if ($r < floor($prm['b'] * 0.2)) { + $r = floor($prm['b'] * 0.2); + } elseif ($r > floor($prm['b'] * 10)) { + $r = floor($prm['b'] * 10); + } + // + //$prm['y'] -= 5; + if ($type < $this->mname[$type]) { + $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 7); + } else { + $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 9); + } + // + if ($prm['y'] >= $prm['yv'] || (isset($this->mname[$ymelki]) && $prm['ym'] >= $prm['yv'])) { + if ($krit == 1) { + if (isset($this->mname[$ymelki])) { + $prm['max_krit'] = 3 * ($prm['ym'] - $prm['yv']); + } else { + $prm['max_krit'] = 3 * ($prm['y'] - $prm['yv']); + } + //echo '[Magical crit: '.$prm['max_krit'].'%]'; + if ($prm['max_krit'] < 0) { + $prm['max_krit'] = 0; + } elseif ($prm['max_krit'] > 30) { + $prm['max_krit'] = 30; + } + //$prm['max_krit'] = round($prm['max_krit']/2); + //Крит возможен + if (rand(0, 100) <= $prm['max_krit']) { + $krit = true; + } else { + $krit = false; + } + } else { + $krit = false; + } + $promah = false; + } else { + $krit = false; + //Вероятность промоха + $prm['promah'] = 3 * ($prm['yv'] - $prm['ym']); + if ($prm['promah'] < 0) { + $prm['promah'] = 0; + } elseif ($prm['promah'] > 30) { + $prm['promah'] = 30; + } + if (rand(0, 100) <= $prm['promah']) { + $promah = true; + } else { + $promah = false; + } + } + // + if ($krit) { + $r = $r * 2; + $promah_type = 0; + } elseif ($promah) { + $r = rand(1, floor($r / 4)); + $promah_type = 1; + if (rand(0, 100) < 50) { + $r = 0; + $promah_type = 2; + } + } + // + unset($prm); + // + return [floor($r), $krit, $promah, $promah_type]; + } + + //для папки priems + public function magicAtack( + $ue, + $hpmin, + $tmp, + $pl, + $eff, + $rp = 0, + $mxx = 0, + $fiz = 0, + $nomf = 0, + $krituet = true, + $heal = 0, + $namenew = null + ) { + $trawm_off = false; + global $btl; + if ($namenew != null) { + $pl['name'] = $namenew; + } + $rr = []; + $nhpmin = $hpmin; + $uen = $ue['id']; + $usu = $eff['user_use']; + if ($eff['user_use'] < 1) { + $usu = $this->u->info['id']; + } + if ($nomf == 0) { + $k = $this->magKrit($ue['level'], $btl->stats[$btl->uids[$usu]]['mg' . $tmp]); + if (!$krituet) { + $k = 0; + } + if ($fiz == 0) { + //магический урон + $hpmin = $this->testPower( + $btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $hpmin, $tmp, + 2 + ); + } else { + //физический урон + $wAp = $btl->stats[$btl->uids[$usu]]['pa' . $tmp . '']; + $wAp += $btl->stats[$btl->uids[$usu]]['m10']; + $wAp -= $btl->stats[$btl->uids[$uen]]['antpa' . $tmp . ''] * 1.75; + $wAp -= $btl->stats[$btl->uids[$uen]]['antm10'] * 1.75; + $hpmin += ceil((0.01 + $hpmin / 100) * (0.01 + 0.98 * $wAp)) - 1; + + $hpmin -= round( + $hpmin / 100 * (35 * ($btl->stats[$btl->uids[$uen]]['za'] + $btl->stats[$btl->uids[$uen]]['za' . $tmp]) / 1200) + ); + $hpmin = round($hpmin); + + if (isset($btl->stats[$btl->uids[$uen]]['zaproc']) || isset($btl->stats[$btl->uids[$uen]]['za' . $fiz . 'proc'])) //защита от урона (призрачки) + { + $hpmin = floor( + $hpmin / 100 * (100 - $btl->stats[$btl->uids[$uen]]['zaproc'] - $btl->stats[$btl->uids[$uen]]['za' . $fiz . 'proc']) + ); + if ($hpmin < 0) { + $hpmin = 0; + } + } + } + } + $hpmin = round($hpmin); + if ($k == 1 and $krituet) { + //крит + $hpmin = $hpmin * 2; + } elseif ($k == -1) { + //промах + $hpmin = $hpmin / 2; + } + if ($hpmin < $nhpmin * 0.2) { + $hpmin = $nhpmin * 0.2; + } + if ($hpmin < 1) { + $hpmin = 0; + } else { + if ($nomf == 0) { + $hpmin = rand(($hpmin * 0.97), $hpmin); + } + } + if ($mxx > 0 && $hpmin > $mxx) { + if ($k == 0) { + $hpmin = $mxx; + } elseif ($k == 1 && $hpmin / 2 > $mxx) { + $hpmin = $mxx * 2; + } + } + $rr[0] = $hpmin; //урон + $rr[1] = $k; //тип + /* проверяем приемы защиты */ + //получаем массив с приемами противника + $miny = 0; //на сколько едениц урон буде меньше (защита приема) + $sp1 = mysql_query( + 'SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "' . $uen . '" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25' + ); + while ($pl2 = mysql_fetch_assoc($sp1)) { + $pl2['priem'] = mysql_fetch_assoc( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pl2['v2'] . '" LIMIT 1') + ); + if (isset($pl2['priem']['id'])) { + $dt1 = $this->lookStatsArray($pl2['priem']['date2']); + if (isset($dt1['yron_u2'])) { + $minu = $this->getdr( + $dt1['yron_u2'], [0 => 'lvl1', 1 => 'yr1', 2 => 'ts5', 3 => 'ts6'], + [0 => $btl->users[$btl->uids[$level]], 1 => $hpmin, 2 => 1, 3 => 0] + ); + $miny -= $minu; + $hpmin += $minu; + if (isset($dt1['rzEndMg']) && $dt1['rzEndMg'] == 1) { + $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); + } + } elseif (isset($dt1['rzEndMg']) && $dt1['rzEndMg'] == 1) { + $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); + } + } + } + + $hpmin = $btl->testPogB($uen, $hpmin); + + $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] - $hpmin); + + if ($btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg' . $tmp] > 0 && $fiz == 0) { + //Часть урона восставнавливает ману + $btl->stats[$btl->uids[$usu]]['mpNow'] += round( + $hpmin / 100 * $btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg' . $tmp] + ); + //if($btl->stats[$btl->uids[$usu]]['mpNow'] > $btl->stats[$btl->uids[$usu]]['mpAll']) { + //$btl->stats[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpAll']; + //} + $btl->users[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; + if ($usu == $this->u->info['id']) { + $this->u->info['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; + $this->u->stats['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; + } + } + + if ($hp2 < 0) { + $hp2 = 0; + } elseif ($hp2 > $btl->stats[$btl->uids[$uen]]['hpAll']) { + $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; + } + + $btl->stats[$btl->uids[$uen]]['last_hp'] = -floor($hpmin); + + if ($heal != 0) { + if ($heal == -1) { + //хил на текущий урон с учетом мф + $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] += $hpmin; + if ($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] < 0) { + $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = 0; + } elseif ($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] > $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']) { + $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']; + } + + if ($eff['user_use'] == $this->u->info['id']) { + $this->u->stats['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; + } + + $btl->users[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; + + mysql_query( + 'UPDATE `stats` SET `hpNow` = "' . $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] . '" WHERE `id` = "' . $eff['user_use'] . '" LIMIT 1' + ); + } else { + //хил на конкретное число + + } + } + + /* проверяем приемы ослабления */ + + //отнимаем НР + $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; + $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; + + if ($uen == $this->u->info['id']) { + $this->u->stats['hpNow'] = $hp2; + } + + // тяж травма для кровавых + if ($btl->info['type'] == 99 and $hp2 == 0 and !$trawm_off) { + //$eff['user_use'] + //$sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); + + $trawm_off = true; + //$at[2][$i]['ttravm']='получил Тяжелую травму.'; + $btl->addTravm($btl->users[$btl->uids[$uen]]['id'], 3, $btl->users[$btl->uids[$eff['user_use']]]['level']); + } + $upd = mysql_query( + 'UPDATE `stats` SET `hpNow` = ' . $hp2 . ',`last_hp` = "' . $btl->stats[$btl->uids[$uen]]['last_hp'] . '" WHERE `id` = "' . $uen . '" LIMIT 1' + ); + + //заносим в лог боя + $vLog = 'time1=' . time( + ) . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . ''; + $mas1 = [ + 'time' => time(), + 'battle' => $btl->info['id'], + 'id_hod' => ($btl->hodID + 1), + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($rp > 0) { + $mas1['id_hod']--; + } + $hpminkrit = 0; + if ($k == 1) { + $hpminkrit = $hpmin; + } + $btl->addNewStat( + [ + 'battle' => $this->u->info['battle'], + 'uid1' => $this->u->info['id'], + 'uid2' => $uen, + 'time' => time(), + 'type' => 0, + 'a' => '10000', + 'b' => 0, + 'type_a' => 1, + 'type_b' => 0, + 'ma' => 1, + 'mb' => 1, + 'yrn' => $hpmin, + 'yrn_krit' => $hpminkrit, + 'tm1' => $this->u->info['team'], + 'tm2' => $btl->users[$btl->uid[$uen]]['team'], + ] + ); + + $btl->takeExp($this->u->info['id'], $hpmin, $usu, $uen); + + if ($hpmin > 0) { + $hpmin = '-' . ceil($hpmin); + } else { + $hpmin = '--'; + } + $tco = [ + 1 => '006699', + 2 => '006699', + 3 => '006699', + 4 => '006699', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + $tcl = [ + 1 => 'A00000', + 2 => '008080', + 3 => '0000FF', + 4 => 'A52A2A', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + $tco = $tco[$tmp]; + $tcl = $tcl[$tmp]; + if ($k == 1) { + //крит + $tco = 'FF0000'; + $tcl = 'FF0000'; + } elseif ($k == -1) { + //промах + $tco = 'CCCCCC'; + $tcl = 'CCCCCC'; + } + $nmz = [ + 1 => [0 => 'огня', 1 => 'огненный'], + 2 => [0 => 'воздуха', 1 => 'электрический'], + 3 => [0 => 'воды', 1 => 'холод'], + 4 => [0 => 'земли', 1 => 'земляной'], + 5 => [0 => 'Свет', 1 => 'Свет'], + 6 => [0 => 'Тьма', 1 => 'Тьма'], + 7 => [0 => 'Серая магия', 1 => 'Серая магия'], + ]; + $nmz = $nmz[$tmp]; + if ($fiz > 0) { + $nmz = [ + 1 => [0 => ', колющая атака , ', 1 => 'колющий'], + 2 => [0 => ', рубящая атака , ', 1 => 'рубящий'], + 3 => [0 => ', дробящая атака , ', 1 => 'дробящий'], + 4 => [0 => ', режущая атака , ', 1 => 'режущий'], + ]; + $nmz = $nmz[$fiz]; + } + + if ($rp == 1) { + if ($k == 0) { + $tcl = '000000'; + $tco = '008000'; + } + $sx = [0 => '', 1 => 'а']; + $mas1['text'] = '{tm1} {u2} утратил' . $sx[$btl->users[$btl->uids[$uen]]['sex']] . ' здоровье от "' . $pl['name'] . '". ' . $hpmin . ' [' . ceil( + $hp2 + ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; + } else { + if ($fiz == 1) { + $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '" и поразил {u2}. ' . $hpmin . ' [' . ceil( + $hp2 + ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} заклинание "' . $pl['name'] . '" и поразил магией ' . $nmz[0] . ' {u2}. ' . $hpmin . ' [' . ceil( + $hp2 + ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; + } + } + $btl->add_log($mas1); + $pz[(int)$id] = 1; + return $rr; + } + + private function testActiv($id) + { + $r = 0; + if ( + $this->u->info['admin'] > 0 || + $this->u->info['nadmin'] > 0 || + $this->u->info['id'] > 0) { + $r = 1; + } else { + $tst = $this->u->testAction( + '`uid` = "' . $this->u->info['id'] . '" AND `time` < ' . time( + ) . ' AND `vars` = "read" AND `vals` = "' . $id . '" LIMIT 1', + 1 + ); + if (isset($tst['id'])) { + $r = 1; + } + } + return $r; + } + + private function testRazmenOldUser($u2, $u1, $plid) + { + global $btl, $u; + $r = 0; + //Уровень -противника- ниже уровня -цели- + if ($btl->users[$btl->uids[$u2]]['id'] != $this->u->info['id']) { + if ($btl->users[$btl->uids[$u1]]['level'] < $btl->users[$btl->uids[$u2]]['level']) { + $r = 1; + echo '
    Нельзя кастовать через слабого противника в сильного
    '; + } elseif ($btl->users[$btl->uids[$u1]]['bot'] > 0 && $btl->users[$btl->uids[$u2]]['bot'] == 0) { + echo '
    Нельзя кастовать через монстров или зверя
    '; + $r = 1; + } elseif ( + $btl->users[$btl->uids[$u1]]['id'] != $btl->users[$btl->uids[$u2]]['id'] && + !in_array($plid, [35, 63, 64, 65, 66, 85, 86, 87, 88, 89, 90, 104, 105, 106, 107, 134, 135, 136, 137]) + ) //Атака в темную 90,89,88,87,86,85,35 + { + $this->addPriem( + $this->u->info['id'], '344', 'add_m11=-' . round($this->u->stats['m11'] * 75 / 100), 1, 77, 1, + $this->u->stats['id'], 3, 'тьма', 0, 0, 1 + ); //ТУТ понижение урона при уроне через персонажа + } + } + return $r; + } + + public function testDie($u1) + { + global $btl; + //Персонаж 1 погиб от рук персонаж 2 + $btl->spaCheck($btl->stats[$btl->uids[$u1]]['id']); + } + + public function pruse($id) + { + global $u, $c, $code, $btl, $ue; + if ($id == 100500 && $this->u->info['animal'] > 0) { + $use_lst = $this->u->testAction( + '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', + 1 + ); + if (!isset($use_lst['id'])) { + $a = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `users_animal` WHERE `uid` = "' . $this->u->info['id'] . '" AND `id` = "' . $this->u->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1' + ) + ); + if ($this->u->stats['hpNow'] < 1) { + echo 'Вы не можете выпустить зверя, вы потеряли все НР'; + } elseif (isset($a['id']) && $a['eda'] < 1) { + echo 'Вы не накормили зверя...'; + } elseif (isset($a['id'])) { + //Добавляем зверя в бой + $tp = [ + 1 => 'Кот', + 2 => 'Сова', + 3 => 'Светляк', + 4 => 'Чертяка', + 5 => 'Пес', + 6 => 'Свин', + 7 => 'Дракон', + ]; + $id = mysql_fetch_assoc( + mysql_query( + 'SELECT `id` FROM `test_bot` WHERE `login` = "' . $tp[$a['type']] . ' [' . $a['level'] . ']" LIMIT 1' + ) + ); + if (isset($id['id']) && $btl->info['type'] != 500) { + $b = $this->u->addNewbot($id['id'], null, null); + if ($b > 0 && $b != false) { + $a['eda'] -= 4; + if ($a['eda'] < 0) { + $a['eda'] = 0; + } + + $vLog = 'time1=' . time( + ) . '||s1=' . $this->u->info['sex'] . '||t1=' . $this->u->info['team'] . '||login1=' . $this->u->info['login'] . ''; + $mas1 = [ + 'time' => time(), + 'battle' => $btl->info['id'], + 'id_hod' => $btl->hodID, + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + + $sex = $this->u->info['sex'] === 1 ? 'a' : ''; + $mas1['text'] = "{tm1} {u1} выпустил$sex зверя "" . $a['name'] . '"'; + $btl->add_log($mas1); + + mysql_query( + 'UPDATE `users` SET `login` = "' . $a['name'] . ' (зверь ' . $this->u->info['login'] . ')",`obraz` = "' . $a['obraz'] . '.gif",`battle` = "' . $btl->info['id'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `stats` SET `team` = "' . $this->u->info['team'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `users_animal` SET `eda` = "' . $a['eda'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1' + ); + $this->u->addAction(time(), 'animal_use' . $btl->info['id'], $a['level']); + } else { + echo 'Не удалось выпустить зверя...'; + } + } else { + //Бот не найден + echo '
    Не удалось выпустить зверя - он боится...'; + } + } else { + //зверь не найден + echo 'У Вас нет зверя ...'; + } + } else { + //зверь уже выпущен + echo 'Вы уже выпускали зверя в этом бою ...'; + } + } else { + $p = explode('|', $this->u->info['priems']); + $pz = explode('|', $this->u->info['priems_z']); + if ($p[(int)$id] > 0 && $pz[(int)$id] <= 0 && $this->u->info['hpNow'] >= 1) { + $pl = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `priems` WHERE `level`<=' . $this->u->info['level'] . ' AND `id` = ' . $p[(int)$id] + ) + ); + if (isset($pl['id']) && $pl['activ'] != 1) { + if ($pl['activ'] == 0) { + unset($pl); + } elseif ($pl['activ'] > 1) { + //Книжный прием + if ($this->testActiv($pl['activ']) == 0) { + unset($pl); + } + } + } + if (isset($pl['id'])) { + $notr = 0; + $pl['useon_user'] = $this->u->info['enemy']; + if (isset($_POST['useon']) && $_POST['useon'] != '' && $_POST['useon'] != 'none') { + $_POST['useon'] = iconv('UTF-8', 'windows-1251', $_POST['useon']); + $this->ue = mysql_fetch_assoc( + mysql_query( + 'SELECT + + `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` + LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) + WHERE ( + `u`.`login`="' . mysql_real_escape_string($_POST['useon']) . '" OR + ( + `u`.`login2` = "' . mysql_real_escape_string($_POST['useon']) . '" AND + `u`.`login2` != "") + ) AND + ( + `u`.`inUser` > 0 OR + ( + `u`.`battle`="' . $btl->info['id'] . '" AND + `st`.`hpNow` > 0 + ) + ) ORDER BY `u`.`id` DESC LIMIT 1' + ) + ); + if (isset($this->ue['id']) && $this->ue['inUser'] > 0) { + $this->ue = mysql_fetch_assoc( + mysql_query( + 'SELECT + + `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` + LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) + WHERE + `u`.`battle`="' . $btl->info['id'] . '" AND + `st`.`hpNow` > 0) AND + `u`.`id` = "' . $this->ue['inUser'] . '" ORDER BY `u`.`id` ASC LIMIT 1' + ) + ); + } + if (!isset($this->ue['id']) && $pl['trUser'] > 0) { + $notr++; + } + if ($pl['team'] == 1) { + //свои + if ($this->u->info['team'] != $this->ue['team']) { + $notr++; + } + } elseif ($pl['team'] == 2) { + //противники + if ($this->u->info['team'] == $this->ue['team']) { + $notr++; + } + } elseif ($pl['team'] == 0) { + //любая команда + + } + } else { + $ga = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $this->u->info['enemy'] . '" LIMIT 1' + ) + ); + if (($this->u->info['enemy'] == 0 || isset($ga['id'])) && ($pl['tr_hod'] > 0 || $pl['trUser'] > 0)) { + $notr++; + } + } + + $notr += $this->testpriem($pl, 1, $this->ue['id']); + + if ($this->ue['id'] > 0) { + $notr += $this->testRazmenOldUser($this->ue['id'], $this->u->info['enemy'], $pl['id']); + } + + if ($notr == 0) { + mysql_query( + 'UPDATE `stats` SET `last_pr` = "' . $pl['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + + //Приемы на персонажах + if ($this->ue['id'] > 0) { + $btl->priemsRazmen([$this->u->info['id'], $this->ue['id']], 'fast'); + mysql_query( + 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->ue['id'] . '" AND `delete` = 0' + ); + } else { + $btl->priemsRazmen([$this->u->info['id'], $this->u->info['enemy']], 'fast'); + mysql_query( + 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['enemy'] . '" AND `delete` = 0' + ); + } + mysql_query( + 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['id'] . '" AND `delete` = 0' + ); + + if (file_exists('../../_incl_data/class/priem/' . $pl['id'] . '.php')) { + require('../../_incl_data/class/priem/' . $pl['id'] . '.php'); + $this->testDie($this->ue['id']); + } else { + echo 'useSkill' . $pl['id']; + } + + if (!isset($cup)) { + $this->uppz($pl, $id); + //Отнимаем тактики + //$this->mintr($pl); + if ($pl['tr_hod'] > 0) { + $this->trhod($pl); + } + if ($pl['id'] != 258) { + if ($pl['cancel_eff'] == '') { + $pl['cancel_eff'] = '258'; + } else { + $pl['cancel_eff'] .= ',258'; + } + } + if ($pl['cancel_eff'] != '') { + $i = 0; + $e = explode(',', $pl['cancel_eff']); + while ($i < count($e)) { + if ($e[$i] > 0) { + if ($e[$i] == 258) { + $nem = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1' + ) + ); + } else { + $nem = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->ue['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1' + ) + ); + } + if (isset($nem['id'])) { + $nem['priem'] = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `priems` WHERE `id` = "' . $e[$i] . '" LIMIT 1' + ) + ); + if (isset($nem['id'])) { + $btl->delPriem($nem, $btl->users[$btl->uids[$this->ue['id']]], 500); + } + } + } + $i++; + } + } + } + } + } + } + } + } + + private function rezadEff($uid, $mg) + { + global $u, $btl, $c, $code; + //$this->rezadEff($this->u->info['id'],'wis_fire_'); + $md = ''; + $md2 = ''; + $ex = explode('|', $btl->users[$btl->uids[$uid]]['priems']); + $ex2 = explode('|', $btl->users[$btl->uids[$uid]]['priems_z']); + $i = 0; + $ty = []; + while ($i < count($ex)) { + if ($ex[$i] > 0) { + $md .= '`id` = "' . ((int)$ex[$i]) . '" OR '; + $ty[$ex[$i]] = $i; + } + $i++; + } + $md = rtrim($md, ' OR '); + if ($md != '') { + $md = '( ' . $md . ' ) AND '; + } + $sp = mysql_query('SELECT * FROM `priems` WHERE ' . $md . ' `img` LIKE "%' . $mg . '%"'); + while ($pl = mysql_fetch_assoc($sp)) { + $ex2[$ty[$pl['id']]] = 0; + } + $md2 = implode('|', $ex2); + $btl->users[$btl->uids[$uid]]['priems_z'] = $md2; + $this->u->info['priems_z'] = $md2; + $upd = mysql_query('UPDATE `stats` SET `priems_z` = "' . $md2 . '" WHERE `id` = "' . ((int)$uid) . '" LIMIT 1'); + unset($md, $md2, $ty); + return $upd; + } + + private function trhod($pl) + { + global $u, $btl; + if ($this->u->info['notrhod'] == -1) { + $this->u->info['notrhod'] = 0; + if ($this->u->stats['magic_cast'] > 0) { + $this->u->info['notrhod'] = $this->u->stats['magic_cast']; + } + mysql_query( + 'UPDATE `users` SET `notrhod` = "' . $this->u->info['notrhod'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + } + if ($this->u->info['notrhod'] > 0) { + if ($pl['tr_hod'] > 0) { + $this->u->info['notrhod']--; + mysql_query( + 'UPDATE `users` SET `notrhod` = "' . $this->u->info['notrhod'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + } + } else { + $a1 = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid2` = "' . $this->u->info['id'] . '" AND `uid1` = "' . $this->u->info['enemy'] . '" LIMIT 1' + ) + ); + if (isset($a1['id'])) { + //противник ударил, пишем что игрок 2 пропустил ход + mysql_query( + 'UPDATE `battle_act` SET `out2` = "1",`tpo2` = "2" WHERE `id` = "' . $a1['id'] . '" LIMIT 1' + ); + $a1['out2'] = 1; + $a1['tpo2'] = 2; + $btl->atacks[$a1['id']] = $a1; + $btl->users[$this->u->info['id']]['priems_z'] = $this->u->info['priems_z']; + $btl->startAtack($a1['id']); + } else { + //бьем противника с пропуском хода + mysql_query( + 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->info['id'] . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time( + ) . '","1","1","2")' + ); + } + } + } + + public function plusData($d1, $d2) + { + global $u; + $j1 = $this->lookStatsArray($d1); + $j2 = $this->lookStatsArray($this->redate($d2, $this->u->info['id'])); + $v = $this->u->lookKeys($this->redate($d2, $this->u->info['id']), 0); // ключи 2 + //добавляем данные друг к другу + $i = 0; + $inf = ''; + while ($i < count($v)) { + $j1[$v[$i]] += $j2[$v[$i]]; + $vi = str_replace('add_', '', $v[$i]); + if ($this->u->is[$vi] != '') { + if ($j2[$v[$i]] > 0) { + $inf .= $this->u->is[$vi] . ': +' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; + } elseif ($j2[$v[$i]] < 0) { + $inf .= $this->u->is[$vi] . ': ' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; + } + } + $i++; + } + $inf = rtrim($inf, ', '); + $j1 = $this->u->impStats($j1); + return $j1; + } + + private function addEffPr($pl, $id) + { + global $u, $btl; + $rcu = false; + $j = $this->lookStatsArray($pl['date2']); + $mpr = false; + $addch = 0; + $uid = $this->u->info['id']; + if (isset($this->ue['id'])) { + $uid = $this->ue['id']; + } + if (isset($j['onlyOne'])) { + $mpr = Db::getRow( + 'select * from eff_users where v2 = ? and uid = ? and `delete` = 0 and mark = 1', + [$pl['id'], $uid] + ); + //$mpr = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `v2` = "' . $pl['id'] . '" AND `uid` = "' . $uid . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); + } + + // if ($pl['cancel_eff2'] != '') { + // $i = 0; + // $e = explode(',', $pl['cancel_eff2']); + // while ($i < count($e)) { + // if ($e[$i] > 0) { + // $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); + // if (isset($nem['id'])) { + // $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $e[$i] . '" LIMIT 1')); + // if (isset($nem['id'])) { + // $btl->delPriem($nem, $btl->users[$btl->uids[$uid]], 2); + // if ($nem['id'] == $mpr['id']) { + // unset($mpr); + // } + // } + // } + // } + // $i++; + // } + // } + + if (!empty($pl['cancel_eff2'])) { + $this->cancelEffects($pl['cancel_eff2'], $uid, $btl); + } + + $pld = [0 => '']; + $nc = 0; + if (isset($mpr['id']) && $j['onlyOne'] == 1) { + //отнимаем тактики + $addch = 1; + $this->mintr($pl); + $this->uppz($pl, $id); + //добавляем прием в эффекты + if (isset($this->ue['id'])) { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); + } else { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); + } + $nc = 1; + } elseif (!isset($mpr['id'])) { + $data = ''; + if (isset($j['date3Plus'])) { + $data = $this->redate($pl['date3'], $this->u->info['id']); + } + + $hd1 = -1; + if ($pl['limit'] > 0) { + $tm = 77; + $hd1 = $pl['limit']; + } else { + $tm = 77; + } + if ($pl['limit'] == -2) { + $hd1 = $pl['limit']; + } + if ($pl['id'] == 239) //Вывод приемов которые не моментальные как бы + { + $btl->priemAddLogFast( + $uid, 0, $pl['name'], + '{tm' . $this->u->info['team'] . '} ' . $btl->addlt( + 1, 17, $btl->users[$btl->uids[$uid]]['sex'], + null + ) . '', + 1, time() + ); + } + + $uu = $pl['id'] === 260 ? '' : $this->u->info['id']; + Db::sql( + 'insert into eff_users (hod, v1, v2, img2, id_eff, uid, name, data, overType, timeUse, user_use) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + [$hd1, 'priem', $pl['id'], $pl['img'] . '.gif', 22, $uid, $pl['name'], $data, 0, $tm, $uu] + ); + + unset($hd1, $uu); + //отнимаем тактики + $addch = 1; + $rcu = true; + $nc = 1; + $this->mintr($pl); + //$this->uppz($pl,$id); + //добавляем прием в эффекты + if (isset($this->ue['id'])) { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); + } else { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); + } + } elseif ($j['onlyOne'] > 1) { + if ($mpr['x'] < $j['onlyOne'] && isset($j['date3Plus'])) { + $j1 = $this->lookStatsArray($mpr['data']); + $j2 = $this->lookStatsArray($this->redate($pl['date3'], $this->u->info['id'])); + $v = $this->u->lookKeys($this->redate($pl['date3'], $this->u->info['id']), 0); // ключи 2 + //добавляем данные друг к другу + $i = 0; + $inf = ''; + while ($i < count($v)) { + $j1[$v[$i]] += $j2[$v[$i]]; + $vi = str_replace('add_', '', $v[$i]); + if ($this->u->is[$vi] != '') { + if ($j2[$v[$i]] > 0) { + $inf .= $this->u->is[$vi] . ': +' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; + } elseif ($j2[$v[$i]] < 0) { + $inf .= $this->u->is[$vi] . ': ' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; + } + } + $i++; + } + $inf = rtrim($inf, ', '); + $j1 = $this->u->impStats($j1); + $pld[0] = ' x' . ($mpr['x'] + 1); + if ($j['refHod'] == 1) { + $mpr['hod'] = $pl['limit']; + } + $upd = mysql_query( + 'UPDATE `eff_users` SET `hod` = "' . $mpr['hod'] . '",`data` = "' . $j1 . '",`x` = `x`+1 WHERE `id` = "' . $mpr['id'] . '" LIMIT 1' + ); + if ($upd) { + //отнимаем тактики + $this->mintr($pl); + $this->uppz($pl, $id); + //добавляем прием в эффекты + if (isset($this->ue['id'])) { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); + } else { + $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); + } + $addch = 1; + $rcu = true; + $nc = 1; + } + } + } + /* тратим свой ход */ + if ($nc == 1 && $pl['tr_hod'] > 0) { + $this->trhod($pl); + } + //return $rcu; + } + + public function mintr($pl) + { + global $u, $btl; + $x = 1; + $rt = ''; + while ($x <= 7) { + if ($pl['ndt' . $x] == 0) { + $this->u->info['tactic' . $x] -= $pl['tt' . $x]; + $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] -= $pl['tt' . $x]; + } + if ($this->u->info['tactic' . $x] < 0) { + $this->u->info['tactic' . $x] = 0; + } + if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < 0) { + $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] = 0; + } + //$rt .= ',`tactic'.$x.'`="'.$this->u->info['tactic'.$x].'"'; + $rt .= ',`tactic' . $x . '`="' . $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] . '"'; + $x++; + } + if ($pl['xuse'] > 0) { + $this->u->addAction(time(), 'use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'], $pl['id']); + } + $rt = ltrim($rt, ','); + mysql_query('UPDATE `stats` SET ' . $rt . ' WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + } + + public function maxtr($x, $val) + { + global $u, $btl; + $this->u->info['tactic' . $x] += $val; + $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] += $val; + if ($this->u->info['tactic' . $x] < 0) { + $this->u->info['tactic' . $x] = 0; + } + if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < 0) { + $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] = 0; + } + $rt = '`tactic' . $x . '`="' . $this->u->info['tactic' . $x] . '"'; + mysql_query('UPDATE `stats` SET ' . $rt . ' WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + } + + private function actpridMax($pl) + { + global $u, $btl; + if ($pl['actprid2'] > 0 || $pl['actprid3'] > 0) { + $i = 0; + $pe = explode('|', $this->u->info['priems']); + $piz = []; + while ($i < count($pe)) { + if ($pl['sbr'] == 0) { + //все блокируем + $psp = mysql_fetch_assoc( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . ((int)$pe[$i]) . '" LIMIT 1') + ); + } else { + //Только текущую школу магии + $imgnm = ''; + $nm = explode('_', $pl['img']); + if ($nm[0] == 'wis') { //магия + $imgnm = $nm[0] . '_' . $nm[1] . '%'; + } else { + $imgnm = $nm[0] . '%'; + } + //только данной школы + $psp = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `priems` WHERE `id` = "' . ((int)$pe[$i]) . '" AND `img` LIKE "' . $imgnm . '" LIMIT 1' + ) + ); + } + if ($pl['noprid'] == 0 && isset($psp['id']) && $psp['tr_hod'] == 0 && $psp['type_pr'] == 1 && $psp['noprid'] == 0) { + if ($pl['actprid2'] > 0) { + $piz[$pe[$i]] = (int)$pl['actprid2']; + } elseif ($pl['actprid3'] > 0) { + $piz[$pe[$i]] = $psp['zad']; + } + } + $i++; + } + $pz = explode('|', $this->u->info['priems_z']); + $p = explode('|', $this->u->info['priems']); + $i = 0; + while ($i < count($p)) { + if ($p[$i] > 0 && isset($piz[$p[$i]]) && $pz[$i] == 0) { + $pz[$i] = $piz[$p[$i]]; + } + $i++; + } + $pz = implode('|', $pz); + $this->u->info['priems_z'] = $pz; + $btl->users[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; + $btl->stats[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; + } + } + + public function uppz($pl, $id) + { + global $u, $btl; + $this->actpridMax($pl); + $p = explode('|', $this->u->info['priems']); + $pz = explode('|', $this->u->info['priems_z']); + $pz[(int)$id] = $pl['zad']; + $i = 0; + $pe = explode(',', $pl['actprid']); + $piz = []; + while ($i < count($pe)) { + $piz[$pe[$i]] = 1; + $i++; + } + $i = 0; + $pe = explode(',', $pl['actprid_one']); + $piz2 = []; + while ($i < count($pe)) { + $piz2[$pe[$i]] = 1; + $i++; + } + $i = 0; + while ($i < count($p)) { + if ($p[$i] > 0) { + if (isset($piz[$p[$i]])) { + if ($pl['id'] == 281) { + //Жертва воде + воздуху дает 5 ед. задержки на землю и огонь + if ($p[$i] == 246 || $p[$i] == 186) { + $pz[$i] = 5; + } else { + $pz[$i] = $pl['zad']; + } + } else { + $pz[$i] = $pl['zad']; + } + } + if (isset($piz2[$p[$i]]) && $pz[$i] == 0) { + $pz[$i] = 1; + } + } + $i++; + } + $pz = implode('|', $pz); + $this->u->info['priems_z'] = $pz; + $btl->users[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; + $btl->stats[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; + $tr = $this->lookStatsArray($pl['tr']); + if (isset($tr['tr_mpNow'])) { + $tr['tr_mpNow'] = round($tr['tr_mpNow'] / 100 * (100 - $this->u->stats['min_use_mp'])); + $btl->users[$btl->uids[$this->u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; + $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; + if ($btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < $btl->users[$btl->uids[$this->u->info['id']]]['mpNow']) { + $btl->users[$btl->uids[$this->u->info['id']]]['mpNow'] = $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow']; + } + } + $this->u->info['mpNow'] = $btl->users[$btl->uids[$this->u->info['id']]]['mpNow']; + mysql_query( + 'UPDATE `stats` SET `mpNow` = "' . $this->u->info['mpNow'] . '",`priems_z` = "' . $pz . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + } + + public function reuns($id) + { + global $u, $c, $code; + $p = explode('|', $this->u->info['priems']); + if ($p[(int)$id] > 0) { + //снимаем прием + $p[(int)$id] = 0; + $p = implode('|', $p); + mysql_query( + 'UPDATE `stats` SET `priems` = "' . mysql_real_escape_string( + $p + ) . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + $this->u->info['priems'] = $p; + } + } + + /** Одеть приём в слот? + * @param $id + * @return void + */ + public function uns($id) + { + global $u, $c, $code; + $pl = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `priems` WHERE `level`<="' . $this->u->info['level'] . '" AND `activ` > "0" AND `id` = "' . $id . '" LIMIT 1' + ) + ); + if (!isset($pl['id']) || $this->testpriem($pl, 1) != 0) { + return; + } + $yes = -1; + $non = -1; + $i = 0; + $p = explode('|', $this->u->info['priems']); + while ($i < $this->u->info['priemslot']) { + if ($non == -1 && $p[$i] == 0) { + $non = $i; + } + if ($p[$i] == $pl['id']) { + $yes = $i; + } + $i++; + } + + if ($yes != -1) { + //такой прием уже стоит, ничего не делаем + return; + } + if ($non != -1) { + //одеваем прием + $p[$non] = $pl['id']; + $p = implode('|', $p); + $upd = mysql_query( + 'UPDATE `stats` SET `priems` = "' . $p . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' + ); + if ($upd) { + $this->u->info['priems'] = $p; + } + } else { + //снимаем последний прием + echo 'Снимаем последний прием...'; + } + } + + //выводим приемы $id - 1 (вне боя), 2 - в бою + public function seeMy($t) + { + global $u, $c, $code, $btl; + $i = 0; + $p = explode('|', $this->u->info['priems']); + $lvar = ''; + $pr = ''; + while ($i < $this->u->info['priemslot']) { + if ($p[$i] > 0) { + $pl = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `priems` WHERE `level`<="' . $this->u->info['level'] . '" AND `activ` > "0" AND `id` = "' . mysql_real_escape_string( + $p[$i] + ) . '" LIMIT 1' + ) + ); + $lvar = $this->priemInfo($pl, $t, $i); + $pz = $lvar[1]; + $lvar = $lvar[0]; + if ($t == 1) { + if (isset($_GET['inv'])) { + $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all=' . ((int)$_GET['all']) . '&skills=1&rz=4&p_raz=all\'"'; + } else { + $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all=' . ((int)$_GET['all']) . '&skills=1&unuse_priem=' . $i . '&rz=4&p_raz=\' + p_raz"'; + } + } else { + if ($pl['type'] == 1) { + //моментально + if ($pl['onUser'] == 1) { + $oninuser = ''; + if ($pl['team'] == 1) { + if ($this->u->info['login2'] != '') { + $oninuser = $this->u->info['login2']; + } else { + $oninuser = $this->u->info['login']; + } + } else { + if ($btl->users[$btl->uids[$this->u->info['enemy']]]['login2'] != '') { + $oninuser = $btl->users[$btl->uids[$this->u->info['enemy']]]['login2']; + } else { + $oninuser = $btl->users[$btl->uids[$this->u->info['enemy']]]['login']; + } + } + $cl = 'href="javascript:void(0);" onClick="top.priemOnUser(' . $i . ',1,\'' . $pl['name'] . '\',\'' . $oninuser . '\',\'' . $pl['img'] . '\');"'; + unset($oninuser); + } else { + $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; + } + } elseif ($pl['type'] == 2) { + //длительное + $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; + } elseif ($pl['type'] == 3) { + $cl = 'href="javascript:void(0);" onClick="alert(\'Возможно используем?\');"'; + } + } + + + $notr = $this->testpriem($pl, $t); + + + $cl2 = ''; + $cli2 = ''; + if ((($pz[$i] > 0 || $notr > 0) && $t == 2) || (isset($this->u->stats['nopriems']) && $pl['nosh'] == 0) || $this->u->stats['notuse_last_pr'] == $pl['id']) { + $cli2 = ' class="nopriemuse" '; + } + + $pr .= ''; + } else { + + if (isset($_GET['inv'])) { + $pr .= ''; + } else { + $pr .= ''; + } + + } + $i++; + } + if ($this->u->info['animal'] > 0 && $t == 2) { + $use_lst = $this->u->testAction( + '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', + 1 + ); + if (!isset($use_lst['id'])) { + $cl2 = ''; + $pr .= ''; + } else { + $cl2 = '" class="nopriemuse'; + $pr .= ''; + } + } + if ($t == 1) { + echo '
    ' . $pr . '
    '; + } elseif ($t == 2) { + return str_replace('"', '\\"', $pr); + } + } + + public function testpriem($pl, $t = 1, $o = 0) + { + global $c, $u, $code, $btl; + $tr = $this->lookStatsArray($pl['tr']); + $d2 = $this->lookStatsArray($pl['date2']); + $x = 1; + $notr = 0; + + if ($t == 2 && $pl['id'] == 181) { + $imun = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['enemy'] . '" and `v2`="191" and `delete`="0" LIMIT 1' + ) + ); + if ($imun) { + $notr++; + } + } + + if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem']) && $btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem'] > 0 && $pl['nosh'] == 0) { + if ($btl->stats[$btl->uids[$this->u->info['id']]]['noshock_voda'] > 0 && substr( + $pl['img'], 0, + 10 + ) == 'wis_water_') { + //вода + } else { + $notr++; + } + } + + if ($pl['id'] == $btl->stats[$btl->uids[$this->u->info['id']]]['notuse_last_pr']) { + $notr++; + } + + while ($x <= 7) { + if (isset($btl->uids[$this->u->info['id']], $btl->users[$btl->uids[$this->u->info['id']]])) { + if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < $pl['tt' . $x] && $x != 7 && $pl['tt' . $x] > 0) { + $notr++; + } elseif ($x == 7) { + if ($pl['tt' . $x] > 0 && $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] <= 0) { + $notr++; + } + } + } + $x++; + } + + + if ($pl['xuse'] > 0) { + $xu = $this->u->testAction( + '`vars` = "use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', + 2 + ); + if ($xu[0] >= $pl['xuse']) { + $notr++; + } + } + + $x = 0; + $t = $this->u->items['tr']; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($tr['tr_' . $n])) { + if ($n == 'lvl') { + if ($tr['tr_' . $n] > $this->u->info['level']) { + $notr++; + } + } elseif ($tr['tr_' . $n] > $this->u->stats[$n]) { + $notr++; + } + } + $x++; + } + + + if ($pl['activ'] == 0 || ($this->testActiv($pl['activ']) == 0 && $pl['activ'] > 1)) { + $notr++; + } + + + //if($t==2) + //{ + if (isset($d2['onlyOne']) || isset($d2['onlyOneX1'])) { + if (isset($d2['onlyOneX1'])) { + if ($d2['onlyOneX1'] == 1) { + $pru = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v2` = "' . $pl['id'] . '" AND `delete` = "0" AND `x` >= 1 LIMIT 1' + ) + ); + if (isset($pru['id']) && $pru['x'] >= $d2['onlyOne']) { + $notr++; + } + } + } elseif (isset($d2['onlyOne'])) { + if ($d2['onlyOne'] > 1) { + $pru = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v2` = "' . $pl['id'] . '" AND `delete` = "0" AND `x` > 1 LIMIT 1' + ) + ); + if (isset($pru['id']) && $pru['x'] >= $d2['onlyOne']) { + $notr++; + } + } + } + } + + //Требует чтобы не было + if (isset($tr['tr_nousepriem'])) { + $x = 0; + $nouse = explode(',', $tr['tr_nousepriem']); + while ($x < count($nouse)) { + $nousev = explode('.', $nouse[$x]); + if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]]) && $btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]] >= 0) { + if ($nousev[2] > 1) { + if ($nousev[2] <= $btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]]) { + $notr++; + } + } else { + $notr++; + } + } + $x++; + } + unset($nouse, $nousev); + } + + if (isset($tr['tr_type_itm1'])) { + //требует наличие предмета определенного типа + $itmt = mysql_fetch_assoc( + mysql_query( + 'SELECT `u`.`id` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE `m`.`type` = "' . $tr['tr_type_itm1'] . '" AND `u`.`inOdet` > 0 AND `u`.`uid` = "' . $this->u->info['id'] . '" AND `u`.`delete` = "0" LIMIT 1' + ) + ); + if (!isset($itmt['id'])) { + $notr++; + } + } + + if (isset($tr['tr_mpNow'])) { + if (isset($btl->stats[$btl->uids[$this->u->info['id']]])) { + if ($btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < round( + $tr['tr_mpNow'] / 100 * (100 - $btl->stats[$btl->uids[$this->u->info['id']]]['min_use_mp']) + )) { + $notr++; + } + } elseif ($this->u->info['mpNow'] < $tr['tr_mpNow']) { + $notr++; + } + } + + if (isset($btl->uids[$this->u->info['id']], $btl->stats[$btl->uids[$this->u->info['id']]])) { + if ($pl['trUser'] == 1) { + //требует чтобы пользователь с кем-то разменивался (при ожидании прием гаснит) + if (isset($btl->ga[$this->u->info['id']][$this->u->info['enemy']])) { + $notr++; + } + } elseif ($pl['trUser'] == 2 && $o > 0) { + //требует чтобы пользователь с кем-то разменивался (при ожидании не пропадает, но не используется) + $ga = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $btl->users[$btl->uids[$this->u->info['id']]]['enemy'] . '" LIMIT 1' + ) + ); + if (isset($ga['id'])) { + $notr++; + } + } + } + + return $notr; + } + + public function priemInfo($pl, $t, $id = false) + { + global $u, $c, $code, $btl; + $pz = explode('|', $this->u->info['priems_z']); + $tr = $this->lookStatsArray($pl['tr']); + $trs = ''; + $x = 0; + $notr = 0; + $t = $this->u->items['tr']; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($tr['tr_' . $n])) { + if ($tr['tr_' . $n] > $this->u->stats[$n]) { + $trs .= ''; + $notr++; + } + $trs .= '
    • '; + $trs .= $this->u->is[$n] . ': ' . $tr['tr_' . $n]; + if ($tr['tr_' . $n] > $this->u->stats[$n]) { + $trs .= '
    '; + } + } + $x++; + } + + $lvar = ''; + $j = 1; + $nm = [1 => 'hit', 2 => 'krit', 3 => 'counter', 4 => 'block', 5 => 'parry', 6 => 'hp', 7 => 'spirit']; + while ($j <= 6) { + if ($pl['tt' . $j] > 0) { + $lvar .= ' ' . round( + $pl['tt' . $j], + 2 + ) . '   '; + } + $j++; + } + if ($pl['tt7'] > 0) { + if ($lvar != '') { + $lvar .= '
    '; + } + $lvar .= 'Сила духа: ' . round($pl['tt' . $j], 2) . '
    '; + } + $lvar .= '
    '; + if ($pl['zad'] > 0) { + $lvar .= 'Задержка: ' . $pl['zad']; + if ($pz[$id] > 0) { + $lvar .= ' (еще ' . $pz[$id] . ')'; + } + $lvar .= '
    '; + } + if (isset($tr['tr_mpNow']) && $tr['tr_mpNow'] > 0) { + $tr['tr_mpNow'] -= round($tr['tr_mpNow'] / 100 * $this->u->stats['min_use_mp']); + if ($this->u->info['mpNow'] < $tr['tr_mpNow'] || (isset($btl->stats[$btl->uids[$this->u->info['id']]]) && $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < $tr['tr_mpNow'])) { + $lvar .= '• Расход маны: ' . $tr['tr_mpNow'] . '
    '; + } else { + $lvar .= '• Расход маны: ' . $tr['tr_mpNow'] . '
    '; + } + } + if ($pl['tr_hod'] > 0) { + $lvar .= '• Прием тратит ход
    '; + } + if ($trs != '') { + $lvar .= 'Требования:' . $trs . '

    '; + } else { + $lvar .= '
    '; + } + + $pl['info'] = preg_replace_callback("!(#)(.*?)(#)!is", [$this, 'getDynamicInfo'], $pl['info']); + $lvar .= $pl['info']; + return [0 => $lvar, 1 => $pz]; + } + + //Мощность / подавление / сопротивление и т.д. + public function testPower($s1, $s2, $y, $t, $t2) + { + global $u, $btl; + + $r = 0; + if ($t2 == 2) { + //урон магией + $pm = [0 => 0, 1 => 0, 2 => 0, 3 => 0]; + if ($t < 5) { + $pm[0] = $s1['m11']; + $pm[1] = $s2['zm']; + $pm[2] = $s2['antm11']; + } + + if (isset($btl->info['id'])) { + $pm[3] = $btl->zmgo($s2['zm' . $t]); + $pm[3] = round($pm[3]); + } + + //урон = b*(1+m/100)*2^((p*10-z)/k) + $fx_vl = [ + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 350, + 400, + 450, + 500, + 550, + 600, + 650, + 700, + 750, + 800, + 850, + 900, + 950, + ]; + + $fx = [ + 'b' => $y, //базовый урон + 'm' => round($s1['pm' . $t] * 1 - $s2['antpm' . $t]), //мощь + 'z' => round($s2['zm' . $t]), //защита цели ед. + 'p' => round(($s1['pzm'] + $s1['pzm' . $t])), //подавление + 'k' => $fx_vl[(0 + $s1['lvl'])] //коэффициент ; k=250 для 8ки, k=300 для 9ки и т.д. +20% на уровень + ]; + if (($fx['z'] + 250) - $fx['p'] * 10 < 0) { //защита не может уйти больше, чем в 250 ед. + $fx['p'] = ($fx['z'] + 250) / 10; + } + $fx['p'] = 0; + // + $p = $fx['b'] * (1 + $fx['m'] / 100) * pow(2, (($fx['z'] - $fx['p'] * 10) / $fx['k'])); + //$p += $p/100*10; + $p -= $p / 100 * $pm[3]; + //$p += floor($s1['s5']*0.25); + + if ($p < round($y * 0.1)) { + $p = round($y * 0.1); + } elseif ($p > round($y * 10)) { + $p = $y * 10; + } + + if (isset($s2['zm' . $t . 'proc'])) //защита от магии стихий (призрачки) + { + $p = floor($p / 100 * (100 - $s2['zm' . $t . 'proc'])); + if ($p < 0) { + $p = 0; + } + } + if (isset($s2['zmproc'])) //защита от магии стихий (призрачки) + { + if ($s2['zmproc'] >= 75) { + $p = floor($p / 100 * (100 - 75)); + } else { + $p = floor($p / 100 * (100 - $s2['zmproc'])); + if ($p < 0) { + $p = 0; + } + } + } + $r = $p; + } + + return round($r / 100 * 70); + } + + private function pyes($id) + { + global $u; + $p = explode('|', $this->u->info['priems']); + $r = false; + $i = 0; + while ($i < count($p)) { + if ($p[$i] == $id) { + $r = true; + } + $i++; + } + return $r; + } + + //выводим все доступные приемы игроку на его уровне - 1, выводим все доступные приемы только игроку - 2 + public function seePriems($mt) + { + global $u, $c, $code; + $t = $this->u->items['tr']; + $nm = [1 => 'hit', 2 => 'krit', 3 => 'counter', 4 => 'block', 5 => 'parry', 6 => 'hp', 7 => 'spirit']; + $lvlfe = $this->u->info['level']; + if (isset($_GET['all'])) { + $lvlfe = 21; + } + $sp = mysql_query( + 'SELECT * FROM `priems` WHERE `level`<="' . $lvlfe . '" AND `activ` > "0" ORDER BY `img`,`level` ASC' + ); + $this->u->info['lvl'] = $this->u->info['level']; + $lvar = ''; + while ($pl = mysql_fetch_assoc($sp)) { + $noaki = 0; + if ($pl['activ'] == 1 || $this->testActiv($pl['activ']) == 1) { + $lvar = $this->priemInfo($pl, 1); + $lvar = $lvar[0]; + $cl = ''; + $a1 = ''; + $a2 = ''; + + if ($this->pyes($pl['id']) || $this->testpriem($pl, 1) > 0) { + if ((isset($_GET['all']) && $_GET['all'] == 1) || $this->pyes($pl['id'])) { + $cl = 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; + $a1 = ''; + $a2 = ''; + } else { + $noaki = 1; + } + } + if ($noaki == 0) { + $mtnu = explode('_', $pl['img']); + if ($mtnu[0] != 'wis') { + $mtnu = $mtnu[0]; + } else { + $mtnu = 'wis_' . $mtnu[1]; + } + echo $a1 . '' . $a2; + } + } + } + } + + private function zeromax($num, $max) + { + if ($num <= 0) { + return 0; + } + if ($num > $max) { + $num = $max; + } + return $num; + } + + /** Приём: Вспышка. + * Файлы: 34, 67, 68, 69. + * @param $level + * @param Battle $btl + * @param $id + * передаётся через pruse() в номерной файл и вызывается оттуда. + * @return void + */ + private function fireFlash($level, Battle $btl, $id) + { + if (empty($this->ue) || $this->ue['hpNow'] <= 0 || $btl->users[$this->ue['id']]['team'] == $this->u->info['team']) { + return; + } + + $baseDamage = [8 => 40, 9 => 45, 10 => 50, 11 => 60]; + $pvr = []; + $magicTargetTier = Db::getValue( + 'select x from eff_users where uid = ? and v2 = 26 and `delete` = 0', + [$this->ue['id']] + ); + $leveledDamage = $baseDamage[$level] + 40 / 100 * (5 * $magicTargetTier); + + list($damage, $isCrit, $isMiss) = $this->magicAttack( + $btl, $this->u->info['id'], $this->ue['id'], $leveledDamage, self::FIRE, 1 + ); + //Используем проверку на урон приемов + $damage = $btl->testYronPriem( + $this->u->info['id'], $this->ue['id'], 21, $damage, 5, + true + ); + $btl->priemYronSave($this->u->info['id'], $this->ue['id'], $damage, 0); + + $this->ue['hpNow'] -= $damage; + $this->ue['hpNow'] = $this->zeromax($this->ue['hpNow'], $this->ue['hpAll']); + + $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $this->ue['hpNow']; + + Db::sql('update stats set hpNow = ? where id = ?', [$this->ue['hpNow'], $this->ue['id']]); + + if ($isMiss) { + $color = $this->logColor['miss']; + } elseif ($isCrit) { + $color = $this->logColor['crit']; + } else { + $color = $this->logColor[self::FIRE]; + } + $btl->priemAddLog( + $id, + 1, + 2, + $this->u->info['id'], + $this->ue['id'], + "Вспышка [$level]", + '{tm1}' . sprintf( + " %s %s [%d/%d]", + $btl->addlt(1, 19, $this->u->info['sex'], null), + $pvr['color'], + $isMiss ? '--' : -$damage, + (int)$this->ue['hpNow'], + (int)$this->ue['hpAll'] + ), + $btl->hodID + 1 + ); + } + + /** Приём: Цель {стихия} + * Файлы: 25, 26, 27, 28. + * @param $element + * @param $pl + * @param $id + * @param Battle $btl + * @return bool (bool) достигнут ли лимит по стаку заклинаний. + */ + private function magicTarget($element, $pl, $id, Battle $btl) + { + $data = [ + self::WATER => [25, 'воды'], + self::FIRE => [26, 'огня'], + self::AIR => [27, 'воздуха'], + self::EARTH => [28, 'земли'], + ]; + if (!in_array($element, array_keys($data)) || empty($this->ue)) { + return false; + } + + $stacked = Db::getRow( + 'select id, x from eff_users where uid = ? and v2 = ? and `delete` = 0', + [$this->ue['id'], $data[$element][0]] + ); + $stackNumStr = $stacked['x'] > 0 ? $stacked['x'] + 1 : ''; + if ($stacked['x'] >= 5) { + echo "На пероснаже достигнуто максиальное количество целей"; + return true; + } + + // Наброс эффекта от приёма. + $this->addEffPr($pl, $id); + + $dataStr = $stacked['x'] > 0 ? Db::getValue( + 'select data from eff_users where id = ?', + [$stacked['id']] + ) : $pl['date3']; + + // Костыль. Будет работать, пока приём изменяет ОДИН параметр. + $effect = "Защита от магии {$data[$element][1]}: " . current($this->lookStatsArray($dataStr)); + $color = $this->logColor[$element]; + + $name = "Цель {$data[$element][1]}"; + if ($stacked['x'] > 0) { + $name .= " x($stackNumStr)"; + } + + $btl->priemAddLog( + $id, + 1, + 2, + $this->u->info['id'], + $this->ue['id'], + "$name", + '{tm1}' . sprintf( + " %s. (%s)", + $btl->addlt(1, 19, $this->u->info['sex'], null), $effect + ), + $btl->hodID + ); + + return false; + } + + public function devouringFlame($id, $uid, $j_id, Battle $btl) + { + $a = 0; + $u1 = 0; + $u2 = 0; + // + $uid1 = $btl->atacks[$id]['uid1']; + $uid2 = $btl->atacks[$id]['uid2']; + if ($uid == $uid1) { + $a = 1; + $u1 = $uid1; + $u2 = $uid2; + } elseif ($uid == $uid2) { + $a = 2; + $u1 = $uid2; + $u2 = $uid1; + } + if ($a <= 0) { + return; + }//Проверяем эффект + $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; + + $pvr['data'] = $this->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); + $pName = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['name']; + + $pvr['hp'] = $pvr['data']['atgm']; + + $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); + $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; + + //Используем проверку на урон приемов + $pvr['hp'] = $btl->testYronPriem( + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 + ); + + $pvr['hpNow'] -= $pvr['hp']; + $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, $pvr['hp'], 0); + + $pvr['hpNow'] = $this->zeromax($pvr['hpNow'], $pvr['hpAll']); + + $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; + + Db::sql('update stats set hpNow = ? where id = ?', [$btl->stats[$btl->uids[$u1]]['hpNow'], $u1]); + + $color = $this->logColor[self::FIRE]; + $prv['text'] = '{u2} утратил здоровье от "{pr}" '; + if ($pvr['promah_type'] == 2) { + $pvr['hp'] = '-'; + } + $prv['text'] .= sprintf( + "%s [%d/%d]", $color, -$pvr['hp'], $pvr['hpNow'], $pvr['hpAll'] + ); + + $btl->priemAddLog( + $id, 1, 2, $u2, $u1, "$pName", $prv['text'], ($btl->hodID) + ); + } + + /** Пожирающее пламя. Первичный каст на противника, на котором нет эффекта. + * Кастуется на 5 ходов. Считает сколько урона будет наноситься следующие 5 ходов. + * Конечный damage после множителей делится на 5 и пишется в БД (atgm=). + * Файлы: 33, 56, 57, 58, 59, 60. + * @param $id + * @param array $pl массив значений из БД priems. + * @param Battle $btl + * @return void + */ + private function devouringFlameInit($id, array $pl, Battle $btl) + { + $baseDamage = [6 => 53, 7 => 63, 8 => 77, 9 => 91, 10 => 110, 11 => 133,]; + list($damage, , $isMiss) = $this->magicAttack( + $btl, $this->u->info['id'], $this->ue['id'], $baseDamage[$pl['level']], self::FIRE + ); + if ($isMiss || $damage <= 0) { + return; + } + + $color = $this->logColor[self::FIRE]; + $logText = '{tm1}' . $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null) . '.'; + $btl->priemAddLog( + $id, 1, 2, $this->u->info['id'], $this->ue['id'], "{$pl['name']}", + $logText, $btl->hodID + 1 + ); + + $data = $this->impStats(['atgm' => max(floor($damage / 5), 1)]); + + $this->addPriem( + $this->ue['id'], $pl['id'], $data, 0, 77, 5, $this->u->info['id'], 1, 'пожирающеепламя', 0, 0, 1 + ); + } + + /** Кристаллизация. Отнимает от максимального стата (кроме выносливости) 20 на 3 хода. + * Если есть одинаковые статы из них выбирается случайный. + * Файл:267, приём 268. Понимай как хочешь. + * @param $id + * @param array $pl + * @param Battle $btl + * @return void + */ + private function crystalize($id, array $pl, Battle $btl) + { + $q = 'select stats as data from stats where id = ? + union all select stats as data from test_bot where id = ? + union all select data from eff_users where `delete` = 0 and uid = ? + union all select data from items_users where inOdet > 0 and `delete` = 0 and uid = ?'; + $datas = Db::getColumn($q, array_fill(0, 3, $this->ue['id'])); + $stats = array_fill_keys(['s1', 's2', 's3', 's5', 's6'], 0); + foreach ($datas as $data) { + $data = $this->lookStatsArray($data); + print_r($data); + foreach (array_keys($stats) as $stat) { + if (isset($data[$stat])) { + $stats[$stat] += $data[$stat]; + } + if (isset($data['add_' . $stat])) { + $stats[$stat] += $data['add_' . $stat]; + } + } + } + $maxValue = max($stats); + $maxKeys = []; + + foreach ($stats as $k => $v) { + if ($maxValue == $v) { + $maxKeys[] = $k; + } + } + shuffle($maxKeys); + $datastr = "|add_{$maxKeys[0]}=-20"; + $debuffstr = "Замороженная " . mb_strtolower($this->u->is[$maxKeys[0]]); + + $color = $this->logColor[self::WATER]; + $logText = '{tm1}' . $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null) . '.'; + $btl->priemAddLog( + $id, 1, 2, $this->u->info['id'], $this->ue['id'], + "{$pl['name']}: $debuffstr", $logText, $btl->hodID + 1 + ); + + $this->addPriem($this->ue['id'], 268, $datastr, 2, 77, 3, $this->u->info['id'], 3, 0, 0, 1); + } + +} diff --git a/_incl_data/class/__quest.php b/_incl_data/class/Quests.php similarity index 99% rename from _incl_data/class/__quest.php rename to _incl_data/class/Quests.php index 62c1a56e..1e192d46 100644 --- a/_incl_data/class/__quest.php +++ b/_incl_data/class/Quests.php @@ -1,11 +1,8 @@ - [1, '01', 'Январь', 'Январьский'], + 2 => [2, '02', 'Февраль', 'Февральский'], + 3 => [3, '03', 'Март', 'Мартовский'], + 4 => [4, '04', 'Апрель', 'Апрельский'], + 5 => [5, '05', 'Май', 'Майский'], + 6 => [6, '06', 'Июнь', 'Июньский'], + 7 => [7, '07', 'Июль', 'Июльский'], + 8 => [8, '08', 'Август', 'Августовский'], + 9 => [9, '09', 'Сентябрь', 'Сентябрьский'], + 10 => [10, '10', 'Октябрь', 'Октябрьский'], + 11 => [11, '11', 'Ноябрь', 'Ноябрьский'], + 12 => [12, '12', 'Декабрь', 'Декабрьский'], + ]; + public static $date = []; + public static $m = []; + + public static function data($val) + { + self::$m = Db::getRow('select * from sss_m where id = ?', [$val]); + if (self::$m['s'] != self::$date['m']) { + self::$m = []; + } + } +} diff --git a/_incl_data/class/Telegram.php b/_incl_data/class/Telegram.php new file mode 100644 index 00000000..e9e301f9 --- /dev/null +++ b/_incl_data/class/Telegram.php @@ -0,0 +1,170 @@ +readGood(' . $id . ',"https://img.new-combats.com/i/misc/read.gif"); nobtext(' . $id . ');'; + } + } + } + + public function lockMsg($id, $uid) + { + $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id`="' . $id . '" AND `uid`="' . $uid . '" LIMIT 1 FOR UPDATE')); + if (isset($msg['id'])) { + $lock = [0 => 1, 1 => 0]; + mysql_query('START TRANSACTION'); + $upd = mysql_query('UPDATE `telegram` SET `read`="1",`lock`="' . $lock[$msg['lock']] . '" WHERE `id` = "' . $id . '" AND `uid`="' . $uid . '" LIMIT 1'); + mysql_query('COMMIT'); + if ($upd) { + if ($lock[$msg['lock']] == 1) { + echo ''; + } else { + echo ''; + } + } + } + } + + public function deleteMsgAll($uid, $pg) + { + mysql_query('START TRANSACTION'); + $upd = mysql_query('UPDATE `telegram` SET `delete`="1" WHERE `uid`="' . $uid . '" AND `read`="1" AND `lock`="0" AND `delete`="0"'); + mysql_query('COMMIT'); + if ($upd) { + echo ''; + } + } + + public function deleteMsg($id, $uid, $pg) + { + $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id`="' . $id . '" AND `uid`="' . $uid . '" LIMIT 1 FOR UPDATE')); + if (isset($msg['id'])) { + mysql_query('START TRANSACTION'); + $upd = mysql_query('UPDATE `telegram` SET `delete`="1" WHERE `id` = "' . $id . '" AND `uid`="' . $uid . '" LIMIT 1'); + mysql_query('COMMIT'); + if ($upd && $msg['delete'] == 0 && $msg['lock'] == 0) { + echo ''; + } + } + } + + private function addMsgTable($id, $from, $fromType, $ttl, $time, $lock, $read, $pg) + { + $i1 = ''; + if ($read == 1) { + $i1 = ''; + } + + if ($lock == 1) { + $i1 = ''; + } + + if ($fromType == 1) { + $from = '' . $from . ''; + } elseif ($read == 0) { + $from = '' . $from . ''; + } + + echo ' + + + + + + + + +
    ' . $i1 . '
    ' . $from . '' . substr($ttl, 0, 30) . '...' . date('d.m.y H:i', $time) . '
    + '; + } + + public function seeMsg($uid, $page, $maxPages) + { + $page = ceil($page); + echo ' + + + + + + + + + +
    От когоЗаголовок сообщенияКогда
    Блокировка сообщений
    Удалить все прочитанные сообщения
    '; + + $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `telegram` WHERE `uid`="' . $uid . '" AND `delete`="0"')); + $pg = ceil($i[0] / $maxPages); + if ($page < 0) { + $page = 0; + } elseif ($page > $pg) { + $page = $pg; + } + + if ($i[0] > 0) { + $sp = mysql_query('SELECT * FROM `telegram` WHERE `uid`="' . $uid . '" AND `delete`="0" ORDER BY `id` DESC LIMIT ' . (($page - 1) * $maxPages) . ' , ' . $maxPages . ''); + while ($pl = mysql_fetch_array($sp)) { + $this->addMsgTable($pl['id'], $pl['from'], $pl['fromType'], $pl['text'], $pl['time'], $pl['lock'], $pl['read'], $page); + } + } + + if ($i[0] == 0) { + echo '
    Сообщений нет
    '; + } elseif ($i[0] > $maxPages) { + $pages = ''; + $i = 1; + while ($i <= $pg) { + $cls = ''; + if ($page == $i) { + $cls = 'style="color:#6f0000; font-size:14px;"'; + } + $pages .= ' ' . $i . ''; + $i++; + } + echo ' + + + + + + + + +
    Страницы: ' . $pages . '
    '; + } + } + + public function __clone() + { + trigger_error('Дублирование не допускается.', E_USER_ERROR); + } +} diff --git a/_incl_data/class/Tournir.php b/_incl_data/class/Tournir.php new file mode 100644 index 00000000..f336d27f --- /dev/null +++ b/_incl_data/class/Tournir.php @@ -0,0 +1,491 @@ + 'Выжить любой ценой', 1 => 'Каждый сам за себя', 2 => 'Захват ключа',]; + + public function __construct() + { + $this->u = User::start(); + $this->start(); + $this->locationSee(); + } + + private function start() + { + $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1')); + $this->user = mysql_fetch_array(mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->u->info['inTurnirnew'] . '" AND `bot` = "' . $this->u->info['id'] . '" LIMIT 1')); + } + + private function startTurnir() + { + $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `win` = "0" AND `lose` = "0" AND `nich` = "0"')); + if ($row[0] <= 0 || $this->info['status'] == 3) { + if ($this->info['status'] == 3) { + $this->finishTurnir(); + } + } else { + mysql_query('UPDATE `turnirs` SET `status` = "3" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + //Создание поединка + mysql_query('INSERT INTO `battle` (`city`,`time_start`,`timeout`,`type`,`turnir`) VALUES ("' . $this->u->info['city'] . '","' . time() . '","60","1","' . $this->info['id'] . '")'); + $uri = mysql_insert_id(); + //Закидываем персонажей в поединок + mysql_query('UPDATE `users` SET `battle` = "' . $uri . '" WHERE `inUser` = "0" AND `inTurnirnew` = "' . $this->info['id'] . '"'); + //Обозначаем завершение турнира при выходе + die('Перейтиде в раздел "поединки"...'); + } + } + + private function finishTurnir() + { + $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1')); + if ($this->info['status'] == 3) { + $win = ''; + $lose = ''; + $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" ORDER BY `points` DESC'); + while ($pl = mysql_fetch_array($sp)) { + mysql_query('DELETE FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '"'); + $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')); + $bot = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1')); + if (isset($inf['id'], $bot['id'])) { + //выдаем призы и т.д + mysql_query('DELETE FROM `users` WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000'); + } + + if ($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) { + + $inf['add_expn'] = 3000; + + $inf['add_expp'] = [0, 1, 5, 10, 15, 25, 35, 70, 100, 150, 200, 300, 500, 700, 1000]; + + //получаем опыт (с 0 по 12 лвл) + $inf['add_expn'] = [10, 30, 55, 62, 92, 180, 350, 1350, 4500, 7000, 21000, 30000, 35000]; + $inf['add_expn'] = $inf['add_expn'][$inf['level']]; + + mysql_query('UPDATE `users` SET `win` = `win` + 1,`win_t` = `win_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `exp` = `exp` + ' . $inf['add_expn'] . ' WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + $win .= '' . $inf['login'] . ', '; + + $r = 'Турнир завершен. Вы являетесь победителем турнира, получено опыта: ' . $inf['add_expn'] . '.'; + + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','" . $inf['room'] . "','','" . $inf['login'] . "','" . $r . "','" . time() . "','6','0')"); + } elseif ($pl['team'] != $this->info['winner'] && $this->info['winner'] != 0) { + mysql_query('UPDATE `users` SET `lose` = `lose` + 1,`lose_t` = `lose_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + + $lose .= '' . $inf['login'] . ', '; + + } else { + mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + } + mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `users` SET `inUser` = "0",`inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']); + mysql_query('UPDATE `turnirs` SET `chat` = 4 , `winner` = -1,`users_in` = 0,`status` = 0,`winner` = -1,`step` = 0,`time` = "' . (time() + $this->info['time2']) . '",`count` = `count` + 1 WHERE `id` = ' . $this->info['id'] . ' LIMIT 1'); + + if ($win != '') { + $win = rtrim($win, ', '); + $lose = rtrim($lose, ', '); + $win = 'Победители турнира: ' . $win . '. Проигравшая сторона: ' . $lose . '. Следующий турнир начнется через ' . $this->u->timeOut($this->info['time2']) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').'; + } else { + $win = 'Победители турнира отсутствует. Следующий турнир начнется через ' . $this->u->timeOut($this->info['time2']) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').'; + } + $r = 'Турнир завершен. ' . $win; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','" . $r . "','" . time() . "','6','0')"); + } + } + + private function locationSee() + { + $r = ''; + $tm1 = ''; + $tm2 = ''; + $noitm = [869 => 1, 1246 => 1, 155 => 1, 1245 => 1, 678 => 1]; + + //получение комплекта + if ($this->info['step'] != 3 && $this->info['step'] != 0 && isset($_GET['gocomplect']) && $this->user['points'] < 2) { + $aso = explode(',', $this->user['items']); + $ast = explode('-', $_GET['gocomplect']); + $asg = []; + $asj = []; + $asgp = []; + + $i = 0; + while ($i < count($aso)) { + if ($aso[$i] > 0) { + $asg[$aso[$i]] = true; + } + $i++; + } + + $i = 0; + $j = 0; + $noitm = 0; + $addi = 1; + while ($i < count($ast)) { + if ($ast[$i] > 0) { + if (!$asg[$ast[$i]]) { + $noitm++; + } + $itm = mysql_fetch_array(mysql_query('SELECT `id`,`inSlot`,`price1` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($ast[$i]) . '" LIMIT 1')); + if (isset($itm['id'])) { + $itm2 = mysql_fetch_array(mysql_query('SELECT `iid`,`price_1` FROM `items_shop` WHERE `item_id` = "' . mysql_real_escape_string($ast[$i]) . '" AND `kolvo` > 0 LIMIT 1')); + if ($itm2['price_1'] > $itm['price1']) { + $itm['price1'] = $itm2['price_1']; + } + if ($itm['inSlot'] == 3 || $itm['inSlot'] == 10) { + $asg[$itm['inSlot']][count($asg[$itm['inSlot']])] = $itm['id']; + $asgp[$itm['inSlot']][count($asgp[$itm['inSlot']])] = $itm['price1']; + } else { + $asg[$itm['inSlot']] = $itm['id']; + $asp[$itm['inSlot']] = $itm['price1']; + } + $j++; + } + } + $i++; + } + + if ($noitm > 0) { + echo 'Использование багов карается законом!'; + $addi = 0; + } elseif (count($asg[3]) > 2) { + echo 'Вы выбрали слишком много предметов, выберите только два оружия и один щит'; + $addi = 0; + } elseif (count($asg[10]) > 3) { + echo 'Вы выбрали слишком много предметов, выберите только три кольца'; + $addi = 0; + } elseif ($j > 16) { + echo 'Вы выбрали слишком много предметов'; + $addi = 0; + } elseif ($j < 1) { + echo 'Выберите хотя бы один предмет'; + $addi = 0; + } + + if ($addi == 1) { + + $i = 0; + while ($i <= 17) { + if ($i == 10) { + if ($asg[$i][0] > 0) { + $this->u->addItem($asg[$i][0], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i][0]); + } + if ($asg[$i][1] > 0) { + $this->u->addItem($asg[$i][1], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i][1]); + } + if ($asg[$i][2] > 0) { + $this->u->addItem($asg[$i][2], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i][2]); + } + } elseif ($i == 3) { + if ($asg[$i][0] > 0) { + $this->u->addItem($asg[$i][0], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i][0]); + } + if ($asg[$i][1] > 0) { + $this->u->addItem($asg[$i][1], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i][1]); + } + } elseif ($asg[$i] > 0) { + $this->u->addItem($asg[$i], $this->u->info['id']); + $this->user['points'] += 1 + round($asgp[$i]); + } + $i++; + } + + mysql_query('UPDATE `users_turnirs` SET `points` = "' . $this->user['points'] . '",`items` = "0" WHERE `bot` = "' . $this->u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `ability` = "100",`skills` = "10" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `level` = "12" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `turnirs` SET `step` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + + $this->info['step'] = 0; + $this->info['items'] = '0'; + } + } + + if ($this->info['step'] == 3) { + $this->finishTurnir(); + } elseif ($this->info['step'] == 0) { + //распределяем команды + $po = [0, 0]; + $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" AND `points` > 3 ORDER BY `points` DESC LIMIT ' . $this->info['users_in']); + $tmr = rand(1, 2); + if ($tmr == 1) { + $tmr = [2, 1]; + } else { + $tmr = [1, 2]; + } + while ($pl = mysql_fetch_array($sp)) { + $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')); + $bot = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1')); + if (isset($inf['id'], $bot['id'])) { + if ($po[1] == $po[2]) { + $tm = rand(1, 2); + } elseif ($po[1] > $po[2]) { + $tm = 2; + } else { + $tm = 1; + } + //$tm = $tmr[$tm]; + $bot['team'] = $tm; + $po[$bot['team']] += $pl['points']; + mysql_query('UPDATE `stats` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users_turnirs` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + } + mysql_query('UPDATE `turnirs` SET `step` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } + + $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']); + $po = [0, 0]; + while ($pl = mysql_fetch_array($sp)) { + $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')); + $bot = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `u`.`id` = "' . $pl['bot'] . '" LIMIT 1')); + if (isset($inf['id'], $bot['id'])) { + $po[$bot['team']] += $pl['points']; + //${'tm'.$bot['team']} .= ''.$bot['login'].' ['.$bot['level'].']
    '; + ${'tm' . $bot['team']} .= $this->u->microLogin($bot, 2) . '
    '; + } + } + $r .= ''; + $r .= '

    «' . $this->name[$this->info['type']] . '»


    Начало турнира через ' . $this->u->timeOut($this->info['time'] - time()) . '! '; + + if (isset($_GET['hpregenNowTurnir']) && ($this->u->stats['hpNow'] < $this->u->stats['hpAll'] || $this->u->stats['mpNow'] < $this->u->stats['mpAll'])) { + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->u->stats['hpAll'] . '",`mpNow` = "' . $this->u->stats['mpAll'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); + } + + if ($this->user['points'] < 3) { + //Еще не получили обмундирование + if ($this->user['points'] < 2) { + $r .= ''; + } else { + $r .= ' '; + } + } else { + $r .= 'Вы участвуете в турнире!'; + $r .= '   '; + } + + $r .= '
    '; + if ($this->user['points'] < 3 && $this->user['items'] != '0') { + $r .= '
    '; + if ($this->user['items'] == '') { + //Выдаем предметы для выбора + $ai = ''; + + $sp = mysql_query('SELECT `a`.*,`b`.* FROM `items_shop` AS `a` LEFT JOIN `items_main` AS `b` ON (`a`.`item_id` = `b`.`id`) WHERE `a`.`sid` = 1 AND + (`a`.`r` != 5 AND `a`.`r` != 9 AND `a`.`r` <= 18 AND `a`.`kolvo` > 0 AND `cantBuy` = 0 AND `a`.`level` < 9 AND `b`.`level` < 9) AND + `b`.`class` != 6'); + while ($pl = mysql_fetch_array($sp)) { + if (!isset($noitm[$pl['item_id']])) { + $aso[$pl['inslot']][count($aso[$pl['inslot']])] = $pl; + } + } + + $j = 1; + $com = []; + while ($j <= 5) { + $i = 0; + while ($i <= 17) { + if ($i == 3) { + // + $com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)]; + } elseif ($i == 14) { + //правая рука + $com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)]; + } else { + //обмундирование + $com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)]; + if ($i == 10) { + $ai .= $com[$i]['id'] . ','; + $com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)]; + $ai .= $com[$i]['id'] . ','; + //$com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; + //$ai .= $com[$i]['id'].','; + } + } + if ($com[$i]['id'] > 0 && $i != 10) { + $ai .= $com[$i]['id'] . ','; + } + $i++; + } + $j++; + } + unset($com); + + $ai .= '0'; + $this->user['items'] = $ai; + mysql_query('UPDATE `users_turnirs` SET `items` = "' . $ai . '" WHERE `id` = "' . $this->user['id'] . '" LIMIT 1'); + } + + //Выводим предметы чтобы надеть их + $ai = explode(',', $this->user['items']); + $i = 0; + $ia = []; + while ($i < count($ai)) { + if ($ai[$i] > 0) { + $pli = mysql_fetch_array(mysql_query('SELECT `id`,`inSlot`,`name`,`type`,`img`,`level` FROM `items_main` WHERE `id` = "' . $ai[$i] . '" LIMIT 1')); + $ia[$pli['inSlot']][count($ia[$pli['inSlot']])] = $pli; + unset($pli); + } + $i++; + } + unset($ai); + + $r .= 'Выберите предметы для турнира:
    '; + ?> + + + 0) { + $j = 0; + while ($j < count($ia[$i])) { + $r .= ''; + $j++; + } + $r .= '
    '; + } + $i++; + } + + } + $r .= '
    '; + $r .= ' + + + + + + + + +
    Команда 1Команда 2
    ' . rtrim($tm1, ', ') . '' . rtrim($tm2, ', ') . '
    '; + + if (($this->info['time'] - time() < 0) && $this->info['step'] == 1) { + //начинаем турнир + $this->startTurnir(); + } + echo $r; + } +} diff --git a/_incl_data/class/Uploader.php b/_incl_data/class/Uploader.php new file mode 100644 index 00000000..56abfdf8 --- /dev/null +++ b/_incl_data/class/Uploader.php @@ -0,0 +1,174 @@ + + */ + +class Uploader +{ + private $width = ['min' => 0, 'max' => 0]; + private $height = ['min' => 0, 'max' => 0]; + private $maxFileSizeMb; + private $savePath; + private $extensions = 'jpg|png|jpeg|gif'; + private $extMatches = []; + private $FILE; + private $cnm = null; + public static $error; + + public function __construct($name, $cnm = null) + { + $this->FILE = $_FILES; + if (!$this->FILE[$name]) { + return; + } + $this->cnm = $cnm; + } + + /** + * @param int $max + * @param int $min + * @return void + */ + public function setWidth($max, $min = null) + { + $this->width['min'] = is_null($min) ? $max : $min; + $this->width['max'] = $max; + } + + /** + * @param int $max + * @param int $min + * @return void + */ + public function setHeight($max, $min = null) + { + $this->height['min'] = is_null($min) ? $max : $min; + $this->height['max'] = $max; + } + + /** + * @param $megabytes + * @return void + */ + public function setMaxFileSize($megabytes) + { + $this->maxFileSizeMb = $megabytes * (1024 * 1024); + } + + /** + * @param string $path путь от корня до конечной папки без открывающего слеша. + * @return void + */ + public function setSavePath($path) + { + $this->savePath = __DIR__ . '/' . $path; + } + + /** + * @param string|array $ext + * @return void + */ + public function setExtentions($ext) + { + if (is_array($ext)) { + $arr = $ext; + } else { + $arr[] = $ext; + } + if (!$arr) { + return; + } + $this->extensions = implode('|', $arr); + } + + /** + * @param int $width + * @param int $height + * @return void + */ + public function setDimensions($width, $height) + { + $this->setWidth($width); + $this->setHeight($height); + } + + private function hasNormalDimensions() + { + list($width, $height) = getimagesize($this->FILE['tmp_name']); + if ( + $width < $this->width['min'] || + $width > $this->width['max'] || + $height < $this->height['min'] || + $height > $this->height['max'] + ) { + self::$error = "Требования к размеру [{$this->width['max']}x{$this->height['max']}] не соблюдены."; + if ($this->width['min'] !== $this->width['max'] || $this->height['min'] !== $this->height['max']) { + self::$error .= " Минимум [{$this->width['min']}x{$this->height['min']}]."; + } + self::$error .= " [{$width}x$height]"; + return false; + } + return true; + } + + private function hasNormalFileSize() + { + if (!$this->maxFileSizeMb) { + $this->setMaxFileSize(2); + } + if ($this->FILE['size'] > $this->maxFileSizeMb || $this->FILE['size'] <=0) { + self::$error = 'Неверный размер файла. Максимальный размер файла ' . $this->maxFileSizeMb . ' МБ'; + return false; + } + return true; + } + + private function hasNormalType() + { + if ( + !preg_match('/\.(' . $this->extensions . ')$/i', $this->FILE['name'], $this->extMatches) || + !preg_match('/image/i', $this->FILE['type']) + ) { + self::$error = 'Неверный тип файла. Допустимые типы : ' . $this->extensions; + return false; + } + return true; + } + + private function hasNormalFilePath() + { + if (!$this->savePath || !is_dir($this->savePath)) { + self::$error = 'Ошибка загрузки: нет такой папки.'; + return false; + } + return true; + } + + private function upload() + { + $this->extMatches[1] = strtolower($this->extMatches[1]); + $fn = uniqid('f_', true) . '.' . $this->extMatches[1]; + $fn2 = uniqid('f_', true) . '.gif'; + if ($this->cnm) { + $fn = $this->cnm; + $fn2 = $this->cnm; + } + if (!move_uploaded_file($this->FILE['tmp_name'], $this->savePath . $fn)) { + self::$error = 'Ошибка загрузки файла'; + return false; + } + return [$fn2, $fn, $this->savePath . $fn]; + } + + function saveimg() + { + return $this->hasNormalFilePath() && + $this->hasNormalDimensions() && + $this->hasNormalFileSize() && + $this->hasNormalType() ? $this->upload() : false; + } +} \ No newline at end of file diff --git a/_incl_data/class/__user.php b/_incl_data/class/User.php similarity index 78% rename from _incl_data/class/__user.php rename to _incl_data/class/User.php index 967e3cf3..618d20f2 100644 --- a/_incl_data/class/__user.php +++ b/_incl_data/class/User.php @@ -2,47 +2,28 @@ use Insallah\Db; -if (!defined('GAME')) { - die(); -} -ignore_user_abort(true); - -function getdr($s, $v, $d) -{ - global $u; - $i = 0; - while ($i < count($v)) { - if (isset($v[$i])) { - $s = str_replace('{' . $v[$i] . '}', $d[$i], $s); - } - $i++; - } - $s = eval("return (" . $s . ");"); - return floor($s); -} - -class user +class User { private static $flag_one; - public $pokol = 2; //Акктуальное поколение предметов + public $pokol = 2; //Акктуальное поколение предметов public $ekrcast = [ - 310 => true, //Снадобье Забытых Мастеров - 33 => true, //Звездная Энергия - 34 => true, //Звездная Тяжесть - 35 => true, //Звездная РЎРёСЏРЅРёРµ - 42 => true, //Неуязвимость Оружию - 43 => true, //Неуязвимость Стихиям + 310 => true, //Снадобье Забытых Мастеров + 33 => true, //Звездная Энергия + 34 => true, //Звездная Тяжесть + 35 => true, //Звездная Сияние + 42 => true, //Неуязвимость Оружию + 43 => true, //Неуязвимость Стихиям 296 => true ]; public $aves = ['now' => 0, 'max' => 0], $rep, $tfer, $error2 = '', $room = [], $bank = [], $align_nm = [ - 1 => 'Свет', - 2 => 'Хаос', - 3 => 'РўСЊРјР°', - 7 => 'Нейтралитет' + 1 => 'Свет', + 2 => 'Хаос', + 3 => 'Тьма', + 7 => 'Нейтралитет' ], $mod_nm = [ 0 => [0 => ''], - 1 => ['1' => 'Свет', '1.1' => 'Паладин Поднебесья', '1.4' => 'Таможенный Паладин', '1.5' => 'Паладин Солнечной Улыбки', '1.6' => 'Рнквизитор', '1.7' => 'Паладин Огненной Зари', '1.75' => 'Паладин-Хранитель', '1.9' => 'Паладин Неба', '1.91' => 'Старший Паладин Неба', '1.92' => 'Ветеран Ордена', '1.99' => 'Верховный Паладин'], - 3 => ['3' => 'РўСЊРјР°', '3.01' => 'Тарман-Служитель', '3.05' => 'Тарман-Надсмотрщик', '3.06' => 'Каратель', '3.07' => 'Тарман-Убийца', '3.075' => 'Тарман-Хранитель', '3.09' => 'Тарман-Палач', '3.091' => 'Тарман-Владыка', '3.092' => 'Ветеран Армады', '3.99' => 'Тарман Патриарх'] + 1 => ['1' => 'Свет', '1.1' => 'Паладин Поднебесья', '1.4' => 'Таможенный Паладин', '1.5' => 'Паладин Солнечной Улыбки', '1.6' => 'Инквизитор', '1.7' => 'Паладин Огненной Зари', '1.75' => 'Паладин-Хранитель', '1.9' => 'Паладин Неба', '1.91' => 'Старший Паладин Неба', '1.92' => 'Ветеран Ордена', '1.99' => 'Верховный Паладин'], + 3 => ['3' => 'Тьма', '3.01' => 'Тарман-Служитель', '3.05' => 'Тарман-Надсмотрщик', '3.06' => 'Каратель', '3.07' => 'Тарман-Убийца', '3.075' => 'Тарман-Хранитель', '3.09' => 'Тарман-Палач', '3.091' => 'Тарман-Владыка', '3.092' => 'Ветеран Армады', '3.99' => 'Тарман Патриарх'] ]; public $btl_txt = '', $rgd = [0 => 0, 1 => 0], $error = '', @@ -52,13 +33,13 @@ class user $city_name2 = ['emeraldscity' => 'Emeraldscity', 'abandonedplain' => 'Abandonedplain', 'capitalcity' => 'Capitalcity', 'angelscity' => 'Angelscity', 'newcapitalcity' => 'Newcapitalcity', 'demonscity' => 'Demonscity', 'fallenearth' => 'FallenEarth', 'dreamscity' => 'Dreams City', 'suncity' => 'Sun City', 'devilscity' => 'Devils City'], $stats, $info, $map, $mapUsers, $is = [ - 'acestar' => 'Следующий каст будет критическим', 'spasenie' => 'Спасение после смерти', 'more_awards' => 'Повышеная награда %', 'exp' => 'Получаемый опыт (%)', 'align_bs' => 'Служитель закона', - 'nopryh' => 'РџСЂСЏРјРѕРµ поподание', 'puti' => 'Запрет перемещения', 'align' => 'Склонность', 'hpAll' => 'Уровень жизни (HP)', 'mpAll' => 'Уровень маны (РњP)', 'enAll' => 'Уровень энергии', 'sex' => 'РџРѕР»', 'lvl' => 'Уровень', 's1' => 'Сила', 's2' => 'Ловкость', 's3' => 'Рнтуиция', 's4' => 'Выносливость', 's5' => 'Рнтеллект', 's6' => 'Мудрость', 's7' => 'Духовность', 's8' => 'Воля', 's9' => 'РЎРІРѕР±РѕРґР° РґСѓС…Р°', 's10' => 'Божественность', 's11' => 'Энергия', 'm1' => 'РњС„. критического удара (%)', 'm2' => 'РњС„. против критического удара (%)', 'm3' => 'РњС„. мощности РєСЂРёС‚. удара (%)', 'm21' => 'РњС„. абс. попадания (%)', 'm4' => 'РњС„. увертывания (%)', 'm5' => 'РњС„. против увертывания (%)', 'm6' => 'РњС„. контрудара (%)', 'm7' => 'РњС„. парирования (%)', 'm8' => 'РњС„. блока щитом (%)', 'm9' => 'РњС„. удара СЃРєРІРѕР·СЊ Р±СЂРѕРЅСЋ (%)', 'm14' => 'РњС„. абс. критического удара (%)', 'm15' => 'РњС„. абс. увертывания (%)', 'm16' => 'РњС„. абс. парирования (%)', 'm17' => 'РњС„. абс. контрудара (%)', 'm18' => 'РњС„. абс. блока щитом (%)', 'm19' => 'РњС„. абс. магический промах (%)', 'm20' => 'РњС„. удача (%)', 'a1' => 'Мастерство владения ножами, кинжалами', 'a2' => 'Мастерство владения топорами, секирами', 'a3' => 'Мастерство владения дубинами, молотами', 'a4' => 'Мастерство владения мечами', 'a5' => 'Мастерство владения магическими посохами', 'a6' => 'Мастерство владения луками', 'a7' => 'Мастерство владения арбалетами', 'aall' => 'Мастерство владения оружием', 'mall' => 'Мастерство владения магией стихий', 'm2all' => 'Мастерство владения магией', 'mg1' => 'Мастерство владения магией РѕРіРЅСЏ', 'mg2' => 'Мастерство владения магией РІРѕР·РґСѓС…Р°', 'mg3' => 'Мастерство владения магией РІРѕРґС‹', 'mg4' => 'Мастерство владения магией земли', 'mg5' => 'Мастерство владения магией Света', 'mg6' => 'Мастерство владения магией РўСЊРјС‹', 'mg7' => 'Мастерство владения серой магией', 'tj' => 'Тяжелая Р±СЂРѕРЅСЏ', 'lh' => 'Легкая Р±СЂРѕРЅСЏ', 'minAtack' => 'Минимальный СѓСЂРѕРЅ', 'maxAtack' => 'Максимальный СѓСЂРѕРЅ', 'm10' => 'РњС„. мощности СѓСЂРѕРЅР°', 'm11' => 'РњС„. мощности магии стихий', 'm11a' => 'РњС„. мощности магии', 'pa1' => 'РњС„. мощности колющего СѓСЂРѕРЅР°', 'pa2' => 'РњС„. мощности рубящего СѓСЂРѕРЅР°', 'pa3' => 'РњС„. мощности дробящего СѓСЂРѕРЅР°', 'pa4' => 'РњС„. мощности режущего СѓСЂРѕРЅР°', 'pm1' => 'РњС„. мощности магии РѕРіРЅСЏ', 'pm2' => 'РњС„. мощности магии РІРѕР·РґСѓС…Р°', 'pm3' => 'РњС„. мощности магии РІРѕРґС‹', 'pm4' => 'РњС„. мощности магии земли', 'pm5' => 'РњС„. мощности магии Света', 'pm6' => 'РњС„. мощности магии РўСЊРјС‹', 'pm7' => 'РњС„. мощности серой магии', 'za' => 'Защита РѕС‚ СѓСЂРѕРЅР°', 'zm' => 'Защита РѕС‚ магии стихий', 'zma' => 'Защита РѕС‚ магии', 'za1' => 'Защита РѕС‚ колющего СѓСЂРѕРЅР°', 'za2' => 'Защита РѕС‚ рубящего СѓСЂРѕРЅР°', 'za3' => 'Защита РѕС‚ дробящего СѓСЂРѕРЅР°', 'za4' => 'Защита РѕС‚ режущего СѓСЂРѕРЅР°', 'zm1' => 'Защита РѕС‚ магии РѕРіРЅСЏ', 'zm2' => 'Защита РѕС‚ магии РІРѕР·РґСѓС…Р°', 'zm3' => 'Защита РѕС‚ магии РІРѕРґС‹', 'zm4' => 'Защита РѕС‚ магии земли', 'zm5' => 'Защита РѕС‚ магии Света', 'zm6' => 'Защита РѕС‚ магии РўСЊРјС‹', 'zm7' => 'Защита РѕС‚ серой магии', 'magic_cast' => 'Дополнительный каст Р·Р° С…РѕРґ', 'pza' => 'Понижение защиты РѕС‚ СѓСЂРѕРЅР°', 'pzm' => 'Понижение защиты РѕС‚ магии', 'pza1' => 'Понижение защиты РѕС‚ колющего СѓСЂРѕРЅР°', 'min_heal_proc' => 'Эффект лечения (%)', 'notravma' => 'Защита РѕС‚ травм', 'yron_min' => 'Минимальный СѓСЂРѕРЅ', 'yron_max' => 'Максимальный СѓСЂРѕРЅ', 'zaproc' => 'Блокировка Физического РЈСЂРѕРЅР° (%)', 'zmproc' => 'Блокировка Магического РЈСЂРѕРЅР° (%)', 'zm2proc' => 'Защита РѕС‚ магии Р’РѕР·РґСѓС…Р° (%)', 'pza2' => 'Понижение защиты РѕС‚ рубящего СѓСЂРѕРЅР°', 'pza3' => 'Понижение защиты РѕС‚ дробящего СѓСЂРѕРЅР°', 'pza4' => 'Понижение защиты РѕС‚ режущего СѓСЂРѕРЅР°', 'pzm1' => 'Понижение защиты РѕС‚ магии РѕРіРЅСЏ', 'pzm2' => 'Понижение защиты РѕС‚ магии РІРѕР·РґСѓС…Р°', 'pzm3' => 'Понижение защиты РѕС‚ магии РІРѕРґС‹', 'pzm4' => 'Понижение защиты РѕС‚ магии земли', 'pzm5' => 'Понижение защиты РѕС‚ магии Света', 'pzm6' => 'Понижение защиты РѕС‚ магии РўСЊРјС‹', 'pzm7' => 'Понижение защиты РѕС‚ серой магии', 'speedhp' => 'Регенерация Р·РґРѕСЂРѕРІСЊСЏ (%)', 'speedmp' => 'Регенерация маны (%)', 'tya1' => 'Колющие атаки', 'tya2' => 'Рубящие атаки', 'tya3' => 'Дробящие атаки', 'tya4' => 'Режущие атаки', 'tym1' => 'Огненные атаки', 'mg2static_points' => 'Уровень заряда (Р’РѕР·РґСѓС…)', 'tym2' => 'Электрические атаки', 'tym3' => 'Ледяные атаки', 'tym4' => 'Земляные атаки', 'hpProc' => 'Уровень жизни (%)', 'mpProc' => 'Уровень маны (%)', 'tym5' => 'Атаки Света', 'tym6' => 'Атаки РўСЊРјС‹', 'tym7' => 'Серые атаки', 'min_use_mp' => 'Уменьшает расход маны', 'pog' => 'Поглощение СѓСЂРѕРЅР°', 'pog2' => 'Поглощение СѓСЂРѕРЅР°', 'pog2p' => 'Процент поглощение СѓСЂРѕРЅР°', 'pog2mp' => 'Цена поглощение СѓСЂРѕРЅР°', 'maxves' => 'Увеличивает рюкзак', 'bonusexp' => 'Увеличивает получаемый опыт', 'speeden' => 'Регенерация энергии (%)', - 'antm3' => 'РњС„. против мощности крита', 'repair_z' => 'Бесплатное извлечение заточек', 'repair_r' => 'Бесплатное извлечение СЂСѓРЅ', - 'yza' => 'Уязвимость физическому СѓСЂРѕРЅР° (%)', 'yzm' => 'Уязвимость магии стихий (%)', 'yzma' => 'Уязвимость магии (%)' - , 'yza1' => 'Уязвимость колющему СѓСЂРѕРЅР° (%)', 'yza2' => 'Уязвимость рубящему СѓСЂРѕРЅР° (%)', 'yza3' => 'Уязвимость дробящему СѓСЂРѕРЅР° (%)', 'yza4' => 'Уязвимость режущему СѓСЂРѕРЅР° (%)' - , 'yzm1' => 'Уязвимость магии РѕРіРЅСЏ (%)', 'yzm2' => 'Уязвимость магии РІРѕР·РґСѓС…Р° (%)', 'yzm3' => 'Уязвимость магии РІРѕРґС‹ (%)', 'yzm4' => 'Уязвимость магии земли (%)', 'yzm5' => 'Уязвимость магии (%)', 'yzm6' => 'Уязвимость магии (%)', 'yzm7' => 'Уязвимость магии (%)', 'rep' => 'Репутация Рыцаря' - , 'repair_discount' => 'РЎРєРёРґРєР° РЅР° ремонт вещей', 'hpVinos' => 'Бонус жизни', 'bronze' => 'Bronze Premium Account', 'silvers' => 'Silver Premium Account', 'gold' => 'Благодать Ангела', 'speed_dungeon' => 'Скорость передвижения РїРѕ подземельям', 'zona' => 'Дополнительная Р·РѕРЅР° атаки' + 'acestar' => 'Следующий каст будет критическим', 'spasenie' => 'Спасение после смерти', 'more_awards' => 'Повышеная награда %', 'exp' => 'Получаемый опыт (%)', 'align_bs' => 'Служитель закона', + 'nopryh' => 'Прямое поподание', 'puti' => 'Запрет перемещения', 'align' => 'Склонность', 'hpAll' => 'Уровень жизни (HP)', 'mpAll' => 'Уровень маны (МP)', 'enAll' => 'Уровень энергии', 'sex' => 'Пол', 'lvl' => 'Уровень', 's1' => 'Сила', 's2' => 'Ловкость', 's3' => 'Интуиция', 's4' => 'Выносливость', 's5' => 'Интеллект', 's6' => 'Мудрость', 's7' => 'Духовность', 's8' => 'Воля', 's9' => 'Свобода духа', 's10' => 'Божественность', 's11' => 'Энергия', 'm1' => 'Мф. критического удара (%)', 'm2' => 'Мф. против критического удара (%)', 'm3' => 'Мф. мощности крит. удара (%)', 'm21' => 'Мф. абс. попадания (%)', 'm4' => 'Мф. увертывания (%)', 'm5' => 'Мф. против увертывания (%)', 'm6' => 'Мф. контрудара (%)', 'm7' => 'Мф. парирования (%)', 'm8' => 'Мф. блока щитом (%)', 'm9' => 'Мф. удара сквозь броню (%)', 'm14' => 'Мф. абс. критического удара (%)', 'm15' => 'Мф. абс. увертывания (%)', 'm16' => 'Мф. абс. парирования (%)', 'm17' => 'Мф. абс. контрудара (%)', 'm18' => 'Мф. абс. блока щитом (%)', 'm19' => 'Мф. абс. магический промах (%)', 'm20' => 'Мф. удача (%)', 'a1' => 'Мастерство владения ножами, кинжалами', 'a2' => 'Мастерство владения топорами, секирами', 'a3' => 'Мастерство владения дубинами, молотами', 'a4' => 'Мастерство владения мечами', 'a5' => 'Мастерство владения магическими посохами', 'a6' => 'Мастерство владения луками', 'a7' => 'Мастерство владения арбалетами', 'aall' => 'Мастерство владения оружием', 'mall' => 'Мастерство владения магией стихий', 'm2all' => 'Мастерство владения магией', 'mg1' => 'Мастерство владения магией огня', 'mg2' => 'Мастерство владения магией воздуха', 'mg3' => 'Мастерство владения магией воды', 'mg4' => 'Мастерство владения магией земли', 'mg5' => 'Мастерство владения магией Света', 'mg6' => 'Мастерство владения магией Тьмы', 'mg7' => 'Мастерство владения серой магией', 'tj' => 'Тяжелая броня', 'lh' => 'Легкая броня', 'minAtack' => 'Минимальный урон', 'maxAtack' => 'Максимальный урон', 'm10' => 'Мф. мощности урона', 'm11' => 'Мф. мощности магии стихий', 'm11a' => 'Мф. мощности магии', 'pa1' => 'Мф. мощности колющего урона', 'pa2' => 'Мф. мощности рубящего урона', 'pa3' => 'Мф. мощности дробящего урона', 'pa4' => 'Мф. мощности режущего урона', 'pm1' => 'Мф. мощности магии огня', 'pm2' => 'Мф. мощности магии воздуха', 'pm3' => 'Мф. мощности магии воды', 'pm4' => 'Мф. мощности магии земли', 'pm5' => 'Мф. мощности магии Света', 'pm6' => 'Мф. мощности магии Тьмы', 'pm7' => 'Мф. мощности серой магии', 'za' => 'Защита от урона', 'zm' => 'Защита от магии стихий', 'zma' => 'Защита от магии', 'za1' => 'Защита от колющего урона', 'za2' => 'Защита от рубящего урона', 'za3' => 'Защита от дробящего урона', 'za4' => 'Защита от режущего урона', 'zm1' => 'Защита от магии огня', 'zm2' => 'Защита от магии воздуха', 'zm3' => 'Защита от магии воды', 'zm4' => 'Защита от магии земли', 'zm5' => 'Защита от магии Света', 'zm6' => 'Защита от магии Тьмы', 'zm7' => 'Защита от серой магии', 'magic_cast' => 'Дополнительный каст за ход', 'pza' => 'Понижение защиты от урона', 'pzm' => 'Понижение защиты от магии', 'pza1' => 'Понижение защиты от колющего урона', 'min_heal_proc' => 'Эффект лечения (%)', 'notravma' => 'Защита от травм', 'yron_min' => 'Минимальный урон', 'yron_max' => 'Максимальный урон', 'zaproc' => 'Блокировка Физического Урона (%)', 'zmproc' => 'Блокировка Магического Урона (%)', 'zm2proc' => 'Защита от магии Воздуха (%)', 'pza2' => 'Понижение защиты от рубящего урона', 'pza3' => 'Понижение защиты от дробящего урона', 'pza4' => 'Понижение защиты от режущего урона', 'pzm1' => 'Понижение защиты от магии огня', 'pzm2' => 'Понижение защиты от магии воздуха', 'pzm3' => 'Понижение защиты от магии воды', 'pzm4' => 'Понижение защиты от магии земли', 'pzm5' => 'Понижение защиты от магии Света', 'pzm6' => 'Понижение защиты от магии Тьмы', 'pzm7' => 'Понижение защиты от серой магии', 'speedhp' => 'Регенерация здоровья (%)', 'speedmp' => 'Регенерация маны (%)', 'tya1' => 'Колющие атаки', 'tya2' => 'Рубящие атаки', 'tya3' => 'Дробящие атаки', 'tya4' => 'Режущие атаки', 'tym1' => 'Огненные атаки', 'mg2static_points' => 'Уровень заряда (Воздух)', 'tym2' => 'Электрические атаки', 'tym3' => 'Ледяные атаки', 'tym4' => 'Земляные атаки', 'hpProc' => 'Уровень жизни (%)', 'mpProc' => 'Уровень маны (%)', 'tym5' => 'Атаки Света', 'tym6' => 'Атаки Тьмы', 'tym7' => 'Серые атаки', 'min_use_mp' => 'Уменьшает расход маны', 'pog' => 'Поглощение урона', 'pog2' => 'Поглощение урона', 'pog2p' => 'Процент поглощение урона', 'pog2mp' => 'Цена поглощение урона', 'maxves' => 'Увеличивает рюкзак', 'bonusexp' => 'Увеличивает получаемый опыт', 'speeden' => 'Регенерация энергии (%)', + 'antm3' => 'Мф. против мощности крита', 'repair_z' => 'Бесплатное извлечение заточек', 'repair_r' => 'Бесплатное извлечение рун', + 'yza' => 'Уязвимость физическому урона (%)', 'yzm' => 'Уязвимость магии стихий (%)', 'yzma' => 'Уязвимость магии (%)' + , 'yza1' => 'Уязвимость колющему урона (%)', 'yza2' => 'Уязвимость рубящему урона (%)', 'yza3' => 'Уязвимость дробящему урона (%)', 'yza4' => 'Уязвимость режущему урона (%)' + , 'yzm1' => 'Уязвимость магии огня (%)', 'yzm2' => 'Уязвимость магии воздуха (%)', 'yzm3' => 'Уязвимость магии воды (%)', 'yzm4' => 'Уязвимость магии земли (%)', 'yzm5' => 'Уязвимость магии (%)', 'yzm6' => 'Уязвимость магии (%)', 'yzm7' => 'Уязвимость магии (%)', 'rep' => 'Репутация Рыцаря' + , 'repair_discount' => 'Скидка на ремонт вещей', 'hpVinos' => 'Бонус жизни', 'bronze' => 'Bronze Premium Account', 'silvers' => 'Silver Premium Account', 'gold' => 'Благодать Ангела', 'speed_dungeon' => 'Скорость передвижения по подземельям', 'zona' => 'Дополнительная зона атаки' ]; public $items = [ 'tr' => ['sex', 'align', 'lvl', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'mg1', 'mg2', 'mg3', 'mg4', 'mg5', 'mg6', 'mg7', 'mall', 'm2all', 'aall', 'rep', 'align_bs'], @@ -69,6 +50,7 @@ class user 'sv' => ['pza', 'pza1', 'pza2', 'pza3', 'pza4', 'pzm', 'pzm1', 'pzm2', 'pzm3', 'pzm4', 'pzm5', 'pzm6', 'pzm7', 'notravma', 'min_zonb', 'min_zona', 'nokrit', 'pog', 'min_use_mp', 'za1proc', 'za2proc', 'za3proc', 'za4proc', 'zaproc', 'zmproc', 'zm1proc', 'zm2proc', 'zm3proc', 'zm4proc', 'shopSale', 'shopSaleEkr', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 'aall', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'm2all', 'mall', 'mg1', 'mg2', 'mg3', 'mg4', 'mg5', 'mg6', 'mg7', 'hpAll', 'mpAll', 'enAll', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm14', 'm15', 'm16', 'm17', 'm18', 'm19', 'm20', 'm21', 'pa1', 'pa2', 'pa3', 'pa4', 'pm1', 'pm2', 'pm3', 'pm4', 'pm5', 'pm6', 'pm7', 'min_use_mp', 'za', 'za1', 'za2', 'za3', 'za4', 'zma', 'zm', 'zm1', 'zm2', 'zm3', 'zm4', 'zm5', 'zm6', 'zm7', 'mib1', 'mab1', 'mib2', 'mab2', 'mib3', 'mab3', 'mib4', 'mab4', 'speedhp', 'speedmp', 'm10', 'm11', 'zona', 'zonb', 'maxves', 'minAtack', 'maxAtack', 'speeden'] ]; + /**@deprecated do nothing*/ public function sys_add($uid, $time, $type, $text, $data, $time_see) { } @@ -83,20 +65,20 @@ class user $test = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $id . '" AND `vars`= "day_quest" LIMIT 1')); $q = [ - '1' => 'Убийство Трупожоров', - '2' => 'Победы РІ хаотических Р±РѕСЏС…', - '3' => 'РЎРїСѓСЃРє РІ Подземелия', - '4' => 'Набрать РІ хаотических поединках 100 000 Опыта', - '5' => 'Открыть РЎСѓРЅРґСѓРє Трупожора', - '6' => 'Посетить Рзлом Хаоса', - '7' => 'Сдача 3 заданий РІ пещерах', - '8' => 'Поучаствовать РІ Башне Смерти' + '1' => 'Убийство Трупожоров', + '2' => 'Победы в хаотических боях', + '3' => 'Спуск в Подземелия', + '4' => 'Набрать в хаотических поединках 100 000 Опыта', + '5' => 'Открыть Сундук Трупожора', + '6' => 'Посетить Излом Хаоса', + '7' => 'Сдача 3 заданий в пещерах', + '8' => 'Поучаствовать в Башне Смерти' ]; if (!isset($test['id'])) { - $n = "Получить задание"; + $n = "Получить задание"; } else { - $n = "Сдать задание"; + $n = "Сдать задание"; $n = $n . "
    " . $q[$test['vals']] . ""; } @@ -113,7 +95,7 @@ class user } elseif (date('w') == 0 || date('w') == 6) { $r = round($r * 2, 2); } - $r = $r . ' ЕКР.'; + $r = $r . ' ЕКР.'; } else { $r = $this->info['level']; if (date('m') >= 6 || date('m') <= 8) { @@ -121,7 +103,7 @@ class user } elseif (date('w') == 0 || date('w') == 6) { $r = round($r * 2, 2); } - $r = $r . ' РљР .'; + $r = $r . ' КР.'; } } else { if (($this->info['align'] > 0 || $this->info['clan'] > 0 || $this->info['level'] > 12) && $this->info['align'] != 2) { @@ -162,19 +144,19 @@ class user $r = ''; // if ($this->info['clan'] > 0) { - //Нельзя использовать персонажам РІ клане + //Нельзя использовать персонажам в клане } elseif ($type == 'test') { - if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Нейтралов' || $this->room['name'] == 'Зал РўСЊРјС‹') { + if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Нейтралов' || $this->room['name'] == 'Зал Тьмы') { if (isset($_GET['vhp'])) { $v = mysql_fetch_array(mysql_query('SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 1 ORDER BY "time" DESC LIMIT 1')); if (isset($v['id']) && $v['time'] > time() - 60 * 60) { - //Уже юзали - $this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time()); + //Уже юзали + $this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time()); } else { if ($this->stats['hpNow'] < 1) { $this->stats['hpNow'] = 0; } - $this->error = 'Р’С‹ успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.'; + $this->error = 'Вы успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.'; mysql_query('INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES ( "' . $this->info['id'] . '","' . time() . '","' . $this->info['room'] . '","' . round($this->stats['hpAll'] - $this->stats['hpNow']) . '","1" )'); @@ -184,13 +166,13 @@ class user } elseif (isset($_GET['vmp'])) { $v = mysql_fetch_array(mysql_query('SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 2 ORDER BY "time" DESC LIMIT 1')); if (isset($v['id']) && $v['time'] > time() - 60 * 60) { - //Уже юзали - $this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time()); + //Уже юзали + $this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time()); } else { if ($this->stats['mpNow'] < 1) { $this->stats['mpNow'] = 0; } - $this->error = 'Р’С‹ успешно восстановили ' . round($this->stats['mpAll'] - $this->stats['mpNow']) . ' MP.'; + $this->error = 'Вы успешно восстановили ' . round($this->stats['mpAll'] - $this->stats['mpNow']) . ' MP.'; mysql_query('INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES ( "' . $this->info['id'] . '","' . time() . '","' . $this->info['room'] . '","' . round($this->stats['mpAll'] - $this->stats['mpNow']) . '","2" )'); @@ -201,28 +183,28 @@ class user } } elseif ($type == 'look') { // - if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал РўСЊРјС‹' || $this->room['name'] == 'Зал Нейтралов') { + if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Тьмы' || $this->room['name'] == 'Зал Нейтралов') { $vid = 0; // - if ($this->room['name'] == 'Зал Света') { + if ($this->room['name'] == 'Зал Света') { $vid = 6; - } elseif ($this->room['name'] == 'Зал РўСЊРјС‹') { + } elseif ($this->room['name'] == 'Зал Тьмы') { $vid = 7; - } elseif ($this->room['name'] == 'Зал Нейтралов') { + } elseif ($this->room['name'] == 'Зал Нейтралов') { $vid = 10; } // $v = mysql_fetch_array(mysql_query('SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1')); if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { - $r .= ' '; + $r .= ' '; } else { - $r .= ' '; + $r .= ' '; } $v = mysql_fetch_array(mysql_query('SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1')); if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { - $r .= ' '; + $r .= ' '; } else { - $r .= ' '; + $r .= ' '; } } // @@ -289,7 +271,7 @@ class user return $val; } - //Удаление определенного типа предметов + //Удаление определенного типа предметов public function deleteItemID($id, $uid, $coldel) { $sp = mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "' . mysql_real_escape_string($id) . '" AND `uid` = "' . mysql_real_escape_string($uid) . '" AND (`delete` = 0 OR `delete` = 1000) ORDER BY `inGroup` DESC LIMIT ' . $coldel); @@ -324,34 +306,34 @@ class user public function repobmen($id, $type) { - //echo 'обмен'; + //echo 'обмен'; $pl = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;')); $d = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['item_id'] . '" LIMIT 1')); $po = $this->lookStats($pl['data']); //echo $po['dungeon'].' '.$po['tr_lvl']; if ((!isset($po['frompisher']) or $po['tr_lvl'] < 4) and $pl['type'] != 31) { - $e = 'РќРµ удалось обменять предмет РЅР° репутацию.'; + $e = 'Не удалось обменять предмет на репутацию.'; } else { - $e = 'Обмен предмета "' . $pl['name'] . '" РЅР° репутацию РЎapitalcity прошел удачно.'; + $e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.'; mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); $this->rep['repcapitalcity'] += 1; mysql_query('UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); } return $e; } - + /**@deprecated do nothing*/ public function add_buf($id, $tp, $uid = null, $mod = null) { } - + /**@deprecated do nothing*/ public function del_buf($id, $uid = null, $mod = null) { } - + /**@deprecated do nothing*/ public function see_buf($id, $uid = null, $mod = null) { } - + /**@deprecated do nothing*/ public function sys_see($type) { } @@ -380,20 +362,20 @@ class user public function bsfinish($id, $bu, $di) { if ($bu == true) { - /* РІ этом Р±РѕСЋ проверяем юзеров */ + /* в этом бою проверяем юзеров */ $i = 0; while ($i < count($bu[$i])) { if ($bu[$i]['lose'] > 0 || $bu[$i]['nich']) { mysql_query('UPDATE `users` SET `lose` = "' . $bu[$i]['lose'] . '", `nick` = "' . $bu[$i]['nich'] . '" WHERE `id` = "' . $bu[$i]['id'] . '" LIMIT 1'); mysql_query('UPDATE `bs_turnirs` SET `users_finish` = `users_finish` + 1 WHERE `id` = "' . $id['id'] . '" LIMIT 1'); - /* удаляем юзера */ + /* удаляем юзера */ if ($bu['inBot'] == 0) { $pls1 = mysql_fetch_array(mysql_query('SELECT `id`, `bsid`, `money`, `finish`, `time`, `inBot`, `uid` FROM `bs_zv` WHERE `bsid` = "' . $id['id'] . '" AND `finish` = 0 AND `time` = "' . $id['time_start'] . '" AND `inBot` = "' . $bu[$i]['id'] . '" LIMIT 1')); if (isset($pls1['id'])) { mysql_query('DELETE FROM `users` WHERE `id` = "' . $bu[$i]['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `stats` WHERE `id` = "' . $bu[$i]['id'] . '" LIMIT 1'); - //выкидываем предметы РЅР° землю + //выкидываем предметы на землю $spi = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $bu[$i]['id'] . '" LIMIT 500'); $ins = ''; while ($pli = mysql_fetch_array($spi)) { @@ -425,9 +407,9 @@ class user } } - /* завершаем БС */ + /* завершаем БС */ if (isset($win['id']) && $win['lose'] == 0 && $win['nich'] == 0 && $win['id'] > 0) { - //есть победитель + //есть победитель $bsep = 0; if ($winr['level'] < 6) { $bsep = 2500; @@ -440,20 +422,20 @@ class user } else { $bsep = 50000; } - /* Выдаем РїСЂРёР· */ + /* Выдаем приз */ $mn = (round($id['money'] / 100 * 85)); mysql_query('UPDATE `users` SET `money` = `money` + "' . $mn . '" WHERE `id` = "' . $winr['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `exp` = `exp` + "' . $bsep . '" WHERE `id` = "' . $winr['id'] . '" LIMIT 1'); - /* чат */ - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','" . $winr['login'] . "','Поздравляем! Р’С‹ победили РІ турнире "Башня Смерти"! Получено опыта: " . $bsep . ", деньги: " . $mn . " РєСЂ.','-1','6','0')"); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Внимание! Завершился турнир "Башня Смерти", победитель турнира: " . $winr['login'] . "! Поздравляем!','-1','5','0')"); - $this->addDelo(1, $uid, '"WinTournament.' . $this->info['city'] . '" (Башня Смерти): Получено "' . $mn . ' РєСЂ."', time(), $this->info['city'], 'WinTournament.' . $this->info['city'] . '', 0, 0); + /* чат */ + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','" . $winr['login'] . "','Поздравляем! Вы победили в турнире "Башня Смерти"! Получено опыта: " . $bsep . ", деньги: " . $mn . " кр.','-1','6','0')"); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Внимание! Завершился турнир "Башня Смерти", победитель турнира: " . $winr['login'] . "! Поздравляем!','-1','5','0')"); + $this->addDelo(1, $uid, '"WinTournament.' . $this->info['city'] . '" (Башня Смерти): Получено "' . $mn . ' кр."', time(), $this->info['city'], 'WinTournament.' . $this->info['city'] . '', 0, 0); } else { - //нет победителя - //Выдаем травму + //нет победителя + //Выдаем травму - /* чат */ - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Внимание! Завершился турнир "Башня Смерти", победитель турнира: отсутствует.','-1','5','0')"); + /* чат */ + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Внимание! Завершился турнир "Башня Смерти", победитель турнира: отсутствует.','-1','5','0')"); } $sp = mysql_query('SELECT `id`,`bsid`,`money`,`finish`,`time`,`inBot`,`uid` FROM `bs_zv` WHERE `bsid` = "' . $id['id'] . '" AND `time` = "' . $id['time_start'] . '" ORDER BY `money` DESC LIMIT 100'); @@ -474,12 +456,12 @@ class user } } - //вес предметов Сѓ юзера + //вес предметов у юзера public function ves($u) { $r = ['now' => 0, 'max' => 0]; if ($u == null) { - //текущий персонаж + //текущий персонаж $r['now'] = mysql_fetch_array(mysql_query('SELECT SUM(`im`.`massa`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "' . $this->info['id'] . '" AND (`iu`.`delete` = "0" OR (`iu`.`delete` = "1000" AND `iu`.`inGroup` > 0)) AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0"')); $r['now'] = 0 + $r['now'][0]; @$r['max'] = 40 + ($this->stats['os7'] * 10) + $this->stats['s4'] + $this->stats['maxves'] + $this->stats['s1'] * 4; @@ -489,7 +471,7 @@ class user return $r; } - //Переплавка вещей \ СЂСѓРЅ + //Переплавка вещей \ рун public function plavka($id, $type) { $e = ''; @@ -506,38 +488,38 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035) { - $e = 'Предмет должен быть 4-РіРѕ Рё выше СѓСЂРѕРІРЅСЏ'; + $e = 'Предмет должен быть 4-го и выше уровня'; } elseif ($pl['type'] != 1 && $pl['type'] != 3 && $pl['type'] != 5 && $pl['type'] != 6 && $pl['type'] != 8 && $pl['type'] != 9 && $pl['type'] != 10 && $pl['type'] != 11 && $pl['type'] != 12 && $pl['type'] != 14 && $pl['type'] != 15 && $pl['type'] != 18 && $pl['type'] != 19 && $pl['type'] != 20 && $pl['type'] != 21 && $pl['type'] != 22 && $pl['type'] != 13 && $pl['item_id'] != 1035) { - $e = 'Хрен вам, Р° РЅРµ СЂСѓРЅС‹! РљСѓРґР° кидаешь предмет? РќРµ РїРѕРґС…РѕРґРёС‚ РѕРЅ! РџСЂРёС…РѕРґРё как будет что-то стоющее!'; + $e = 'Хрен вам, а не руны! Куда кидаешь предмет? Не подходит он! Приходи как будет что-то стоющее!'; } elseif ($po['tr_lvl'] >= 7 && $this->rep['rep1'] < 0)//100 { - $e = 'Для растворения предметов 7-РіРѕ Рё старше СѓСЂРѕРІРЅСЏ требуется знак Храма Знаний первого РєСЂСѓРіР°'; + $e = 'Для растворения предметов 7-го и старше уровня требуется знак Храма Знаний первого круга'; } elseif ($po['tr_lvl'] >= 9 && $this->rep['rep1'] < 1000) { - $e = 'Для растворения предметов 9-РіРѕ Рё старше СѓСЂРѕРІРЅСЏ требуется знак Храма Знаний второго РєСЂСѓРіР°'; + $e = 'Для растворения предметов 9-го и старше уровня требуется знак Храма Знаний второго круга'; } elseif ($po['tr_lvl'] >= 10 && $this->rep['rep1'] < 10000) { - $e = 'Для растворения предметов 10-РіРѕ Рё старше СѓСЂРѕРІРЅСЏ требуется знак Храма Знаний третьего РєСЂСѓРіР°'; + $e = 'Для растворения предметов 10-го и старше уровня требуется знак Храма Знаний третьего круга'; } elseif ($rn > 0) { if (isset($pl['id'], $d['id'])) { $pl['rep'] = 1; - //вероятность выпадения СЂСѓРЅС‹ + //вероятность выпадения руны // mysql_query('UPDATE `rep` SET `rep1` = `rep1` + "'.$pl['rep'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1')); - $e = 'Удачно растворен предмет "' . $pl['name'] . '"! Получено репутации: +' . $pl['rep'] . ' ед.'; + $e = 'Удачно растворен предмет "' . $pl['name'] . '"! Получено репутации: +' . $pl['rep'] . ' ед.'; mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); $this->rep['rep1'] += $pl['rep']; mysql_query('UPDATE `rep` SET `rep1` = "' . $this->rep['rep1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); } else { - $e = 'Предмет РЅРµ найден, либо РЅРµ РїРѕРґС…РѕРґРёС‚ ' . $pl['item_id'] . '...'; + $e = 'Предмет не найден, либо не подходит ' . $pl['item_id'] . '...'; } } else { - $e = 'РќРµ удалось переплавить, рецепты СЂСѓРЅ были потеряны ...'; + $e = 'Не удалось переплавить, рецепты рун были потеряны ...'; } return $e; } - //Выводим вещи котоыре нужно отремонтировать + //Выводим вещи котоыре нужно отремонтировать public function info_remont() { $r = ''; @@ -547,20 +529,20 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "' . ((int)$this->info['id']) . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` > "0" AND `iu`.`inOdet` < "18" LIMIT 18'); while ($pl = mysql_fetch_array($sp)) { if ($pl['iznosNOW'] > ceil($pl['iznosMAX'] * 0.80)) { - $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '] требуется ремонт
    '; + $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '] требуется ремонт
    '; } } $r = '
    ' . $r . '
    '; return $r; } - //Расчет СѓСЂРѕРЅР° РѕС‚ оружия + //Расчет урона от оружия public function weaponAtc($item, $st, $x) { $tp = 0; if (isset($item['id'])) { $itm = $this->lookStats($item['data']); - //начинаем расчет СѓСЂРѕРЅР° + //начинаем расчет урона if (!isset($st['minAtack'])) { $st['minAtack'] = 0; } @@ -591,26 +573,26 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` //if($x!=0) //{ - //РўРёРї СѓСЂРѕРЅР°: 0 - нет СѓСЂРѕРЅР°, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - РѕРіРѕРЅСЊ, 6 - РІРѕР·РґСѓС…, 7 - РІРѕРґР°, 8 - земля, 9 - свет, 10 - тьма, 11 - серая + //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая if ($item['type'] == 18) { - //колющий + //колющий $sss = ceil($st['s2'] * 0.75); } elseif ($item['type'] == 19) { - //рубящий + //рубящий $sss = ceil($st['s1'] * 0.75); } elseif ($item['type'] == 20) { - //дробящий + //дробящий $sss = ceil($st['s4'] * 1.5); } elseif ($item['type'] == 21) { - //режущий - $sss = ceil($st['s3'] * 1); + //режущий + $sss = ceil($st['s3'] * 0.75); } else { - //без профильного СѓСЂРѕРЅР° + //без профильного урона $sss = ceil($st['s1'] * 0.1); } - //Обычный СѓСЂРѕРЅ + //Обычный урон //$p['B'][0] = 5; //$p['B'][1] = 9; @@ -621,37 +603,37 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $p['B'][1] = $p['B'][0] + 3; $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); - //Добавочный минимальный СѓСЂРѕРЅ + //Добавочный минимальный урон $p['W'][0] = $min; $p['W'][1] = $max; $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); - // РљРѕСЌС„. оружия + // Коэф. оружия $p['T'] = 1; - //Владения + //Владения $bn = 0; if ($item['type'] == 21) { - // меч + // меч $p['M'] = $st['pa4']; $bn = $st['a4']; - //РўРЈРў $p['M'] = $st['pa'.$x]; + //ТУТ $p['M'] = $st['pa'.$x]; } elseif ($item['type'] == 20) { - // РґСѓР±РёРЅР° + // дубина $p['M'] = $st['pa3']; $bn = $st['a3']; } elseif ($item['type'] == 19) { - // топор + // топор $p['M'] = $st['pa2']; $bn = $st['a2']; } elseif ($item['type'] == 18) { - // РЅРѕР¶ + // нож $p['M'] = $st['pa1']; $bn = $st['pa1']; } elseif ($item['type'] == 22) { - // РїРѕСЃРѕС… + // посох $p['M'] = $st['pa3']; $bn = $st['a5']; } - //Мощнность + //Мощнность $min = (($p['B'][0] + $sss + $p['W'][0]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100); $max = (($p['B'][1] + $sss + $p['W'][1]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100); @@ -664,7 +646,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return $tp; } - //Расчет защиты + //Расчет защиты public function zago($v) { if ($v > 1700) { @@ -673,7 +655,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2); } - //Расчет защиты (магия) + //Расчет защиты (магия) public function zmgo($v) { if ($v > 1000) { @@ -690,7 +672,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $r = ''; if ($v == 'yrontest' || $v == 'yrontest-krit') { $y = []; - /* первое оружие или кулак */ + /* первое оружие или кулак */ $w1 = 0; $w2 = 0; $i = 0; @@ -727,7 +709,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $r .= '' . $y[0] . '-' . $y[1] . ''; } else { - //СѓСЂРѕРЅ кулаком + //урон кулаком $y[0] = ceil(2 + $this->info['level'] + $this->stats ['s1'] - round($this->stats['s1'] / 5)) + $this->stats['minAtack'] + $this->stats['yron_min']; $y[1] = ceil($y[0] + 3) + $this->stats['maxAtack'] + $this->stats['yron_max']; if ($y[0] < 1) { @@ -738,7 +720,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $r .= $y[0] . '-' . $y[1]; } - /* второе оружие */ + /* второе оружие */ if (isset($w2['id'])) { $tp = 0; $t = 0; @@ -767,7 +749,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` /* --- */ } elseif ($v == 'yron') { $y = []; - /* первое оружие или кулак */ + /* первое оружие или кулак */ $w1 = 0; $w2 = 0; $i = 0; @@ -800,7 +782,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $r .= '' . $y[0] . '-' . $y[1] . ''; } else { - //СѓСЂРѕРЅ кулаком + //урон кулаком $y[0] = ceil($this->stats['s1'] * 1.4) + $this->stats['minAtack'] + $this->stats['yron_min']; $y[1] = ceil(0.4 + $y[0] / 0.9) + $this->stats['maxAtack'] + $this->stats['yron_max']; if ($y[0] < 1) { @@ -811,7 +793,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $r .= $y[0] . '-' . $y[1]; } - /* второе оружие */ + /* второе оружие */ if (isset($w2['id'])) { $tp = 0; $t = 0; @@ -834,9 +816,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $r .= ' / ' . $y[0] . '-' . $y[1] . ''; } } else { - //модификаторы + //модификаторы $y = []; - /* первое оружие или кулак */ + /* первое оружие или кулак */ $w1 = 0; $w2 = 0; $i = 0; @@ -864,11 +846,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ry = $y; $r .= '' . $y . ''; } else { - //кулаком + //кулаком $r .= $this->stats[$v]; $ry = $this->stats[$v]; } - /* второе оружие */ + /* второе оружие */ if (isset($w2['id'])) { $tp = 0; $t = 0; @@ -881,7 +863,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $r = str_replace('title="' . $w1['name'] . '"', '', $r); } } - //модификаторы + //модификаторы } return $r; } @@ -895,7 +877,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " мес. "; + $out .= $tmp . " мес. "; } $time_still = $time_still - $tmp * 2592000; } @@ -903,7 +885,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " РґРЅ. "; + $out .= $tmp . " дн. "; } $time_still = $time_still - $tmp * 86400; } @@ -911,7 +893,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " С‡. "; + $out .= $tmp . " ч. "; } $time_still = $time_still - $tmp * 3600; } @@ -919,14 +901,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " РјРёРЅ. "; + $out .= $tmp . " мин. "; } } if ($out == '') { if ($time_still < 0) { $time_still = 0; } - $out = $time_still . ' сек.'; + $out = $time_still . ' сек.'; } return $out; } @@ -934,105 +916,105 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` public function rep_zv($id, $e) { if ($id == 1) { - //Храм знаний + //Храм знаний if ($e > 9999) { - $r = 'Посвященный третьего РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Посвященный третьего круга, ' . $e . ' / ??'; } elseif ($e > 999) { - $r = 'Посвященный второго РєСЂСѓРіР°, ' . $e . ' / 9999'; + $r = 'Посвященный второго круга, ' . $e . ' / 9999'; } elseif ($e > 99) { - $r = 'Посвященный первого РєСЂСѓРіР°, ' . $e . ' / 999'; + $r = 'Посвященный первого круга, ' . $e . ' / 999'; } else { $r = $e . ' / 99'; } } elseif ($id == 2) { //Capital city if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 3) { //Angels city if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 4) { //Demons city if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 5) { - //Алтарь РљСЂРѕРІРё + //Алтарь Крови if ($e > 99) { - $r = 'Посвященный первого РєСЂСѓРіР° ' . $e . ' / 999'; + $r = 'Посвященный первого круга ' . $e . ' / 999'; } else { $r = $e . ' / 99'; } } elseif ($id == 6) { //Sand if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 7) { //Sun if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 8) { //Moon if ($e > 24999) { - $r = 'Рыцарь второго РєСЂСѓРіР°, ' . $e . ' / ??'; + $r = 'Рыцарь второго круга, ' . $e . ' / ??'; } elseif ($e > 9999) { - $r = 'Рыцарь первого РєСЂСѓРіР°, ' . $e . ' / 24999'; + $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; } else { $r = $e . ' / 10000'; } } elseif ($id == 9) { //Dreams city if ($e > 9999) { - $r = 'Посвященный третьего РєСЂСѓРіР°, [' . $e . ']'; + $r = 'Посвященный третьего круга, [' . $e . ']'; } elseif ($e > 4999) { - $r = 'Посвященный второго РєСЂСѓРіР°,' . $e . ' / 9999'; + $r = 'Посвященный второго круга,' . $e . ' / 9999'; } elseif ($e > 999) { - $r = 'Посвященный первого РєСЂСѓРіР°, ' . $e . ' / 4999'; + $r = 'Посвященный первого круга, ' . $e . ' / 4999'; } else { $r = $e . ' / 999'; } } elseif ($id == 10) { - //Гора легиона + //Гора легиона if ($e > 9999) { - $r = 'Посвященный второго РєСЂСѓРіР°,[' . $e . ']'; + $r = 'Посвященный второго круга,[' . $e . ']'; } elseif ($e > 999) { - $r = 'Посвященный первого РєСЂСѓРіР°, ' . $e . ' / 4999'; + $r = 'Посвященный первого круга, ' . $e . ' / 4999'; } else { $r = $e . ' / 999'; } } elseif ($id == 11) { - //Рзлом Хаоса + //Излом Хаоса if ($e > 9999) { - $r = 'Легенда Рзлома Хаоса, [' . $e . ']'; + $r = 'Легенда Излома Хаоса, [' . $e . ']'; } elseif ($e > 4999) { - $r = 'Чемпион Рзлома Хаоса,' . $e . ' / 9999'; + $r = 'Чемпион Излома Хаоса,' . $e . ' / 9999'; } elseif ($e > 999) { - $r = 'Знаток Рзлома Хаоса, ' . $e . ' / 4999'; + $r = 'Знаток Излома Хаоса, ' . $e . ' / 4999'; } else { $r = $e . ' / 999'; } @@ -1053,7 +1035,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $i = mysql_fetch_array(mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); if (isset($i['id'])) { $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1')); - //новая дата + //новая дата $data = $d['data']; if ($i['ts'] > 0) { if ($nosudba == null) { @@ -1063,12 +1045,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($md != null) { $data .= $md; - $data = $this->lookStats($data); // Если РІ функции имеются РґРІРµ одинаковых константы SROK? + $data = $this->lookStats($data); // Если в функции имеются две одинаковых константы SROK? $data = $this->impStats($data); } - //предмет СЃ настройками РёР· подземелья + //предмет с настройками из подземелья if ($dn != null && $dn['dn_delete'] > 0) { $i['dn_delete'] = 1; } @@ -1100,10 +1082,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $ads = ''; if ($plavka != null) { - $ads = 'Расплавлен предмет : [' . $plavka . ']'; + $ads = 'Расплавлен предмет : [' . $plavka . ']'; } - //Записываем РІ личное дело что предмет получен - $ld = $this->addDelo(1, $uid, '"AddItems.' . $this->info['city'] . '": Получен предмет "' . $i['name'] . '" (x1) [#' . $i['iid'] . ']. ' . $ads . '', time(), $this->info['city'], 'AddItems.' . $this->info['city'] . '', 0, 0); + //Записываем в личное дело что предмет получен + $ld = $this->addDelo(1, $uid, '"AddItems.' . $this->info['city'] . '": Получен предмет "' . $i['name'] . '" (x1) [#' . $i['iid'] . ']. ' . $ads . '', time(), $this->info['city'], 'AddItems.' . $this->info['city'] . '', 0, 0); } else { $rt = 0; } @@ -1181,19 +1163,19 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $r .= ' ' . $inf['login'] . ' [' . $inf['level'] . ']'; } else { - $r = 'Невидимка [??]'; + $r = 'Невидимка [??]'; } return $r; } public function testHome() { - /*----Быстрый(Особенность)----*/ + /*----Быстрый(Особенность)----*/ $timeforwait = 3600; if (isset($st['os3']) && $st['os3'] > 0) { $timeforwait = 3600 - (($st['os6'] * 5) * 60); } - /*----Быстрый(Особенность)----*/ + /*----Быстрый(Особенность)----*/ $hgo = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time() - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 1', 1); if ($this->info['level'] == 0 || $this->info['active'] != '' || $this->info['inTurnir'] > 0 || $this->info['inTurnirnew'] > 0 || $this->info['zv'] > 0 || $this->info['dnow'] > 0) { $hgo['id'] = true; @@ -1332,7 +1314,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($this->info['id'])) { if ($this->info['invis'] == 1 || $this->info['invis'] > time()) { - $this->info['cast_login'] = 'Невидимка'; + $this->info['cast_login'] = 'Невидимка'; } else { $this->info['cast_login'] = $this->info['login']; } @@ -1387,11 +1369,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $hgo = $this->testHome(); if (!isset($hgo['id']) && $this->info['room'] != 274 && $this->info['align'] != 2 && $this->info['inTurnir'] == 0) { $this->addAction(time(), 'go_homeworld', ''); - $rmt = mysql_fetch_array(mysql_query('SELECT `id`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee` FROM `room` WHERE `name` = "Центральная площадь" AND `city` = "' . $this->info['city'] . '" LIMIT 1')); + $rmt = mysql_fetch_array(mysql_query('SELECT `id`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee` FROM `room` WHERE `name` = "Центральная площадь" AND `city` = "' . $this->info['city'] . '" LIMIT 1')); if (isset($rmt['id'])) { - //Удаляем РІСЃРµ ставки РІ БС + //Удаляем все ставки в БС if ($this->room['file'] == 'bsenter') { - //Удаляем РІСЃРµ ставки РІ БС + //Удаляем все ставки в БС $sp_bs = mysql_query('SELECT `id`,`bsid`,`money` FROM `bs_zv` WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"'); while ($pl_bs = mysql_fetch_array($sp_bs)) { mysql_query('UPDATE `bs_turnirs` SET `users` = `users` - 1 WHERE `id` = "' . $pl_bs['bsid'] . '" LIMIT 1'); @@ -1403,17 +1385,17 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `users` SET `room` = "' . $this->info['room'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); } else { - $this->error = 'Р’ этом РіРѕСЂРѕРґРµ нельзя пользоваться РєРЅРѕРїРєРѕР№ возрата'; + $this->error = 'В этом городе нельзя пользоваться кнопкой возрата'; } unset($rmt); } else { - $this->error = 'Вам запрещено пользоваться РєРЅРѕРїРєРѕР№ возрата'; + $this->error = 'Вам запрещено пользоваться кнопкой возрата'; } unset($hgo); } } - //Заносим текст + //Заносим текст if (isset($_GET['itmid']) && isset($_GET['addtext'])) { $itm = mysql_fetch_array(mysql_query('SELECT `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl` @@ -1433,46 +1415,46 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `use_text` = "' . $itm['use_text'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); mysql_query('INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`) VALUES ("' . $itm['id'] . '","' . time() . '","' . $this->info['login'] . '","' . mysql_real_escape_string(htmlspecialchars($txt, null, 'cp1251')) . '","' . $this->info['city'] . '","' . $sx . '")'); - $this->error = 'Запись успешно произведена'; + $this->error = 'Запись успешно произведена'; } else { - $this->error = 'Нужно что-то написать...'; + $this->error = 'Нужно что-то написать...'; } } else { - $this->error = 'Предмет для записи РЅРµ РїРѕРґС…РѕРґРёС‚'; + $this->error = 'Предмет для записи не подходит'; } } else { - $this->error = 'Предмет для записи РЅРµ найден'; + $this->error = 'Предмет для записи не найден'; } } - //Кидаем передачу + //Кидаем передачу if (isset($_POST['trnLogin'], $_GET['transfer']) && $this->info['battle'] == 0) { if ($this->info['level'] < 4 && $this->info['admin'] == 0) { - $this->error = 'Передавать предметы РјРѕРіСѓС‚ персонажи старше 4-РіРѕ СѓСЂРѕРІРЅСЏ'; + $this->error = 'Передавать предметы могут персонажи старше 4-го уровня'; } elseif ($this->info['align'] == 2 && $this->info['admin'] == 0) { - $this->error = 'Хаосники РЅРµ РјРѕРіСѓС‚ передавать предметы РґСЂСѓРіРёРј персонажам'; + $this->error = 'Хаосники не могут передавать предметы другим персонажам'; } else { $t = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`login2`,`pass`,`pass2`,`emailconfirmation`,`securetime`,`sys`,`online`,`ip`,`ipreg`,`joinIP`,`admin`,`city`,`room`,`banned`,`auth`,`align`,`mod_zvanie`,`clan`,`nextMsg`,`molch1`,`molch2`,`molch3`,`level`,`money`,`battle`,`cityreg`,`invBlock`,`invBlockCode`,`zag`,`a1`,`q1`,`mail`,`name`,`bithday`,`sex`,`city_real`,`icq`,`icq_hide`,`homepage`,`deviz`,`hobby`,`chatColor`,`timereg`,`add_smiles`,`obraz`,`win`,`lose`,`nich`,`cityreg2`,`host`,`info_delete`,`dateEnter`,`afk`,`dnd`,`timeMain`,`clan_prava`,`addpr`,`marry`,`city2`,`invis`,`bot_id`,`haos`,`host_reg`,`inUser`,`jail`,`animal`,`vip`,`catch`,`frg`,`no_ip`,`type_pers`,`bot_room` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['trnLogin']) . '" AND `city` = "' . $this->info['city'] . '" LIMIT 1')); if (isset($t['id'])) { if ($this->info['login'] == $t['login']) { - $this->error = 'Р’С‹ РЅРµ можете передать самому себе, персонаж ' . $this->microLogin($t['id'], 1) . ''; + $this->error = 'Вы не можете передать самому себе, персонаж ' . $this->microLogin($t['id'], 1) . ''; } elseif ($t['battle'] > 0) { - $this->error = 'Персонаж находится РІ Р±РѕСЋ'; + $this->error = 'Персонаж находится в бою'; } elseif ($t['level'] < 4 && $this->info['admin'] == 0) { - $this->error = 'Р’С‹ РЅРµ можете передавать предметы персонажам ниже 4-РіРѕ СѓСЂРѕРІРЅСЏ'; + $this->error = 'Вы не можете передавать предметы персонажам ниже 4-го уровня'; } elseif ($t['align'] == 2 && $this->info['admin'] == 0) { - $this->error = 'Р’С‹ РЅРµ можете передавать предметы хаосникам'; + $this->error = 'Вы не можете передавать предметы хаосникам'; } elseif ($t['room'] != $this->info['room']) { - $this->error = 'Р’С‹ должны находится РІ РѕРґРЅРѕР№ комнате СЃ персонажем'; + $this->error = 'Вы должны находится в одной комнате с персонажем'; } else { - //создаем передачу + //создаем передачу $tt = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1')); if (isset($tt['id'])) { - $this->error = 'Р’С‹ уже находитесь РІ передаче'; + $this->error = 'Вы уже находитесь в передаче'; } else { $tt = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $t['id'] . '" OR `uid2` = "' . $t['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '")) ORDER BY `id` DESC LIMIT 1')); if (isset($tt['id'])) { - $this->error = 'Персонаж уже РїСЂРѕРІРѕРґРёС‚ сделку'; + $this->error = 'Персонаж уже проводит сделку'; } else { $ins = mysql_query('INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time() . '","' . mysql_real_escape_string(htmlspecialchars($_POST['textarea'], null, 'cp1251')) . '","' . time() . '")'); if ($ins) { @@ -1482,12 +1464,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } } else { - $this->error = 'Персонаж РЅРµ найден РІ этом РіРѕСЂРѕРґРµ'; + $this->error = 'Персонаж не найден в этом городе'; } } } - //Выделяем передачи + //Выделяем передачи $this->tfer = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1')); if ($this->tfer['uid1'] == $this->tfer['uid2']) { $this->tfer = false; @@ -1501,7 +1483,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($this->tfer['uid2'] == $this->info['id'] && $this->tfer['start2'] == 0) { $this->tfer = false; } elseif ($this->tfer['time'] < time() - 1800) { - //если передача дольше 30 РјРёРЅСѓС‚, то отмена + //если передача дольше 30 минут, то отмена $upd = mysql_query('UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'); if ($upd) { unset($this->tfer, $upd); @@ -1522,11 +1504,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $upd = mysql_query('UPDATE `transfers` SET `cancel' . $upd . '` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'); if ($upd) { - $this->error = 'Р’С‹ успешно отказались РѕС‚ передачи.'; + $this->error = 'Вы успешно отказались от передачи.'; mysql_query('UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid` = "' . $this->tfer['uid1'] . '" OR `uid` = "' . $this->tfer['uid2'] . '") AND `inTransfer` > 0'); - //Добавляем сообщение РІ чат + //Добавляем сообщение в чат unset($this->tfer, $upd); } } @@ -1534,22 +1516,22 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } /* - автофлудераст + автофлудераст */ - //Статистика персонажа РЅР° сегодня + //Статистика персонажа на сегодня $stat = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `time` >= ' . strtotime('now 00:00:00') . ' AND `vars` = "statistic_today" LIMIT 1', 1); if (!isset($stat['id'])) { $this->addAction(time(), 'statistic_today', 'e=' . $this->info['exp'] . '|w=' . $this->info['win'] . '|l=' . $this->info['lose'] . '|n=' . $this->info['nich']); } - //Одеваем боевой комплект + //Одеваем боевой комплект if (isset($_GET['usec1']) && $this->info['battle'] == 0) { $cmp = mysql_fetch_array(mysql_query('SELECT `id`,`uid`,`type`,`val`,`name`,`time`,`delete` FROM `save_com` WHERE `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `id` = "' . mysql_real_escape_string($_GET['usec1']) . '" LIMIT 1')); if (isset($cmp['id'])) { - //снимаем РІСЃРµ вещи + //снимаем все вещи mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '"'); - //одеваем вещи, если РѕРЅРё РЅРµ удалены + //одеваем вещи, если они не удалены $cm = $this->lookStats($cmp['val']); $i = 1; while ($i <= 250) { @@ -1572,7 +1554,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($this->bank)) { mysql_query('UPDATE `bank` SET `useNow` = "' . (time() + 24 * 60 * 60) . '" WHERE `id` = "' . $this->bank['id'] . '" LIMIT 1'); } else { - $this->bank['error'] = 'Неверный пароль РѕС‚ счета'; + $this->bank['error'] = 'Неверный пароль от счета'; } } elseif (!isset($_GET['bank_exit'])) { $this->bank = mysql_fetch_array(mysql_query('SELECT `id`,`uid`,`block`,`create`,`pass`,`money1`,`money2`,`useNow`,`notmail` FROM `bank` WHERE `uid` = "' . $this->info['id'] . '" AND `block` = "0" AND `useNow` > ' . time() . ' ORDER BY `useNow` DESC LIMIT 1')); @@ -1583,7 +1565,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if (!isset($_GET['obt_sel']) && $this->info['battle'] == 0 && $this->info['obraz'] != '0.gif') { - //Проверяем текущий образ + //Проверяем текущий образ $this->stats = $this->getStats($this->info['id'], 0); $tr = true; $o = mysql_fetch_array(mysql_query('SELECT `id`,`sex`,`tr`,`img`,`login`,`level`,`admin`,`align`,`clan`,`itm` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string($this->info['obraz']) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1')); @@ -1660,7 +1642,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $j++; } if ($tritm != '' && $tr == false) { - $this->error = 'Необходимы предметы: ' . $tritm . ''; + $this->error = 'Необходимы предметы: ' . $tritm . ''; } } while ($x < count($t)) { @@ -1668,7 +1650,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($po['tr_' . $n])) { if ($po['tr_' . $n] > $this->stats[$n]) { $tr = false; - $this->error = 'Недостаточно характеристик или параметров персонажа'; + $this->error = 'Недостаточно характеристик или параметров персонажа'; } } $x++; @@ -1687,7 +1669,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } } else { - $this->error = 'Выбирать образ можно РЅРµ чаще РѕРґРЅРѕРіРѕ раза РІ сутки, следующая смена ' . date('d.m.Y H:i', $sm['time'] + 86400) . ''; + $this->error = 'Выбирать образ можно не чаще одного раза в сутки, следующая смена ' . date('d.m.Y H:i', $sm['time'] + 86400) . ''; unset($_GET['obr_sel']); $_GET['inv'] = 1; } @@ -1704,7 +1686,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($this->info['wipe'] != 0) { $this->wipe(); } else { - //проверяем статы + //проверяем статы } @@ -1720,24 +1702,24 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` global $magic; if (isset($_GET['use_snowball'])) { $this->stats = $this->getStats($this->info, 0); - //Начинаем лепить снежок РЅР° ЦП + //Начинаем лепить снежок на ЦП if (isset($this->stats['items'][$this->stats['wp13id']]['id']) && $this->stats['items'][$this->stats['wp13id']]['item_id'] == 998) { - //варежки одеты, РІСЃРµ РѕРє - if ($this->room['name'] != 'Центральная площадь') { - $this->error2 = 'Собирать снег можно только РЅР° Центральной площади'; + //варежки одеты, все ок + if ($this->room['name'] != 'Центральная площадь') { + $this->error2 = 'Собирать снег можно только на Центральной площади'; } else { $smt = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time() - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1', 1); if (isset($smt['id'])) { - $this->error2 = 'Нельзя лепить несколько снежков одновременно ;)'; + $this->error2 = 'Нельзя лепить несколько снежков одновременно ;)'; } else { $smt = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `time`>=' . strtotime('now 00:00:00') . ' AND `vars` = "create_snowball_cp" LIMIT 25', 2); $smt = $smt[0]; if ($smt < 10) { $this->addAction(time(), 'create_snowball_cp', $this->info['city']); $magic->add_eff($this->info['id'], 24); - $this->error2 = 'Начинаем лепить снежок, осталось ' . (10 - $smt) . ' раз РЅР° сегодня ...'; + $this->error2 = 'Начинаем лепить снежок, осталось ' . (10 - $smt) . ' раз на сегодня ...'; } else { - $this->error2 = 'Р’С‹ уже слепили 10 снежка Р·Р° сегодня ...'; + $this->error2 = 'Вы уже слепили 10 снежка за сегодня ...'; } } } @@ -1763,20 +1745,20 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $v = 0; } if ($t == 0) { - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; + $names[] = ' '; + $names[] = ' '; + $names[] = ' '; + $names[] = ' '; } else { - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; + $names[] = ' '; + $names[] = ' '; + $names[] = ' '; + $names[] = ' '; } $int = $v; do { $mod = $int % 10; - $int = floor($int / 10);//или быстрее $int = ($int-$mod)/10; + $int = floor($int / 10);//или быстрее $int = ($int-$mod)/10; $r = array_shift($names) . "" . $mod . "" . $r; } while ($int); @@ -1833,15 +1815,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($clon != null) { $r = false; if (is_array($clon)) { - //уже взяли инфу + //уже взяли инфу } else { $clon = $this->takePersInfo('`u`.`id` = "' . ((int)$clon) . '"'); } if (isset($clon['id'])) { if (!isset($clon['loclon'])) { - $clon['login'] .= ' (Клон)'; + $clon['login'] .= ' (Клон)'; } - //копируем пользователя + //копируем пользователя $ins1 = mysql_query('INSERT INTO `users` ( `align`, `login`, @@ -1875,7 +1857,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` )'); if ($ins1) { if ($round > 0) { - //Улучшаем РјС„. Рё статы Рё РќР  1 раунд = +10% + //Улучшаем мф. и статы и НР 1 раунд = +10% $statss = $this->lookStats($clon['stats']); // $statss['s1'] = ceil($statss['s1'] * (1 + 0.1 * ($round))); @@ -1897,7 +1879,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` unset($statss); } if ($luser == true && $clon['level'] < 8) { - //Хуже СѓРІРѕСЂРѕС‚, РєСЂРёС‚ Рё защита + //Хуже уворот, крит и защита $statss = $this->lookStats($clon['stats']); $statss['m1'] = ceil($statss['m1'] * 0.75); $statss['m2'] = ceil($statss['m2'] * 0.75); @@ -1910,16 +1892,16 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` unset($statss); } $uid = mysql_insert_id(); - //копируем статы + //копируем статы $ins2 = mysql_query('INSERT INTO `stats` (`clone`,`id`,`stats`,`hpNow`,`upLevel`,`bot`,`priems`) VALUES ("' . $clon['id'] . '","' . $uid . '","' . $clon['stats'] . '","1000000","' . $clon['upLevel'] . '","1","' . $clon['priems'] . '")'); if ($ins2) { - //копируем предметы + //копируем предметы $sp = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `uid` = "' . $clon['id'] . '" AND `inOdet` > 0 AND `delete` = "0" LIMIT 50'); while ($pl = mysql_fetch_array($sp)) { $pl['data'] = str_replace('toclan', 'to_clan_', $pl['data']); mysql_query('INSERT INTO `items_users` (`uid`,`item_id`,`data`,`inOdet`,`iznosMAX`,`kolvo`) VALUES ("' . $uid . '","' . $pl['item_id'] . '","' . $pl['data'] . '","' . $pl['inOdet'] . '","' . $pl['iznosMAX'] . '","' . $pl['kolvo'] . '")'); } - //копируем эффекты + //копируем эффекты $sp = mysql_query('SELECT `id`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`timeAce`,`user_use`,`delete`,`v1`,`v2`,`img2`,`x`,`hod`,`bj`,`sleeptime`,`no_Ace`,`tr_life_user` FROM `eff_users` WHERE `uid` = "' . $clon['id'] . '" AND `delete` = "0" AND `deactiveTime` < "' . time() . '" AND `v1` != "priem" LIMIT 50'); while ($pl = mysql_fetch_array($sp)) { mysql_query('INSERT INTO `eff_users` (`uid`,`id_eff`,`data`,`name`,`overType`,`timeUse`,`x`) VALUES ("' . $uid . '","' . $pl['id_eff'] . '","' . $pl['data'] . '","' . $pl['name'] . '","' . $pl['overType'] . '","' . $pl['timeUse'] . '","' . $pl['x'] . '")'); @@ -1982,7 +1964,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($ins1) { $uid = mysql_insert_id(); if ($round > 0) { - //Улучшаем РјС„. Рё статы Рё РќР  1 раунд = +20% + //Улучшаем мф. и статы и НР 1 раунд = +20% $statss = $this->lookStats($bot['stats']); // $statss['s1'] = ceil($statss['s1'] * (1 + 0.20 * ($round))); @@ -2009,7 +1991,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $bot['logins_bot'] = $logins_bot; $ret = $bot; - //Выдаем предметы + //Выдаем предметы //$this->addItem($item_id,$uid); $iu = explode(',', $bot['itemsUse']); $i = 0; @@ -2051,13 +2033,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } /* - * $iid Уникальный id прдемета Рё одновремено флаг что - * РїРѕРєСѓРїРєР° РёР· РєРѕРјРєР°. + * $iid Уникальный id прдемета и одновремено флаг что + * покупка из комка. */ public function buyItem($sid, $itm, $x, $mdata = null, $vip = false) { global $c, $code, $sid; - // sid 700 - 730 зарезервированный диапазон для РєСѓР·РЅРёС† РІ пещере (РђРџ вешей РґРѕ 10лвл) + // sid 700 - 730 зарезервированный диапазон для кузниц в пещере (АП вешей до 10лвл) $x = round((int)$x); if ($x < 1) { $x = 1; @@ -2073,9 +2055,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $test = $this->testVipItems($i['type']); } if ($vip == true && $test == false) { - $r = 'Данная РїРѕРєСѓРїРєР° ограничена VIP аккаунтом, приобретите более РґРѕСЂРѕРіРѕР№ аккаунт'; + $r = 'Данная покупка ограничена VIP аккаунтом, приобретите более дорогой аккаунт'; } elseif ($this->info['allLock'] > time()) { - $r = 'Вам запрещено совершать РїРѕРєСѓРїРєРё РґРѕ ' . date('d.m.y H:i', $this->info['allLock']) . ''; + $r = 'Вам запрещено совершать покупки до ' . date('d.m.y H:i', $this->info['allLock']) . ''; } elseif (isset($i['id'])) { if ($i['price_4'] <= 0) { $i['price_4'] = $i['price3']; @@ -2121,7 +2103,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $trn = 1; } - if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для РїРѕРєСѓРїРєРё + if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки $need_rep = 0; $tr_rep = $this->lookStats($i['tr_reputation']); foreach ($tr_rep as $row) { @@ -2140,21 +2122,21 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($i['max_buy'] < $x && $i['max_buy'] > 0) { - $r = 'Для РїРѕРєСѓРїРєРё доступно ' . $i['max_buy'] . ' шт.'; + $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.'; } elseif ($need_rep > 0) { - $r = 'Р’С‹ РЅРµ заслужили нашего доверия, РјС‹ РЅРµ продадим вам этот товар.'; + $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.'; } elseif ($mxby == -1) { - $r = 'Максимальное количество РїРѕРєСѓРїРѕРє для данного предмета исчерпана'; + $r = 'Максимальное количество покупок для данного предмета исчерпана'; } elseif ($trn == 0 && $this->info['admin'] == 0) { - $r = 'РЈ вас недостаточно требуемых предметов (РЅРµ хватает ' . $trnt . ')'; + $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')'; } elseif ($i['price_4'] * $x > ($this->rep['rep3'] - $this->rep['rep3_buy'])) { - $r = 'РЈ вас недостаточно репутации (РЅРµ хватает ' . ($price - ($this->rep['rep3'] - $this->rep['rep3_buy'])) . ' репутации.)'; + $r = 'У вас недостаточно репутации (не хватает ' . ($price - ($this->rep['rep3'] - $this->rep['rep3_buy'])) . ' репутации.)'; } else { $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1')); $this->rep['rep3_buy'] += $price; $upd = mysql_query('UPDATE `rep` SET `rep3_buy` = "' . mysql_real_escape_string($this->rep['rep3_buy']) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($upd) { - //новая дата + //новая дата $data = ''; $data .= $d['data']; if ($mdata != null) { @@ -2190,36 +2172,36 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ix++; } if ($ins) { - //Записываем РІ личное дело что предмет получен + //Записываем в личное дело что предмет получен if ($trnt != '' && $i['tr_items'] != '') { $trnt = ', ' . $trnt; } - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $price . ' репутации. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' репутации. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; $j = 0; while ($j < count($detrn)) { $ost = ((int)$detrn[$j][1]); $s4 = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''); while ($itm = mysql_fetch_array($s4)) { - //удаляем предмет + //удаляем предмет mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } $j++; } - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Артефактный магазин! Персонаж ".$this->info['login']." приобрел предмет "".$i['name']."" , Поздравляем СЃ удачной РїРѕРєСѓРїРєРѕР№!','-1','5','0')"); + //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Артефактный магазин! Персонаж ".$this->info['login']." приобрел предмет "".$i['name']."" , Поздравляем с удачной покупкой!','-1','5','0')"); mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'); - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] Р·Р° ' . $price . ' репутации.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' репутации.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i['name'] . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' репутации.
    РџСЂРёРЅРѕСЃРёРј СЃРІРѕРё извинения Р·Р° неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": РЅРµ удалось приобрести предмет #' . $i['iid'] . '. Рљ возрату: ' . $price . ' репутации. ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' репутации.
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' репутации. ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); if (!$ld) { - echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } } elseif ($i['price_3'] > 0) { @@ -2262,7 +2244,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $trn = 1; } - if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для РїРѕРєСѓРїРєРё + if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки $need_rep = 0; $tr_rep = $this->lookStats($i['tr_reputation']); foreach ($tr_rep as $row) { @@ -2281,21 +2263,21 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($i['max_buy'] < $x && $i['max_buy'] > 0) { - $r = 'Для РїРѕРєСѓРїРєРё доступно ' . $i['max_buy'] . ' шт.'; + $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.'; } elseif ($need_rep > 0) { - $r = 'Р’С‹ РЅРµ заслужили нашего доверия, РјС‹ РЅРµ продадим вам этот товар.'; + $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.'; } elseif ($mxby == -1) { - $r = 'Максимальное количество РїРѕРєСѓРїРѕРє для данного предмета исчерпана'; + $r = 'Максимальное количество покупок для данного предмета исчерпана'; } elseif ($trn == 0 && $this->info['admin'] == 0) { - $r = 'РЈ вас недостаточно требуемых предметов (РЅРµ хватает ' . $trnt . ')'; + $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')'; } elseif ($i['price_3'] * $x > $this->info['money3']) { - $r = 'РЈ вас недостаточно валюты (РЅРµ хватает ' . ($price - $this->info['money3']) . ' $)'; + $r = 'У вас недостаточно валюты (не хватает ' . ($price - $this->info['money3']) . ' $)'; } else { $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1')); $this->info['money3'] -= $price; $upd = mysql_query('UPDATE `users` SET `money3` = "' . mysql_real_escape_string($this->info['money3']) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($upd) { - //новая дата + //новая дата $data = ''; $data .= $d['data']; if ($mdata != null) { @@ -2331,36 +2313,36 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ix++; } if ($ins) { - //Записываем РІ личное дело что предмет получен + //Записываем в личное дело что предмет получен if ($trnt != '' && $i['tr_items'] != '') { $trnt = ', ' . $trnt; } - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $price . ' $. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' $. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; $j = 0; while ($j < count($detrn)) { $ost = ((int)$detrn[$j][1]); $s4 = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''); while ($itm = mysql_fetch_array($s4)) { - //удаляем предмет + //удаляем предмет mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } $j++; } - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Артефактный магазин! Персонаж ".$this->info['login']." приобрел предмет "".$i['name']."" , Поздравляем СЃ удачной РїРѕРєСѓРїРєРѕР№!','-1','5','0')"); + //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','Артефактный магазин! Персонаж ".$this->info['login']." приобрел предмет "".$i['name']."" , Поздравляем с удачной покупкой!','-1','5','0')"); mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'); - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] Р·Р° ' . $price . ' $', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' $', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i['name'] . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' $
    РџСЂРёРЅРѕСЃРёРј СЃРІРѕРё извинения Р·Р° неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": РЅРµ удалось приобрести предмет #' . $i['iid'] . '. Рљ возрату: ' . $price . ' $ ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' $
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' $ ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); if (!$ld) { - echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } } elseif ($sid == 2 || $sid == 777) { @@ -2377,14 +2359,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $i['price_2'] = round($i['price_2'] / 20, 2); } - //РЎРєРёРґРєР° РІ государственный магазин 5% + //Скидка в государственный магазин 5% if ($this->stats['silver'] >= 1) { if ($sid == 2) { $i['price_1'] = round($i['price_1'] / 100 * 95, 2); } } - //РЎРєРёРґРєР° РІ березку магазин 5% + //Скидка в березку магазин 5% if ($this->stats['silver'] >= 5) { if ($sid == 2) { $i['price_2'] = round($i['price_2'] / 100 * 95, 2); @@ -2401,11 +2383,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($i['max_buy'] < $x && $i['max_buy'] > 0) { - $r = 'Для РїРѕРєСѓРїРєРё доступно ' . $i['max_buy'] . ' шт.'; + $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.'; } elseif ($mxby == -1) { - $r = 'Максимальное количество РїРѕРєСѓРїРѕРє для данного предмета исчерпана'; + $r = 'Максимальное количество покупок для данного предмета исчерпана'; } elseif ($i['price_2'] * $x > $this->info['money2']) { - $r = 'РЈ вас недостаточно денег РЅР° счете (РЅРµ хватает ' . ($price - $this->info['money2']) . ' екр.)'; + $r = 'У вас недостаточно денег на счете (не хватает ' . ($price - $this->info['money2']) . ' екр.)'; } else { $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1')); $this->info['money2'] -= $price; @@ -2413,7 +2395,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($upd) { $this->info['frg'] += $price; mysql_query('UPDATE `users` SET `frg` = "' . floor($this->info['frg']) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - //новая дата + //новая дата $data = ''; $data .= $d['data']; $i['time_create'] = time(); @@ -2456,23 +2438,23 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ix++; } if ($ins) { - //Записываем РІ личное дело что предмет получен - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $price . ' екр.
    Предмет успешно добавлен РІ инвентарь.'; + //Записываем в личное дело что предмет получен + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' екр.
    Предмет успешно добавлен в инвентарь.'; mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'); - $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] Р·Р° ' . $price . ' екр.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0); + $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] за ' . $price . ' екр.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i['name'] . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
    РџСЂРёРЅРѕСЃРёРј СЃРІРѕРё извинения Р·Р° неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": РЅРµ удалось приобрести предмет #' . $i['iid'] . '. Рљ возрату: ' . $price . ' екр.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0); + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' екр.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0); if (!$ld) { - echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } - } elseif (($sid >= 700 && $sid <= 730) /*OR ( $sid >= 800 && $sid <=805 )*/) { // nalpva2.php Покупаем предмет, Рё перемещаем РІ него Чарку, Р СѓРЅСѓ Рё прочее. + } elseif (($sid >= 700 && $sid <= 730) /*OR ( $sid >= 800 && $sid <=805 )*/) { // nalpva2.php Покупаем предмет, и перемещаем в него Чарку, Руну и прочее. if ($i['kolvo'] < $x) $x = $i['kolvo']; if ($x < 1) $x = 1; if ($i['price_1'] <= 0 && $i['tr_items'] == '') $i['price_1'] = $i['price1']; @@ -2511,7 +2493,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $trn = 1; } - if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для РїРѕРєСѓРїРєРё + if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки $need_rep = 0; $tr_rep = $this->lookStats($i['tr_reputation']); foreach ($tr_rep as $row) { @@ -2530,17 +2512,17 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($i['max_buy'] < $x && $i['max_buy'] > 0) { - $r = 'Для РїРѕРєСѓРїРєРё доступно ' . $i['max_buy'] . ' шт.'; + $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.'; } elseif ($need_rep > 0) { - $r = 'Р’С‹ РЅРµ заслужили нашего доверия, РјС‹ РЅРµ продадим вам этот товар.'; + $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.'; } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) { - $r = 'РЈ вас недостаточно денег.'; + $r = 'У вас недостаточно денег.'; } elseif ($mxby == -1) { - $r = 'Максимальное количество РїРѕРєСѓРїРѕРє для данного предмета исчерпана
    Возможно купить: ' . $i['max_buy'] . ' шт.'; + $r = 'Максимальное количество покупок для данного предмета исчерпана
    Возможно купить: ' . $i['max_buy'] . ' шт.'; } elseif ($trn == 0 && $this->info['admin'] == 0) { - $r = 'РЈ вас недостаточно требуемых предметов (РЅРµ хватает ' . $trnt . ')'; + $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')'; } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) { - $r = 'РЈ вас недостаточно денег (РЅРµ хватает ' . ($price - $this->info['money']) . ' РєСЂ.)'; + $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)'; } else { $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1')); if ($zuby == 0) { @@ -2548,7 +2530,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $upd = mysql_query('UPDATE `users` SET `money` = "' . mysql_real_escape_string(round($this->info['money'], 2)) . '",`money4` = "' . mysql_real_escape_string(round($this->info['money4'], 2)) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($upd) { - //новая дата + //новая дата $data = ''; $data .= $d['data']; if ($mdata != null) { @@ -2607,11 +2589,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($c_itm > 0) { $data = $this->lookStats($data); - // Чарка + // Чарка if (isset($c_itm_data_a['spell_st_name']) && isset($c_itm_data_a['spell_st_val']) && $c_itm_data_a['spell_st_name'] != '' && $c_itm_data_a['spell_st_val'] != '') { $data['add_' . $c_itm_data_a['spell_st_name']] = (int)(isset($data['add_' . $c_itm_data_a['spell_st_name']]) ? (int)$data['add_' . $c_itm_data_a['spell_st_name']] : 0) + (int)$c_itm_data_a['spell_st_val']; } - // Р СѓРЅР° + // Руна if (isset($c_itm_data_a['rune']) && $c_itm_data_a['rune'] > 0) { $ritm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $c_itm_data_a['rune_id'] . '" LIMIT 1')); @@ -2667,15 +2649,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ix++; } if ($ins) { - //Записываем РІ личное дело что предмет получен + //Записываем в личное дело что предмет получен if ($trnt != '' && $i['tr_items'] != '') { $trnt = ', ' . $trnt; } if ($zuby == 0) { - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $price . ' РєСЂ. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; } else { - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $this->zuby($price) . '. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby($price) . '. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; } $j = 0; @@ -2683,27 +2665,27 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ost = ((int)$detrn[$j][1]); $s4 = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''); while ($itm = mysql_fetch_array($s4)) { - //удаляем предмет + //удаляем предмет mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } $j++; } mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'); - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] Р·Р° ' . $price . ' РєСЂ.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i['name'] . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' РєСЂ.
    РџСЂРёРЅРѕСЃРёРј СЃРІРѕРё извинения Р·Р° неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": РЅРµ удалось приобрести предмет #' . $i['iid'] . '. Рљ возрату: ' . $price . ' РєСЂ.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); if (!$ld) { - echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } - } else { // Стандартная РїРѕРєСѓРїРєР° предмета + } else { // Стандартная покупка предмета if ($i['kolvo'] < $x) { $x = $i['kolvo']; } @@ -2717,12 +2699,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $i['price_2'] = $i['price2']; } - //РЎРєРёРґРєР° РІ государственный магазин 5% + //Скидка в государственный магазин 5% if ($this->stats['silver'] >= 1 && $sid == 1) { $i['price_1'] = round($i['price_1'] / 100 * 95, 2); } - //РЎРєРёРґРєР° РІ березку магазин 5% + //Скидка в березку магазин 5% if ($this->stats['silver'] >= 5 && $sid == 2) { $i['price_2'] = round($i['price_2'] / 100 * 95, 2); } @@ -2761,7 +2743,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $trn = 1; } - if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для РїРѕРєСѓРїРєРё + if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки $need_rep = 0; $tr_rep = $this->lookStats($i['tr_reputation']); foreach ($tr_rep as $key => $val) { @@ -2788,25 +2770,25 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $po = $this->lookStats($d['data']); if ($zuby == 1 && $po['tr_lvl'] > 7) { - $r = 'Данный предмет нельзя приобрести Р·Р° Р·СѓР±С‹.'; + $r = 'Данный предмет нельзя приобрести за зубы.'; } elseif (!isset($this->sid_zuby[$sid]) && $zuby == 1) { - $r = 'Данный предмет нельзя приобрести Р·Р° Р·СѓР±С‹.'; + $r = 'Данный предмет нельзя приобрести за зубы.'; } elseif ($zuby == 1 && $i['nozuby'] == 1) { - $r = 'Данный предмет нельзя приобрести Р·Р° Р·СѓР±С‹.'; + $r = 'Данный предмет нельзя приобрести за зубы.'; } elseif ($i['max_buy'] < $x && $i['max_buy'] > 0) { - $r = 'Для РїРѕРєСѓРїРєРё доступно ' . $i['max_buy'] . ' шт.'; + $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.'; } elseif (isset($need_rep) && $need_rep == 0) { - $r = 'Р’С‹ РЅРµ заслужили нашего доверия, РјС‹ РЅРµ продадим вам этот товар.'; + $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.'; } elseif ($zuby == 1 && $this->info['money4'] < $i['price_1']) { - $r = 'РЈ вас недостаточно Р·СѓР±РѕРІ.'; + $r = 'У вас недостаточно зубов.'; } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) { - $r = 'РЈ вас недостаточно денег.'; + $r = 'У вас недостаточно денег.'; } elseif ($mxby == -1) { - $r = 'Максимальное количество РїРѕРєСѓРїРѕРє для данного предмета исчерпана
    Возможно купить: ' . $i['max_buy'] . ' шт.'; + $r = 'Максимальное количество покупок для данного предмета исчерпана
    Возможно купить: ' . $i['max_buy'] . ' шт.'; } elseif ($trn == 0 && $this->info['admin'] == 0) { - $r = 'РЈ вас недостаточно требуемых предметов (РЅРµ хватает ' . $trnt . ')'; + $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')'; } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) { - $r = 'РЈ вас недостаточно денег (РЅРµ хватает ' . ($price - $this->info['money']) . ' РєСЂ.)'; + $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)'; } else { if ($zuby == 0) { $this->info['money'] -= $price; @@ -2815,7 +2797,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $upd = mysql_query('UPDATE `users` SET `money` = "' . mysql_real_escape_string(round($this->info['money'], 2)) . '",`money4` = "' . mysql_real_escape_string(round($this->info['money4'], 2)) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($upd) { - //новая дата + //новая дата $data = ''; $data .= $d['data']; $data = str_replace('sudba=1', 'sudba=' . $this->info['login'], $data); @@ -2868,15 +2850,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ix++; } if ($ins) { - //Записываем РІ личное дело что предмет получен + //Записываем в личное дело что предмет получен if ($trnt != '' && $i['tr_items'] != '') { $trnt = ', ' . $trnt; } if ($zuby == 0) { - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $price . ' РєСЂ. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; } else { - $r = 'Р’С‹ приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') Р·Р° ' . $this->zuby($price) . '. ' . $trnt . '
    Предмет успешно добавлен РІ инвентарь.'; + $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby($price) . '. ' . $trnt . '
    Предмет успешно добавлен в инвентарь.'; } $zx = 0; @@ -2885,14 +2867,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (($sid == 1 || $sid == 5) && $i['level'] >= 4 && round($price / $x) > 25) { if ($this->stats['shopSale'] == 0 && $c['nosanich'] == false) { - //Выдаем странички Саныча РІ РіРѕСЃ магазине Рё канаве - $prmn = 0; //дополнительный Р±РѕРЅСѓСЃ + //Выдаем странички Саныча в гос магазине и канаве + $prmn = 0; //дополнительный бонус $prmn = (1 - (pow(0.5, ($price / $x / 200)))) * 100; $prmn = round(20 / 100 * $prmn); if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) { //3143 - 3192 if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) { - //обложка + //обложка $gitm = rand(3193, 3195); } else { $gitm = rand(3143, 3192); @@ -2901,7 +2883,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $gitm = 3194; } if ($sid == 5) { - //привязываем СЃСѓРґСЊР±РѕР№ + //привязываем судьбой } $this->addItem($gitm, $this->info['id']); $rs++; @@ -2913,19 +2895,19 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($rs > 1) { if (rand(0, 1) == 1) { - $r .= ' Предмет был завернут РІ какую-то бумажку. (x' . $rs . ')'; + $r .= ' Предмет был завернут в какую-то бумажку. (x' . $rs . ')'; } elseif (rand(0, 1)) { - $r .= ' Предмет был завернут РІ странный свиток. (x' . $rs . ')'; + $r .= ' Предмет был завернут в странный свиток. (x' . $rs . ')'; } else { - $r .= ' Рљ предмету была прикреплена какая-та бумажка. (x' . $rs . ')'; + $r .= ' К предмету была прикреплена какая-та бумажка. (x' . $rs . ')'; } } elseif ($rs > 0) { if (rand(0, 1) == 1) { - $r .= ' Предмет был завернут РІ какую-то бумажку.'; + $r .= ' Предмет был завернут в какую-то бумажку.'; } elseif (rand(0, 1)) { - $r .= ' Предмет был завернут РІ странный свиток.'; + $r .= ' Предмет был завернут в странный свиток.'; } else { - $r .= ' Рљ предмету была прикреплена какая-та бумажка.'; + $r .= ' К предмету была прикреплена какая-та бумажка.'; } } @@ -2935,7 +2917,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $ost = ((int)$detrn[$j][1]); $s4 = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''); while ($itm = mysql_fetch_array($s4)) { - //удаляем предмет + //удаляем предмет mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } $j++; @@ -2945,24 +2927,24 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'); $zuby_inf = ''; if ($zuby == 1) { - $zuby_inf = ' (Р—Р° Р·СѓР±С‹)'; + $zuby_inf = ' (За зубы)'; } - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] Р·Р° ' . $price . ' РєСЂ.' . $zuby_inf . '', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.' . $zuby_inf . '', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i['name'] . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' РєСЂ.
    РџСЂРёРЅРѕСЃРёРј СЃРІРѕРё извинения Р·Р° неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": РЅРµ удалось приобрести предмет #' . $i['iid'] . '. Рљ возрату: ' . $price . ' РєСЂ.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); if (!$ld) { - echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } } } else { - $r = 'Предмет РЅРµ найден РЅР° прилавке'; + $r = 'Предмет не найден на прилавке'; } return '
    ' . $r . '
    '; } @@ -2980,7 +2962,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $this->info['money2'] += $pensia2[1]; mysql_query('UPDATE `users` SET `money2` = `money2` + "' . $pensia2[1] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); } - $this->error = 'Вам начислен Р±РѕРЅСѓСЃ РІ размере ' . $pensia1 . '! '; + $this->error = 'Вам начислен бонус в размере ' . $pensia1 . '! '; mysql_query('INSERT INTO `aaa_bonus` ( `uid`,`time`,`afk`,`type`,`money` ) VALUES ( @@ -3023,7 +3005,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $price = $i2['1price']; if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) { if ($price > $this->info['money']) - $r = 'РЈ вас недостаточно денег (РЅРµ хватает ' . ($price - $this->info['money']) . ' РєСЂ.)'; + $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)'; else { $UpdMoney = mysql_query('UPDATE `users` SET `money` = "' . mysql_real_escape_string(round($this->info['money'] - $price, 2)) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($UpdMoney) { @@ -3036,31 +3018,31 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } else { $UpItems = mysql_query('UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" AND `uid`="' . $i2['uid'] . '" LIMIT 1'); } - //Вставляем функцию передачи кредитов владельцу предмета + //Вставляем функцию передачи кредитов владельцу предмета if ($UpItems) { - //Записываем РІ личное дело что предмет получен - $r = 'Р’С‹ приобрели предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" Р·Р° ' . $price . ' РєСЂ.
    Предмет успешно добавлен РІ инвентарь.'; - $ld = $this->addDelo(1, $this->info['id'], '"ComissShop.' . $this->info['city'] . '": Приобрел предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] РІ РєРѕРјРјРёСЃРёРѕРЅРЅРѕРј магазине Р·Р° ' . $price . ' РєСЂ. [Продавец: ' . ($i2['login'] != '' ? '' . $i2['login'] . '' : '(' . $i2['uid'] . ')') . ']', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', $price, 0); + //Записываем в личное дело что предмет получен + $r = 'Вы приобрели предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" за ' . $price . ' кр.
    Предмет успешно добавлен в инвентарь.'; + $ld = $this->addDelo(1, $this->info['id'], '"ComissShop.' . $this->info['city'] . '": Приобрел предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] в коммисионном магазине за ' . $price . ' кр. [Продавец: ' . ($i2['login'] != '' ? '' . $i2['login'] . '' : '(' . $i2['uid'] . ')') . ']', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', $price, 0); $u2s = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $i2['uid'] . '" LIMIT 1')); - $ld = $this->addDelo(1, $u2s['id'], '"ComissShop.' . $this->info['city'] . '": Продал предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] через коммисионный магазине Р·Р° ' . $price . ' РєСЂ. [Покупатель: ' . $this->info['login'] . ']', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price); + $ld = $this->addDelo(1, $u2s['id'], '"ComissShop.' . $this->info['city'] . '": Продал предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] через коммисионный магазине за ' . $price . ' кр. [Покупатель: ' . $this->info['login'] . ']', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price); } else { - //Записываем РІ личное дело что предмет РЅРµ получен - $r = 'Вам РЅРµ удалось приобрести "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '". Администрация магазина РІ "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
    Приносим свои извинения за неудобства.'; - $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: ' . $price . ' кр.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); - if (!$ld) echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; + //Записываем в личное дело что предмет не получен + $r = 'Вам не удалось приобрести "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
    Приносим свои извинения за неудобства.'; + $ld = $this->addDelo(1, $this->info['id'], '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: ' . $price . ' кр.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0); + if (!$ld) echo '
    Ошибка, невозможно добавить запись в /db/usersDelo/!
    '; } } else { - $r = 'Вам РЅРµ удалось приобрести предмет...'; + $r = 'Вам не удалось приобрести предмет...'; } } } else - $r = 'Предмет РЅРµ найден РЅР° прилавке'; + $r = 'Предмет не найден на прилавке'; return '
    ' . $r . '
    '; } public function commisonRent($action, $iid, $price = null) { - if ($action == "Сдать РІ магазин" && isset($iid) && $price > 0) { + if ($action == "Сдать в магазин" && isset($iid) && $price > 0) { $ChImtem = mysql_fetch_array(mysql_query('SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1')); $ChSudba = $this->lookStats($ChImtem['data']); if (isset($ChSudba['sudba']) || $ChSudba['sudba'] != 0 || $ChSudba['sudba'] == 1 || isset($ChSudba['toclan'])) { @@ -3077,7 +3059,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '); } } - } elseif ($action == "Забрать" && isset($iid)) { + } elseif ($action == "Забрать" && isset($iid)) { $i = mysql_fetch_array(mysql_query('SELECT `im`.`price1`,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1')); if (isset($i['inGroup']) and $i['inGroup'] > 0) { $col = $this->itemsX($i['id']); @@ -3232,7 +3214,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $i = 0; $steckCikl = 1; while ($pl = mysql_fetch_array($cl)) { - // количетсво одинаковых предметов РІ РєРѕРјРєРµ + // количетсво одинаковых предметов в комке if ($preview == "preview") { //$steck = mysql_fetch_array(mysql_query('SELECT COUNT(`item_id`) FROM `items_users` WHERE `item_id` = "'.$pl['item_id'].'" AND `inShop` = 30 LIMIT 1')); $steck = ['--', '--', '--', '--']; @@ -3254,7 +3236,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $po = $this->lookStats($pl['data']); } if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { - //Р—РѕРЅС‹ блока + + //Зоны блока + if ($pl['inOdet'] != 14) { $po['zonb']++; } @@ -3262,11 +3244,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $is2 = ''; $is1 = '
    '; if ($preview == "full") { - $is1 .= 'купить '; + $is1 .= 'купить '; } elseif ($preview == "preview") { - $is1 .= 'Просмотреть '; + $is1 .= 'Просмотреть '; } - //название + //название $col = $this->itemsX($pl[0]); if ($col > 1 && $pl['inGroup'] != 0 && $pl['inGroupCount'] > 1) { @@ -3275,41 +3257,41 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } $is2 .= '' . $pl['name'] . '    '; if ($pl['massa'] > 0 && $preview == "full") { - $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')'; + $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')'; if ($pl['gift'] != '') { $ttl = ''; if ($pl['gift'] == 1) { - $ttl = 'Р’С‹ РЅРµ можете передать этот предмет РєРѕРјСѓ-либо'; + $ttl = 'Вы не можете передать этот предмет кому-либо'; } else { - $ttl = 'Этот предмет подарил ' . $pl['gift'] . '. Р’С‹ РЅРµ сможете передать этот предмет РєРѕРјСѓ-либо еще'; + $ttl = 'Этот предмет подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще'; } $is2 .= ' '; } if (isset($po['art'])) { - $is2 .= ' '; + $is2 .= ' '; } if (isset($po['sudba'])) { if ($po['sudba'] == '0') { - $is2 .= ' '; + $is2 .= ' '; } elseif ($po['sudba'] == '1') { - $is2 .= ' '; + $is2 .= ' '; } else { - $is2 .= ' '; + $is2 .= ' '; } } } - //цена - $is2 .= '
    Цена: '; + //цена + $is2 .= '
    Цена: '; if ($steck[0] > 1 && $preview == "preview") { - $is2 .= $steck[3] . '-' . $steck[4] . ' РєСЂ. '; + $is2 .= $steck[3] . '-' . $steck[4] . ' кр.
    '; } else { - $is2 .= $pl['1price'] . ' РєСЂ. '; + $is2 .= $pl['1price'] . ' кр. '; } if ($pl['pricerep'] > 0) { - $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)'; + $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)'; } - //долговечность + //долговечность if ($pl['iznosMAX'] > 0) { $izcol = ''; if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) { @@ -3317,41 +3299,41 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } } if ($preview == "preview") { - $is2 .= '
    Долговечность: ' . floor($steck[1]) . '/' . ceil($steck[2]) . ''; + $is2 .= '
    Долговечность: ' . floor($steck[1]) . '/' . ceil($steck[2]) . ''; } else { if ($pl['iznosMAXi'] == 999999999) { - $is2 .= '
    Долговечность: неразрушимо'; + $is2 .= '
    Долговечность: неразрушимо'; } else { - $is2 .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . ''; + $is2 .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . ''; } } - //РЎСЂРѕРє годности предмета + //Срок годности предмета if ($po['srok'] > 0) { $pl['srok'] = $po['srok']; } if ($pl['srok'] > 0 and $preview != "preview") { if ($pl['time_create'] + $pl['srok'] < time()) { - $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']) . ' (испорчен)'; + $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']) . ' (испорчен)'; } else { - $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')'; + $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')'; } } elseif ($pl['srok'] > 0) { - $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']); + $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']); } if ($pl['magic_chance'] > 0) { - $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; + $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; } - //Продолжительность действия магии: + //Продолжительность действия магии: if ((int)$pl['magic_inci'] > 0) { $efi = mysql_fetch_array(mysql_query('SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1')); if (isset($efi['id2']) && $efi['actionTime'] > 0) { - $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); + $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); } } if ($preview == "full" || $preview == "preview") { - //Требуется минимальное: + //Требуется минимальное: $tr = ''; $t = $this->items['tr']; $x = 0; @@ -3371,7 +3353,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $notr++; } } - $tr .= '
    • '; + $tr .= '
    • '; if ($n == 'rep') { $temp = explode('::', $po['tr_' . $n]); $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0]; @@ -3379,9 +3361,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } elseif ($n != 'align') { if ($n == 'sex') { if ($po['tr_' . $n] == 1) { - $tr .= $this->is[$n] . ': Женский'; + $tr .= $this->is[$n] . ': Женский'; } else { - $tr .= $this->is[$n] . ': Мужской'; + $tr .= $this->is[$n] . ': Мужской'; } } else { $tr .= $this->is[$n] . ': ' . $po['tr_' . $n]; @@ -3399,9 +3381,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if ($tr != '') { - $is2 .= '
    Требуется минимальное:' . $tr; + $is2 .= '
    Требуется минимальное:' . $tr; } - //Действует РЅР°: + //Действует на: $tr = ''; $t = $this->items['add']; $x = 0; @@ -3412,13 +3394,13 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['add_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; } $x++; } - //действует РЅР° (Р±СЂРѕРЅСЏ) + //действует на (броня) $i = 1; - $bn = [1 => 'головы', 2 => 'РєРѕСЂРїСѓСЃР°', 3 => 'РїРѕСЏСЃР°', 4 => 'РЅРѕРі']; + $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; while ($i <= 4) { if (isset($po['add_mab' . $i])) { if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) { @@ -3426,21 +3408,21 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['add_mab' . $i] < 0) { $z = ''; } - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; } else { - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx([$po['add_mib' . $i], $po['add_mab' . $i]]) . ')'; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx([$po['add_mib' . $i], $po['add_mab' . $i]]) . ')'; } } $i++; } if ($tr != '') { - $is2 .= '
    Действует на:' . $tr; + $is2 .= '
    Действует на:' . $tr; } - //Свойства предмета: + //Свойства предмета: $tr = ''; $t = $this->items['sv']; if (isset($po['sv_yron_min'], $po['sv_yron_max'])) { - $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; + $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; } $x = 0; while ($x < count($t)) { @@ -3450,18 +3432,18 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['sv_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; } $x++; } if ($pl['2too'] == 1) { - $tr .= '
    • Второе оружие'; + $tr .= '
    • Второе оружие'; } if ($pl['2h'] == 1) { - $tr .= '
    • Двуручное оружие'; + $tr .= '
    • Двуручное оружие'; } if (isset($po['zonb'])) { - $tr .= '
    • Зоны блокирования: '; + $tr .= '
    • Зоны блокирования: '; if ($po['zonb'] > 0) { $x = 1; while ($x <= $po['zonb']) { @@ -3469,12 +3451,12 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $x++; } } else { - $tr .= '—'; + $tr .= '—'; } } if ($tr != '') { - $is2 .= '
    Свойства предмета:' . $tr; + $is2 .= '
    Свойства предмета:' . $tr; } $tr = ''; @@ -3491,12 +3473,12 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } else { $rnc = '#282828'; } - $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); - $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; + $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); + $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; unset($rnc); } if ($tr != '') { - $is2 .= '
    Улучшения предмета:'; + $is2 .= '
    Улучшения предмета:'; $is2 .= $tr; } @@ -3507,24 +3489,24 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } } if (isset($po['free_stats']) && $po['free_stats'] > 0) { - $is2 .= '
    Распределение статов:'; - $is2 .= '• Возможных распределений: ' . $po['free_stats'] . ''; + $is2 .= '
    Распределение статов:'; + $is2 .= '• Возможных распределений: ' . $po['free_stats'] . ''; } if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) { $d[0] = 0; $d[2] = 0; } if (isset($po['complect']) || isset($po['complect2'])) { - $is2 .= '
    Дополнительная информация:'; + $is2 .= '
    Дополнительная информация:'; } if (isset($po['complect'])) { - //РЅРµ отображается - $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; - //действие комплекта + //действие комплекта $i1c = 0; $i2c = 0; $i1e = $this->lookStats($plc['data']); @@ -3547,18 +3529,18 @@ ORDER BY `1price`ASC , inGroupCount DESC'); unset($i1c, $i2c, $i3c); $com1['x']++; } - $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; + $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; $is2 .= $com1['text']; $is2 .= ''; } if (isset($po['complect2'])) { - //РЅРµ отображается - $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20'); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; - //действие комплекта + //действие комплекта $i1c = 0; $i2c = 0; $i1e = $this->lookStats($plc['data']); @@ -3581,78 +3563,78 @@ ORDER BY `1price`ASC , inGroupCount DESC'); unset($i1c, $i2c, $i3c); $com1['x']++; } - $is2 .= '
    • Часть комплекта (РїРѕРґРіРѕРЅРєР°): ' . $com1['name'] . '
    '; + $is2 .= '
    • Часть комплекта (подгонка): ' . $com1['name'] . '
    '; $is2 .= $com1['text']; $is2 .= ''; } $is2 .= ''; if (isset($po['gravi'])) { - $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; + $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; } if ($pl['info'] != '') { - $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; + $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; } if ($po['info'] != '') { $is2 .= '
    ' . $po['info'] . '
    '; } if ($pl['max_text'] - $pl['use_text'] > 0) { - $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; + $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; } if ($pl['maidin'] != '') { - // $is2 .= '
    Сделано в '.$this->city_name[$pl['maidin']].'
    '; + // $is2 .= '
    Сделано в '.$this->city_name[$pl['maidin']].'
    '; } if (isset($po['noremont'])) { - $is2 .= '
    Предмет не подлежит ремонту
    '; + $is2 .= '
    Предмет не подлежит ремонту
    '; } if (isset($po['nosale'])) { - $is2 .= '
    Предмет нельзя продать
    '; + $is2 .= '
    Предмет нельзя продать
    '; } if (isset($po['nomodif'])) { - $is2 .= '
    Предмет нельзя улучшать
    '; + $is2 .= '
    Предмет нельзя улучшать
    '; } if (isset($po['nodelete'])) { - $is2 .= '
    Предмет нельзя выбросить
    '; + $is2 .= '
    Предмет нельзя выбросить
    '; } if (isset($po['frompisher']) && $po['frompisher'] > 0) { - $is2 .= '
    Предмет из подземелья
    '; + $is2 .= '
    Предмет из подземелья
    '; } if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) { - $is2 .= '
    Предмет не портится во время сна
    '; + $is2 .= '
    Предмет не портится во время сна
    '; } if (isset($po['fromlaba']) && $po['fromlaba'] > 0) { - $is2 .= '
    Предмет из лабиринта
    '; + $is2 .= '
    Предмет из лабиринта
    '; } if (isset($po['vip_sale']) && $po['vip_sale'] > 0) { - $is2 .= '
    Предмет куплен за 10% от стоимости
    '; + $is2 .= '
    Предмет куплен за 10% от стоимости
    '; } if ($pl['dn_delete'] > 0) { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; + $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; } if ($this->pokol > $pl['geni']) { - $is2 .= '
    Предмет устарел
    '; + $is2 .= '
    Предмет устарел
    '; } if (isset($po['zazuby']) && $po['zazuby'] > 0) { - $is2 .= '
    Предмет куплен за зубы
    '; + $is2 .= '
    Предмет куплен за зубы
    '; } - //$is2 .= '
    Сделано в '.$this->city_name[$this->info['city']].'
    '; + //$is2 .= '
    Сделано в '.$this->city_name[$this->info['city']].'
    '; $is2 .= '
    '; } if ($preview == "preview") { - $kolvoprint = "Количество: $steck[0] шт."; + $kolvoprint = "Количество: $steck[0] шт."; } echo '' . $is1 . '' . $kolvoprint . $is2 . ''; $i++; } } - if ($i == 0) echo 'Прилавок магазина РїСѓСЃС‚'; + if ($i == 0) echo 'Прилавок магазина пуст'; } public $sid_zuby = [ - //Кэпитал - 1 => 1, //РіРѕСЃ - 9 => 1, //таверна - 8 => 1 //Р·РѕРѕ + //Кэпитал + 1 => 1, //гос + 9 => 1, //таверна + 8 => 1 //зоо ]; public function shopItems($sid, $plu = '') @@ -3708,7 +3690,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { - //Р—РѕРЅС‹ блока + + //Зоны блока + $po['zonb']++; } @@ -3719,23 +3701,23 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $is1 = '
    '; } if ($sid == 609) { - $is1 .= 'купить'; + $is1 .= 'купить'; } else { //if($this->info['money']>$pl['price']) //{ if ($sid == 2 || $sid == 777) { - $is1 .= 'купить '; + $is1 .= 'купить '; } else { - $is1 .= 'купить '; + $is1 .= 'купить '; } //} if ($pl['nozuby'] == 0 && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1 && $c['zuby']) { - $is1 .= '
    купить за зубы'; + $is1 .= '
    купить за зубы'; } } - //название + //название if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) { $pl['name'] .= ''; @@ -3748,7 +3730,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if (isset($po['renameadd']) && $po['renameadd'] != '') { - $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')'; + $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')'; } if (isset($po['icos'])) { $pl['name'] = '' . $pl['name'] . '  ' . $po['icos'] . ' '; @@ -3757,28 +3739,28 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($pl['massa'] > 0) { - $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')'; + $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')'; } if (isset($po['art'])) { - $is2 .= ' '; + $is2 .= ' '; } if (isset($po['sudba'])) { if ($po['sudba'] == '0') { - $is2 .= ' '; + $is2 .= ' '; } elseif ($po['sudba'] == '1') { - $is2 .= ' '; + $is2 .= ' '; } else { - $is2 .= ' '; + $is2 .= ' '; } } - //цена + //цена if ($this->info['admin'] > 0) { $is2 .= '
      ' . $pl['pos'] . '  
    '; } - $is2 .= '
    Цена: '; + $is2 .= '
    Цена: '; if ($this->stats['silver'] >= 1 && $sid == 1) { $is2 .= ''; } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) { @@ -3791,7 +3773,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $is2 .= '' . round($pl['price_4']) . ''; } - $is2 .= ' Воинственности '; + $is2 .= '
    Воинственности '; } elseif ($pl['price_3'] > 0) { if ($pl['price_3'] > $this->info['money3']) { $is2 .= '' . $pl['price_3'] . ''; @@ -3806,14 +3788,14 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } else { $is2 .= $pl['price_2']; } - $is2 .= ' екр. '; + $is2 .= ' екр. '; } else { if ($pl['price_1'] > $this->info['money']) { $is2 .= '' . $pl['price_1'] . ''; } else { $is2 .= $pl['price_1']; } - $is2 .= ' РєСЂ. '; + $is2 .= ' кр. '; } if ($this->stats['silver'] >= 1 && $sid == 1) { $is2 .= '   '; @@ -3822,7 +3804,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } else { $is2 .= round($pl['price_1'] * 0.95, 2); } - $is2 .= ' РєСЂ. РЎРєРёРґРєР° -5%'; + $is2 .= ' кр. Скидка -5%'; } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) { $is2 .= '   '; if ($pl['price_2'] > $this->info['money2']) { @@ -3830,15 +3812,15 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } else { $is2 .= round($pl['price_2'] * 0.95, 2); } - $is2 .= ' екр. РЎРєРёРґРєР° -5%'; + $is2 .= ' екр. Скидка -5%'; } if ($pl['pricerep'] > 0) { - $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)'; + $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)'; } if ($pl['kolvo'] < 100000) { - $is2 .= '     (количество: ' . $pl['kolvo'] . ')'; + $is2 .= '     (количество: ' . $pl['kolvo'] . ')'; } if ($pl['nozuby'] == 0 && $sid != 609 && $c['zuby'] == true) { @@ -3882,7 +3864,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if ($ttmm != '') { - $ttmm = '
    Требует предмет: ' . rtrim($ttmm, ', ') . ' '; + $ttmm = '
    Требует предмет: ' . rtrim($ttmm, ', ') . ' '; if ($trn == 0) { $ttmm = '' . $ttmm . ''; } @@ -3893,44 +3875,44 @@ ORDER BY `1price`ASC , inGroupCount DESC'); unset($ttmm); - //долговечность + //долговечность if ($pl['iznos'] > 0) { $pl['iznosMAXi'] = $pl['iznos']; } if ($pl['iznosMAXi'] > 0) { if ($pl['iznosMAXi'] == 999999999) { - $is2 .= 'Долговечность: неразрушимо
    '; + $is2 .= 'Долговечность: неразрушимо
    '; } else { - $is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '
    '; + $is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '
    '; } } if ($po['battleUseZd'] > 0) { - $is2 .= 'Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '
    '; + $is2 .= 'Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '
    '; } $is2 = rtrim($is2, '
    '); - //РЎСЂРѕРє годности предмета + //Срок годности предмета if ($po['srok'] > 0) { $pl['srok'] = $po['srok']; } if ($pl['srok'] > 0) { - $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']); + $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']); } if ($pl['magic_chance'] > 0) { - $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; + $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; } - //Продолжительность действия магии: + //Продолжительность действия магии: if ((int)$pl['magic_inci'] > 0) { $efi = mysql_fetch_array(mysql_query('SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1')); if (isset($efi['id2']) && $efi['actionTime'] > 0) { - $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); + $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); } } - //Требуется минимальное: + //Требуется минимальное: $tr = ''; $t = $this->items['tr']; $x = 0; @@ -3950,7 +3932,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $notr++; } } - $tr .= '
    • '; + $tr .= '
    • '; if ($n == 'rep') { $temp = explode('::', $po['tr_' . $n]); $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0]; @@ -3958,9 +3940,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } elseif ($n != 'align') { if ($n == 'sex') { if ($po['tr_' . $n] == 1) { - $tr .= $this->is[$n] . ': Женский'; + $tr .= $this->is[$n] . ': Женский'; } else { - $tr .= $this->is[$n] . ': Мужской'; + $tr .= $this->is[$n] . ': Мужской'; } } else { $tr .= $this->is[$n] . ': ' . $po['tr_' . $n]; @@ -3978,9 +3960,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if ($tr != '') { - $is2 .= '
    Требуется минимальное:' . $tr; + $is2 .= '
    Требуется минимальное:' . $tr; } - //Действует РЅР°: + //Действует на: $tr = ''; $t = $this->items['add']; $x = 0; @@ -3991,13 +3973,13 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['add_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; } $x++; } - //действует РЅР° (Р±СЂРѕРЅСЏ) + //действует на (броня) $i = 1; - $bn = [1 => 'головы', 2 => 'РєРѕСЂРїСѓСЃР°', 3 => 'РїРѕСЏСЃР°', 4 => 'РЅРѕРі']; + $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; while ($i <= 4) { if (isset($po['add_mab' . $i])) { if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) { @@ -4005,22 +3987,22 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['add_mab' . $i] < 0) { $z = ''; } - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; } else { - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i]; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i]; } } $i++; } if ($tr != '') { - $is2 .= '
    Действует на:' . $tr; + $is2 .= '
    Действует на:' . $tr; } - //Свойства предмета: + //Свойства предмета: $tr = ''; $t = $this->items['sv']; if (isset($po['sv_yron_min'], $po['sv_yron_max'])) { - $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; + $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; } $x = 0; while ($x < count($t)) { @@ -4030,18 +4012,18 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($po['sv_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; } $x++; } if ($pl['2too'] == 1) { - $tr .= '
    • Второе оружие'; + $tr .= '
    • Второе оружие'; } if ($pl['2h'] == 1) { - $tr .= '
    • Двуручное оружие'; + $tr .= '
    • Двуручное оружие'; } if (isset($po['zonb'])) { - $tr .= '
    • Зоны блокирования: '; + $tr .= '
    • Зоны блокирования: '; if ($po['zonb'] > 0) { $x = 1; while ($x <= $po['zonb']) { @@ -4049,14 +4031,14 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $x++; } } else { - $tr .= '—'; + $tr .= '—'; } } if ($tr != '') { - $is2 .= '
    Свойства предмета:' . $tr; + $is2 .= '
    Свойства предмета:' . $tr; } - //Особенности + //Особенности $tr = ''; @@ -4072,12 +4054,12 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } else { $rnc = '#282828'; } - $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); - $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; + $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); + $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; unset($rnc); } if ($tr != '') { - $is2 .= '
    Улучшения предмета:'; + $is2 .= '
    Улучшения предмета:'; $is2 .= $tr; } @@ -4090,18 +4072,18 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if (isset($po['free_stats']) && $po['free_stats'] > 0) { - $is2 .= '
    Распределение статов:
    '; - $is2 .= '• Возможных распределений: +' . $po['free_stats'] . ' характеристик'; + $is2 .= '
    Распределение статов:
    '; + $is2 .= '• Возможных распределений: +' . $po['free_stats'] . ' характеристик'; } - //Встроенная магия + //Встроенная магия if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') { if ($pl['magic_inc'] == '') { $pl['magic_inc'] = $pl['magic_inci']; } $mgi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1')); if (isset($mgi['id2'])) { - $is2 .= '
    Встроено заклятие ' . $mgi['minfo'] . '
    '; + $is2 .= '
    Встроено заклятие ' . $mgi['minfo'] . '
    '; } } @@ -4110,16 +4092,16 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $d[2] = 0; } if (isset($po['complect'])) { - $is2 .= '
    Дополнительная информация:'; + $is2 .= '
    Дополнительная информация:'; } if (isset($po['complect'])) { - //РЅРµ отображается - $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; - //действие комплекта + //действие комплекта $i1c = 0; $i2c = 0; $i1e = $this->lookStats($plc['data']); @@ -4142,23 +4124,23 @@ ORDER BY `1price`ASC , inGroupCount DESC'); unset($i1c, $i2c, $i3c); $com1['x']++; } - $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; + $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; $is2 .= $com1['text']; $is2 .= ''; } if ($pl['max_text'] - $pl['use_text'] > 0) { - $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; + $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; } $is2 .= ''; if (isset($po['gravi'])) { - $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; + $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; } if ($pl['info'] != '') { - $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; + $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; } if ($po['info'] != '') { @@ -4166,47 +4148,47 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if (isset($po['noremont'])) { - $is2 .= '
    Предмет не подлежит ремонту
    '; + $is2 .= '
    Предмет не подлежит ремонту
    '; } if (isset($po['nosale'])) { - $is2 .= '
    Предмет нельзя продать
    '; + $is2 .= '
    Предмет нельзя продать
    '; } if (isset($po['nomodif'])) { - $is2 .= '
    Предмет нельзя улучшать
    '; + $is2 .= '
    Предмет нельзя улучшать
    '; } if (isset($po['nodelete'])) { - $is2 .= '
    Предмет нельзя выбросить
    '; + $is2 .= '
    Предмет нельзя выбросить
    '; } if (isset($po['frompisher']) && $po['frompisher'] > 0) { - $is2 .= '
    Предмет из подземелья
    '; + $is2 .= '
    Предмет из подземелья
    '; } if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) { - $is2 .= '
    Предмет не портится во время сна
    '; + $is2 .= '
    Предмет не портится во время сна
    '; } if (isset($po['fromlaba']) && $po['fromlaba'] > 0) { - $is2 .= '
    Предмет из лабиринта
    '; + $is2 .= '
    Предмет из лабиринта
    '; } if (isset($po['vip_sale']) && $po['vip_sale'] > 0) { - $is2 .= '
    Предмет куплен за 10% от стоимости
    '; + $is2 .= '
    Предмет куплен за 10% от стоимости
    '; } if ($pl['dn_delete'] > 0) { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; + $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; } if ($this->pokol > $pl['geni']) { - $is2 .= '
    Предмет устарел
    '; + $is2 .= '
    Предмет устарел
    '; } if (isset($po['zazuby']) && $po['zazuby'] > 0) { - $is2 .= '
    Предмет куплен за зубы
    '; + $is2 .= '
    Предмет куплен за зубы
    '; } $is2 .= '
    '; @@ -4214,7 +4196,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $crd = ''; if ($this->info['admin'] > 0) { - $crd = 'Редактировать предмет   обновить
    '; + $crd = 'Редактировать предмет   обновить
    '; } echo '' . $is1 . ' ' . $crd . '' . $is2 . ''; @@ -4223,7 +4205,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } if ($i == 0) { - echo 'Прилавок магазина РїСѓСЃС‚'; + echo 'Прилавок магазина пуст'; } } @@ -4261,7 +4243,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $n01 += $pl['ability']; $n02 += $pl['skills']; if ($ll < $pl['nextLevel']) { - $n01 += 1; //вынос + $n01 += 1; //вынос if ($this->info['level'] >= 9) { $n01 += 1; } @@ -4292,12 +4274,12 @@ ORDER BY `1price`ASC , inGroupCount DESC'); public function wipe() { if ($this->info['wipe'] > 0 && $this->info['battle'] == 0) { - //wipe = 1 , значит обнуляем статы Рё умения + //wipe = 1 , значит обнуляем статы и умения if ($this->info['wipe'] < 4) { $st = $this->lookStats($this->info['stats']); - $n1 = $this->info['ability']; //способности - $n2 = $this->info['skills']; //владение магией Рё оружием - $n3 = $this->info['sskills']; //особенности + $n1 = $this->info['ability']; //способности + $n2 = $this->info['skills']; //владение магией и оружием + $n3 = $this->info['sskills']; //особенности $n4 = $this->info['nskills']; //??? if ($this->info['wipe'] == 1 || $this->info['wipe'] == 2) { $i = 1; @@ -4337,7 +4319,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $i++; } } - if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---РЎР±СЂРѕСЃ особенностей + if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---Сброс особенностей { $i = 1; while ($i <= 11) { @@ -4346,7 +4328,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $i++; } } - //сохраняем данные + //сохраняем данные $st = $this->impStats($st); $upd = mysql_query('UPDATE `stats` SET `wipe`="0",`stats`="' . $st . '",`ability`="' . $n1 . '",`skills`="' . $n2 . '",`sskills`="' . $n3 . '",`nskills`="' . $n4 . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); if ($upd) { @@ -4362,10 +4344,10 @@ ORDER BY `1price`ASC , inGroupCount DESC'); public function __clone() { - trigger_error('Дублирование РЅРµ допускается.', E_USER_ERROR); + trigger_error('Дублирование не допускается.', E_USER_ERROR); } - //Сверяем требования предмета для его использования + //Сверяем требования предмета для его использования public function trItem($po) { $tr = ''; @@ -4397,7 +4379,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if (isset($itm['id'])) { $po = $this->lookStats($itm['data']); - //статы + //статы if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5') { if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && isset($po['add_' . $_GET['mf']])) { $po['mf_stats'] = (int)$po['mf_stats']; @@ -4471,18 +4453,18 @@ ORDER BY `1price`ASC , inGroupCount DESC'); if ($itm['so'] > 0) { $s = (int)$s; if ($tp == 1) { - //статы + //статы if ($s == 1 || $s == 2 || $s == 3 || $s == 5) { if (10 + 25 * $po['add_s' . $s] <= $itm['so'] && $itm['so'] > 0) { $itm['so'] -= 10 + 25 * $po['add_s' . $s]; $po['add_s' . $s]++; - $this->error = 'Характеристика улучшена...'; + $this->error = 'Характеристика улучшена...'; } else { - $this->error = 'РќРµ хватает очков развития...'; + $this->error = 'Не хватает очков развития...'; } } } elseif ($tp == 2) { - //РјС„ + //мф if ($s > 0 && $s < 13) { $s2 = 0; if ($s == 9 || $s == 12) { @@ -4530,7 +4512,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); } $po['add_' . $s]++; } else { - $this->error = 'РќРµ хватает очков развития...'; + $this->error = 'Не хватает очков развития...'; } } } @@ -4544,7 +4526,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); { $itm = mysql_fetch_array(mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,`iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1')); if ($this->info['transfers'] < 1) { - $this->error = 'РќР° сегодня лимит передач исчерпан.'; + $this->error = 'На сегодня лимит передач исчерпан.'; } elseif (isset($itm['id'])) { if (isset($itm['inGroup']) and $itm['inGroup'] > 0) { $col = $this->itemsX($itm['id']); @@ -4557,7 +4539,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $upd = mysql_query('UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $id . '" AND `inOdet` = "0" AND `delete` = "0" '); } } else { - $this->error = 'Предмет РЅРµ найден РІ рюкзаке'; + $this->error = 'Предмет не найден в рюкзаке'; } } @@ -4566,7 +4548,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'); $itm = mysql_fetch_array(mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,`iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1')); if ($this->info['transfers'] < 1) { - $this->error = 'РќР° сегодня лимит передач исчерпан.'; + $this->error = 'На сегодня лимит передач исчерпан.'; } elseif (isset($itm['id'])) { if (isset($itm['inGroup']) && $itm['inGroup'] > 0) { $col = $this->itemsX($itm['id']); @@ -4579,7 +4561,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $upd = mysql_query('UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $id . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '); } } else { - $this->error = 'Предмет РЅРµ найден РІ СЃСѓРЅРґСѓРєРµ'; + $this->error = 'Предмет не найден в сундуке'; } } @@ -4603,13 +4585,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $mx1 += $this->info['skills']; if ($mx1 > 0) { - //умения + //умения $s = $s - 100; if ($s > 5 && $s <= 12) { - //магия + //магия $po['add_mg' . ($s - 5)]++; } elseif ($s > 0) { - //оружие + //оружие $po['add_a' . $s]++; } } @@ -4701,7 +4683,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($vi > 0) { $itm_inv = $this->genInv(80, ' ' . rtrim($vid, 'OR') . ' '); - echo 'Выберите предмет для использования "' . $rune['name'] . '":

    ' . $itm_inv[2] . '
    '; + echo 'Выберите предмет для использования "' . $rune['name'] . '":

    ' . $itm_inv[2] . '
    '; die(); } else { unset($rune); @@ -4719,9 +4701,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl` ,`m`.`name`,`m`.`type`,`m`.`level` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string($ruid) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1')); if ($rune['level'] > $this->info['level'] && $rune['type'] == 31) { - $this->error = 'РЈ вас слишком маленький уровень чтобы использовать эту СЂСѓРЅСѓ'; + $this->error = 'У вас слишком маленький уровень чтобы использовать эту руну'; } elseif ($rune['type'] == 31) { - //Встраиваем СЂСѓРЅСѓ + //Встраиваем руну if ($idt['type'] == 7) { $idt['type'] = 6; } @@ -4733,40 +4715,40 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $data = $this->lookStats($id['data']); $type_rune = [ - 'С…Рё' => 9, //Серьги - 'С…СЌ' => 10, //Ожерелье - 'РІРё' => 11, //Кольцо - 'РІРѕ' => 12, //Перчатки - 'РєСЌ' => 14, //Поножи - 'РєРё' => 15, //РћР±СѓРІСЊ - 'РјРё' => 1, //Шлем - 'СЃРё' => 3, //Наручи - 'РјРѕ' => 6, //Броня - 'СЃРѕ' => 8 //РџРѕСЏСЃ + 'хи' => 9, //Серьги + 'хэ' => 10, //Ожерелье + 'ви' => 11, //Кольцо + 'во' => 12, //Перчатки + 'кэ' => 14, //Поножи + 'ки' => 15, //Обувь + 'ми' => 1, //Шлем + 'си' => 3, //Наручи + 'мо' => 6, //Броня + 'со' => 8 //Пояс ]; if ($rune['type'] == 5) { - $type_rune['РјРѕ'] = 5; + $type_rune['мо'] = 5; } $type_rune = $type_rune[substr($rune['name'], -2, 2)]; if ($type_rune != $id['type'] && $type_rune != '') { $type_rune2 = [ - 'С…Рё' => 'серьги', //Серьги - 'С…СЌ' => 'ожерелья', //Ожерелье - 'РІРё' => 'кольцо', //Кольцо - 'РІРѕ' => 'перчатки', //Перчатки - 'РєСЌ' => 'поножи', //Поножи - 'РєРё' => 'РѕР±СѓРІСЊ', //РћР±СѓРІСЊ - 'РјРё' => 'шлем', //Шлем - 'СЃРё' => 'наручи', //Наручи - 'РјРѕ' => 'Р±СЂРѕРЅСЋ', //Броня - 'СЃРѕ' => 'РїРѕСЏСЃ' //РџРѕСЏСЃ + 'хи' => 'серьги', //Серьги + 'хэ' => 'ожерелья', //Ожерелье + 'ви' => 'кольцо', //Кольцо + 'во' => 'перчатки', //Перчатки + 'кэ' => 'поножи', //Поножи + 'ки' => 'обувь', //Обувь + 'ми' => 'шлем', //Шлем + 'си' => 'наручи', //Наручи + 'мо' => 'броню', //Броня + 'со' => 'пояс' //Пояс ]; - $this->error = 'Встроить данную СЂСѓРЅСѓ возможно только РІ ' . $type_rune2[substr($rune['name'], -2, 2)] . ' (РўРёРї предмета: ' . $id['type'] . '. Требуемый тип: ' . $type_rune . ')'; + $this->error = 'Встроить данную руну возможно только в ' . $type_rune2[substr($rune['name'], -2, 2)] . ' (Тип предмета: ' . $id['type'] . '. Требуемый тип: ' . $type_rune . ')'; } elseif (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif (isset($data['art']) && $data['tr_lvl'] < 0) { - $this->error = 'Встраивание усилений РІ артефакты ниже 10-РіРѕ СѓСЂРѕРІРЅСЏ недоступно'; + $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно'; } else { if (isset($data['rune']) && $data['rune'] > 0) { $ritm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1')); @@ -4783,7 +4765,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $data['rune_id'] = $rune['item_id']; $data['rune_name'] = $rune['name']; $data['rune_lvl'] = $rune['level']; - //Добавляем характеристики СЂСѓРЅС‹ + //Добавляем характеристики руны $add = $this->lookStats($rune['data']); $i = 0; while ($i < count($this->items['add'])) { @@ -4798,14 +4780,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Встраивание СЂСѓРЅС‹ прошло успешно'; + $this->error = 'Встраивание руны прошло успешно'; } } else { $rune = mysql_fetch_array(mysql_query('SELECT `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl` ,`m`.`name`,`m`.`level`,`m`.`type` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string($ruid) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1')); if (!isset($rune['id'])) { - $this->error = 'Усиление которое РІС‹ использовали РЅРµ найдено'; + $this->error = 'Усиление которое вы использовали не найдено'; } elseif ($rune['type'] == 62 && $rune['item_id'] == 6167) { //----------------------------------------------- $idt = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1')); @@ -4813,9 +4795,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $data = $this->lookStats($id['data']); $add = $this->lookStats($rune['data']); if (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif (isset($data['art']) && $data['tr_lvl'] < 0) { - $this->error = 'Встраивание усилений РІ артефакты ниже 10-РіРѕ СѓСЂРѕРІРЅСЏ недоступно'; + $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно'; } else { if (isset($data['spell']) && $data['spell'] > 0) { @@ -4851,7 +4833,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } - //Новая чарка + //Новая чарка $srune = mysql_query('SELECT * FROM `new_charov` WHERE 1'); $irun = 0; @@ -4872,7 +4854,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (!isset($data['sudba'])) { $data['sudba'] = '0'; } - $data['spell_name'] = 'Зачарованно'; //$info + $data['spell_name'] = 'Зачарованно'; //$info $data['spell_st_name'] = $addrune['gname']; $data['spell_st_val'] = $addrunes; $data['spell_id'] = $rune['item_id']; @@ -4885,9 +4867,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $tid = mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); if (isset($tid)) { - $this->error = 'Чарование прошло успешно!'; + $this->error = 'Чарование прошло успешно!'; } else { - $this->error = 'Что то пошло РЅРµ так!'; + $this->error = 'Что то пошло не так!'; } unset($tid); } @@ -4906,18 +4888,18 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $idt['type'] = 6; } //$id['type'] = $idt['type']; - //Встраиваем СЂСѓРЅСѓ + //Встраиваем руну $data = $this->lookStats($id['data']); $add = $this->lookStats($rune['data']); if (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif (isset($data['art']) && $data['tr_lvl'] < 0) { - $this->error = 'Встраивание усилений РІ артефакты ниже 10-РіРѕ СѓСЂРѕРІРЅСЏ недоступно'; + $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно'; /*}elseif(isset($data['spell_id']) && $data['spell_id'] == 6167) { - $this->error = 'Эту чарку использовать нелязя';*/ + $this->error = 'Эту чарку использовать нелязя';*/ } elseif (isset($add['onimposed'])) { - //Встраиваем магию - //Новая чарка + //Встраиваем магию + //Новая чарка $i = 0; $j = 0; $utp = explode(',', $add['onItemType']); @@ -4954,13 +4936,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Наложены чары "' . $add['onSpellName'] . '" РЅР° предмет "' . $id['name'] . '"'; + $this->error = 'Наложены чары "' . $add['onSpellName'] . '" на предмет "' . $id['name'] . '"'; } else { - $this->error = 'Предмет "' . $id['name'] . '" РЅРµ РїРѕРґС…РѕРґРёС‚ для усиления.,.'; + $this->error = 'Предмет "' . $id['name'] . '" не подходит для усиления.,.'; } } else { if (isset($data['spell']) && $data['spell'] > 0) { - //Отнимаем эффект РѕС‚ прошлых чарок + //Отнимаем эффект от прошлых чарок $litm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $id['item_id'] . '" LIMIT 1')); $data_l = $this->lookStats($litm['data']); @@ -5031,12 +5013,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } - //Новая чарка + //Новая чарка $i = 0; $utp = explode(',', $add['onItemType']); while ($i < count($utp)) { if ($utp[$i] == $id['type']) { - // Определили нужный тип оружия. + // Определили нужный тип оружия. $itm_twohand = mysql_fetch_array(mysql_query('SELECT `2h` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1')); if (isset($itm_twohand['2h']) && $itm_twohand['2h'] == 1) $tw = '2'; else $tw = ''; $j = 0; @@ -5049,12 +5031,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($add['imposed']) && $add['imposed'] != '') { $imposed = [ - 'imposed' => '1', // Активно - 'imposed_id' => $rune['id'], // ID чарки свитка - 'imposed_name' => $rune['name'], // Наименование чар, которое отображается РЅР° предмете - 'imposed_level' => $rune['level'], // Цвет подсветки заклинания РїСЂРё отображении. РџРѕ умолчанию: 0; - 'bm_a1' => $add['imposed'], // РРјСЏ файла заклинания. - 'sudba' => $this->info['login'] // Цвет подсветки заклинания РїСЂРё отображении. РџРѕ умолчанию: 0; + 'imposed' => '1', // Активно + 'imposed_id' => $rune['id'], // ID чарки свитка + 'imposed_name' => $rune['name'], // Наименование чар, которое отображается на предмете + 'imposed_level' => $rune['level'], // Цвет подсветки заклинания при отображении. По умолчанию: 0; + 'bm_a1' => $add['imposed'], // Имя файла заклинания. + 'sudba' => $this->info['login'] // Цвет подсветки заклинания при отображении. По умолчанию: 0; ]; if (isset($add['imposed_name'])) $imposed['imposed_name'] = $add['imposed_name']; if (isset($add['imposed_level'])) $imposed['imposed_level'] = $add['imposed_level']; @@ -5072,13 +5054,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Наложены чары "' . $imposed['imposed_name'] . '" РЅР° предмет "' . $id['name'] . '"'; + $this->error = 'Наложены чары "' . $imposed['imposed_name'] . '" на предмет "' . $id['name'] . '"'; } elseif (!isset($this->is[$rnda]) && $rnda != 'mib1' && $rnda != 'mib2' && $rnda != 'mib3' && $rnda != 'mib4' && $rnda != 'mab1' && $rnda != 'mab2' && $rnda != 'mab3' && $rnda != 'mab4' ) { - $this->error = 'Попробуйте зачарить предмет СЃРЅРѕРІР°. ( ' . $rnda . ' )'; + $this->error = 'Попробуйте зачарить предмет снова. ( ' . $rnda . ' )'; } else { $data['add_' . $rnda] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda]; if ($rnda == 'mab1' || $rnda == 'mab2' || $rnda == 'mab3' || $rnda == 'mab4') { @@ -5114,11 +5096,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $data = $this->impStats($data); - $this->is['mab1'] = 'Броня головы'; - $this->is['mab2'] = 'Броня РєРѕСЂРїСѓСЃР°'; - $this->is['mab3'] = 'Броня РїРѕСЏСЃР°'; - $this->is['mab4'] = 'Броня РЅРѕРі'; - $this->error = 'Увеличина характеристика предмета "' . $id['name'] . '", ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda]; + $this->is['mab1'] = 'Броня головы'; + $this->is['mab2'] = 'Броня корпуса'; + $this->is['mab3'] = 'Броня пояса'; + $this->is['mab4'] = 'Броня ног'; + $this->error = 'Увеличина характеристика предмета "' . $id['name'] . '", ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda]; unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']); @@ -5127,14 +5109,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); } } else { - $this->error = 'Что-то РЅРµ так, невозможно зачаровать данным свитком'; + $this->error = 'Что-то не так, невозможно зачаровать данным свитком'; } $i = 100499; } $i++; } if ($i < 100500) { - $this->error = 'Данный предмет РЅРµ РїРѕРґС…РѕРґРёС‚ для зачарования...'; + $this->error = 'Данный предмет не подходит для зачарования...'; } } @@ -5149,12 +5131,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.'; + $this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.'; } else { - $this->error = 'Предмет РЅРµ нуждаеться РІ ремонте...'; + $this->error = 'Предмет не нуждаеться в ремонте...'; } } else { - $this->error = 'Свиток ремонтирует только артефакты...'; + $this->error = 'Свиток ремонтирует только артефакты...'; } } elseif ($rune['type'] == 46) { $idt = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1')); @@ -5171,9 +5153,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $data['srok'] = $id['srok']; } if ($data['srok'] + $id['time_create'] - time() > 86400 + 30) { - $this->error = 'Нельзя использовать РЅР° предметы СЃ СЃСЂРѕРєРѕРј годности 30 Рё более дней.'; + $this->error = 'Нельзя использовать на предметы с сроком годности 30 и более дней.'; } elseif ($id['inslot'] > 0 && $id['inslot'] < 20) { - $this->error = 'РЎСЂРѕРє годности предмета "' . $id['name'] . '" продлен РЅР° ' . $this->timeOut($add['uptimeitem']) . '.'; + $this->error = 'Срок годности предмета "' . $id['name'] . '" продлен на ' . $this->timeOut($add['uptimeitem']) . '.'; if (isset($data['sleep_moroz'])) { unset($data['sleep_moroz']); @@ -5185,24 +5167,24 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `data` = "' . $data . '",`time_create` = `time_create` + ' . floor($add['uptimeitem']) . ' WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); } else { - $this->error = 'Предмет данного типа нельзя продлить...'; + $this->error = 'Предмет данного типа нельзя продлить...'; } } else { - $this->error = 'Это работает только РЅР° предметы СЃ СЃСЂРѕРєРѕРј годности...'; + $this->error = 'Это работает только на предметы с сроком годности...'; } } else { - $this->error = 'Затачивать можно только оружие...'; + $this->error = 'Затачивать можно только оружие...'; } } else { - //Заточка + //Заточка $data = $this->lookStats($id['data']); $add = $this->lookStats($rune['data']); if (isset($data['upatack_id'])) { - $this->error = 'Предмет уже заточен, вытащите заточку РІ Ремонтной мастерской.'; + $this->error = 'Предмет уже заточен, вытащите заточку в Ремонтной мастерской.'; } elseif (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) { - $this->error = 'Заточка РЅРµ РїРѕРґС…РѕРґРёС‚ Рє данному предмету...'; + $this->error = 'Заточка не подходит к данному предмету...'; } else { if (isset($data['upatack_id']) && $data['upatack_id'] > 0) { @@ -5226,7 +5208,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $data['upatack_lvl'] = $add['upatack']; $data['upatack_lvl'] = $add['upatack']; - //Добавляем характеристики СЂСѓРЅС‹ + //Добавляем характеристики руны $i = 0; while ($i < count($this->items['add'])) { if (isset($add['add_' . $this->items['add'][$i]])) { @@ -5238,26 +5220,26 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $data['sv_yron_min'] += $add['upatack']; $data['sv_yron_max'] += $add['upatack']; - $this->addDelo(2, $this->info['id'], '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена РІ предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']', time(), $this->info['city'], 'System.remont.upatack', 0, 0); + $this->addDelo(2, $this->info['id'], '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']', time(), $this->info['city'], 'System.remont.upatack', 0, 0); $data = $this->impStats($data); mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Заточка "' . $id['name'] . '" прошла успешно'; + $this->error = 'Заточка "' . $id['name'] . '" прошла успешно'; } } } elseif ($rune['type'] == 48) { - //Профиль + //Профиль $data = $this->lookStats($id['data']); $add = $this->lookStats($rune['data']); if ($data['tya1'] >= 90 || $data['tya2'] >= 90 || $data['tya3'] >= 90 || $data['tya4'] >= 90) { - $this->error = 'Предмет уже имеет 90 своего профиля'; + $this->error = 'Предмет уже имеет 90 своего профиля'; } elseif (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) { - $this->error = 'Заточка РЅРµ РїРѕРґС…РѕРґРёС‚ Рє данному предмету...'; + $this->error = 'Заточка не подходит к данному предмету...'; } else { if ($add['tya1'] == 1) { @@ -5291,28 +5273,28 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } - $this->addDelo(2, $this->info['id'], '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена РІ предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']', time(), $this->info['city'], 'System.remont.upatack', 0, 0); - $this->error = 'Заточка "' . $id['name'] . '" прошла успешно! Колка:' . $data['tya1'] . ' Р СѓР±:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' '; + $this->addDelo(2, $this->info['id'], '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']', time(), $this->info['city'], 'System.remont.upatack', 0, 0); + $this->error = 'Заточка "' . $id['name'] . '" прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' '; $data = $this->impStats($data); mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); } } elseif ($rune['type'] == 50) { - //Страничка саныча + //Страничка саныча if ($id['item_id'] == 3196 || $id['item_id'] == 3197 || $id['item_id'] == 3198) { if ($id['iznosNOW'] > 0) { $id['iznosNOW']--; - $this->error = 'Восстановление "' . $id['name'] . '" прошла успешно! [' . round($id['iznosNOW']) . '/' . round($id['iznosMAX']) . ']'; + $this->error = 'Восстановление "' . $id['name'] . '" прошла успешно! [' . round($id['iznosNOW']) . '/' . round($id['iznosMAX']) . ']'; mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); } else { - $this->error = 'Предмет "' . $id['name'] . '" имеет макисмальное значение прочности! [' . round($id['iznosNOW']) . '/' . round($id['iznosMAX']) . ']'; + $this->error = 'Предмет "' . $id['name'] . '" имеет макисмальное значение прочности! [' . round($id['iznosNOW']) . '/' . round($id['iznosMAX']) . ']'; } } else { - $this->error = 'Данный предмет РЅРµ РїРѕРґС…РѕРґРёС‚ для восстановления!!'; + $this->error = 'Данный предмет не подходит для восстановления!!'; } @@ -5323,13 +5305,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $id['type'] = $idt['type']; - //Встраиваем СЂСѓРЅСѓ + //Встраиваем руну $data = $this->lookStats($id['data']); $add = $this->lookStats($rune['data']); if (isset($data['nomodif'])) { - $this->error = 'Улучшить данный предмет невозможно'; + $this->error = 'Улучшить данный предмет невозможно'; } elseif (!isset($data['close']) && $data['close'] != 0) { - $this->error = 'РќРµ РїРѕРґС…РѕРґРёС‚ Рє данному предмету, РѕРЅ РЅРµ закрыт...'; + $this->error = 'Не подходит к данному предмету, он не закрыт...'; } else { $data['unopen'] = $rune['id']; $data['unopen_id'] = $rune['item_id']; @@ -5343,7 +5325,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'); - $this->error = 'Открытие "' . $id['name'] . '" прошло успешно'; + $this->error = 'Открытие "' . $id['name'] . '" прошло успешно'; } } elseif ($rune['type'] == 37) { @@ -5355,16 +5337,16 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` // if ($id['gift'] == '' || $id['gift'] == '0') { if (isset($data['notransfer'])) { - $this->error = 'Предмет нельзя передавать...'; + $this->error = 'Предмет нельзя передавать...'; } elseif (isset($data['sudba']) && $data['sudba'] != 0) { - $this->error = 'Предмет связан общей СЃСѓРґСЊР±РѕР№...'; + $this->error = 'Предмет связан общей судьбой...'; } else { if (isset($add['item_inbox']) && $add['item_inbox'] > 0) { - $this->error = 'Р’ упаковке уже что-то есть, осталось сделать подарок!'; + $this->error = 'В упаковке уже что-то есть, осталось сделать подарок!'; } elseif ($id['inTransfer'] > 0 || $id['inShop'] > 0 || $id['inGroup'] > 0) { - $this->error = 'Нельзя передать этот предмет, РѕРЅ РІ передаче, РЅР° прилавке или РІ РіСЂСѓРїРїРµ...'; + $this->error = 'Нельзя передать этот предмет, он в передаче, на прилавке или в группе...'; } else { - //Закидываем предмет РІ упаковку + //Закидываем предмет в упаковку $add['item_inbox'] = $id['id']; $add['open'] = 1; $add['nosale'] = 1; @@ -5373,23 +5355,23 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` mysql_query('UPDATE `items_users` SET `inGroup` = 0,`data` = "' . $add . '" WHERE `id` = "' . $rune['id'] . '" LIMIT 1'); mysql_query('UPDATE `items_users` SET `uid` = -1 WHERE `id` = "' . $id['id'] . '" LIMIT 1'); // - $this->error = 'Предмет "' . $idt['name'] . '" упакован РІ РєРѕСЂРѕР±РєСѓ.'; + $this->error = 'Предмет "' . $idt['name'] . '" упакован в коробку.'; // } } } else { - $this->error = 'Даренное РЅРµ дарят...'; + $this->error = 'Даренное не дарят...'; } // } else { - $this->error = 'Р’С‹ РЅРµ сможете упаковать упаковку...'; + $this->error = 'Вы не сможете упаковать упаковку...'; } } else { - $this->error = '(' . $rune['type'] . ') Усиление которое РІС‹ использовали РЅРµ найдено...'; + $this->error = '(' . $rune['type'] . ') Усиление которое вы использовали не найдено...'; } } } else { - $this->error = 'Подходящего предмета РЅРµ нашлось...'; + $this->error = 'Подходящего предмета не нашлось...'; } } @@ -5433,17 +5415,17 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $v = count($slot[9]) + count($slot[10]) + count($slot[11]); $a = count($itm) - $l - $v; if ($this->stats['silver'] == 2) { - // 3 Артефакта (1оружие Рё РІСЃРµ РєСЂРѕРјРµ ювелирки) + // 3 Артефакта (1оружие и все кроме ювелирки) if ($j > 3 || $l > 1 || $v > 0) { $r = false; } } elseif ($this->stats['silver'] == 3) { - // 6 Артефактов (1 оружие, 1 ювелирка Рё 4 вещи РЅР° выбор) + // 6 Артефактов (1 оружие, 1 ювелирка и 4 вещи на выбор) if ($j > 6 || $l > 1 || $v > 1) { $r = false; } } elseif ($this->stats['silver'] == 4) { - // 9 Артефактов (2 оружия, 2 ювелирки Рё 5 вещей РЅР° выбор) + // 9 Артефактов (2 оружия, 2 ювелирки и 5 вещей на выбор) if ($j > 9 || $l > 2 || $v > 2) { $r = false; } @@ -5460,7 +5442,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $r = $r / 100; } $r = $c['shop_type2']; - //$r = 1; //СЃРєСѓРїРєР° 100% + //$r = 1; //скупка 100% $r = round(($r / 100), 2); return $r; } @@ -5469,11 +5451,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` { global $c, $code; - $i = 0; // счетчик, просто обнуняем. - $j = 0; // Всего предметов while ++ - $k = 1; // 0 или 1 - $rt = [0 => 0, 1 => 0, 2 => '']; // Количество? Непонятно - $clr = [0 => 'c8c8c8', 1 => 'd4d4d4']; // Цвет фона для предметов + $i = 0; // счетчик, просто обнуняем. + $j = 0; // Всего предметов while ++ + $k = 1; // 0 или 1 + $rt = [0 => 0, 1 => 0, 2 => '']; // Количество? Непонятно + $clr = [0 => 'c8c8c8', 1 => 'd4d4d4']; // Цвет фона для предметов $sort = explode('ORDER BY', $sort); if (isset($sort[0], $sort[1])) { $where = $sort[0]; @@ -5500,28 +5482,28 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is1 = ''; $is2 = ''; $d = []; - //тест + //тест $d[0] = 0; $d[1] = 1; $d[2] = 0; $po = $this->lookStats($pl['data']); $see1 = 1; - if ($type == 15) { //кормушка зверя + if ($type == 15) { //кормушка зверя if ($anm['type'] == 3 && substr_count($pl['img'], 'wisp') == 0) { - $see1 = 0; //светляк + $see1 = 0; //светляк } elseif ($anm['type'] == 2 && substr_count($pl['img'], 'owl') == 0) { - $see1 = 0; //СЃРѕРІР° + $see1 = 0; //сова } elseif ($anm['type'] == 1 && substr_count($pl['img'], 'cat') == 0) { - $see1 = 0; //РєРѕС‚ + $see1 = 0; //кот } elseif ($anm['type'] == 4 && substr_count($pl['img'], 'chrt') == 0) { - $see1 = 0; //чертяка + $see1 = 0; //чертяка } elseif ($anm['type'] == 5 && substr_count($pl['img'], 'dog') == 0) { - $see1 = 0; //собака + $see1 = 0; //собака } elseif ($anm['type'] == 6 && substr_count($pl['img'], 'pig') == 0) { - $see1 = 0; //СЃРІРёРЅСЊСЏ + $see1 = 0; //свинья } elseif ($anm['type'] == 7 && substr_count($pl['img'], 'dragon') == 0) { - $see1 = 0; //дракон + $see1 = 0; //дракон } } elseif (isset($po['nosale']) && $type == 2) { $see1 = 0; @@ -5544,7 +5526,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $see1 = 0; } elseif ($type == 67 && $pl['gift'] != '') { $see1 = 0; - } elseif ($type == 11) { // Храм Знаний (плавка предметов) + } elseif ($type == 11) { // Храм Знаний (плавка предметов) if ( $pl['inTransfer'] > 0 || (!empty($po['sudba']) && $po['sudba'] != $this->info['login']) || @@ -5553,7 +5535,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` ) { $see1 = 0; } - } elseif ($type == 14) { // Храм Знаний (плавка СЂСѓРЅ) + } elseif ($type == 14) { // Храм Знаний (плавка рун) if ($pl['inTransfer'] > 0 || !in_array($pl['type'], [31, 6001, 6002, 6003])) { $see1 = 0; } @@ -5569,12 +5551,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } elseif (isset($po['musor']) && $po['musor'] > 0 && $pl['iznosNOW'] >= $pl['iznosMAX']) { $see1 = 0; } elseif ($type == 57) { - //РџРѕРґРіРѕРЅРєР° + //Подгонка if ($pl['type'] < 18 || $pl['type'] > 28 || $pl['type'] == 25) { $see1 = 0; } } elseif ($type == 58) { - //Вытаскивание СЂСѓРЅ + //Вытаскивание рун if (!isset($po['rune_id'])) { $see1 = 0; } @@ -5624,19 +5606,19 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } else { $k = 1; } - if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { //Р—РѕРЅС‹ блока + + if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { //Зоны блока + if (!isset($po['zonb'])) { $po['zonb'] = 0; } $po['zonb']++; } - //правая часть + //правая часть $mx = ''; if (isset($po['upatack_lvl'])) { $mx .= ' +' . $po['upatack_lvl']; } if (isset($po['modif'])) { - $mx .= ' (РјС„)'; + $mx .= ' (мф)'; } $col = $this->itemsX($pl['id']); if ($col > 1 && $pl['inGroup'] != 0) { @@ -5653,7 +5635,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } if (isset($po['renameadd']) && $po['renameadd'] != '') { - $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')'; + $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')'; } if (isset($po['icos'])) { $pl['name'] = '' . $pl['name'] . '  ' . $po['icos'] . ' '; @@ -5661,72 +5643,72 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is2 = '' . $pl['name'] . '' . $mx . ''; $is2 .= '  '; if ($pl['massa'] > 0) { - $is2 .= ' (Масса: ' . ($pl['massa'] * $col) . ')'; + $is2 .= ' (Масса: ' . ($pl['massa'] * $col) . ')'; } if ($pl['gift'] != '') { $ttl = ''; if ($pl['gift'] == 1) { - $ttl = 'Р’С‹ РЅРµ можете передать этот предмет РєРѕРјСѓ-либо'; + $ttl = 'Вы не можете передать этот предмет кому-либо'; } else { - $ttl = 'Этот предмет вам подарил ' . $pl['gift'] . '. Р’С‹ РЅРµ сможете передать этот предмет РєРѕРјСѓ-либо еще'; + $ttl = 'Этот предмет вам подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще'; } $is2 .= ' '; } if (isset($po['art'])) { - $is2 .= ' '; + $is2 .= ' '; } if (isset($po['sudba'])) { if ($po['sudba'] == '0') { - $is2 .= ' '; + $is2 .= ' '; } elseif ($po['sudba'] == '1') { - $is2 .= ' '; + $is2 .= ' '; } else { - $is2 .= ' '; + $is2 .= ' '; } } - if ($pl['price1'] > 0) { //цена + if ($pl['price1'] > 0) { //цена $pex = explode('.', $pl['price1']); if ($pex[1] == '00') { $pl['price1'] = $pex[0]; } if ($_GET['toRent'] == 2) { - $is2 .= '
    Цена: ' . ($pl['price1']) . ' кр.'; + $is2 .= '
    Цена: ' . ($pl['price1']) . ' кр.'; } else { - $is2 .= '
    Цена: ' . ($pl['price1'] * $col) . ' кр.'; + $is2 .= '
    Цена: ' . ($pl['price1'] * $col) . ' кр.'; } } if ($pl['pricerep'] > 0) { - $is2 .= ' (' . round($pl['pricerep'] * $col, 2) . ' Воинственности)'; + $is2 .= ' (' . round($pl['pricerep'] * $col, 2) . ' Воинственности)'; } - if ($pl['iznosMAX'] > 0) { //долговечность + if ($pl['iznosMAX'] > 0) { //долговечность $izcol = ''; if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) { $izcol = 'brown'; } if ($pl['iznosMAXi'] == 999999999) { - $is2 .= '
    Долговечность: неразрушимо'; + $is2 .= '
    Долговечность: неразрушимо'; } else { - $is2 .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . ''; + $is2 .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . ''; } } if ($po['battleUseZd'] > 0) { - $is2 .= '
    Задержка использования: ' . $this->timeOut($po['battleUseZd']) . ''; + $is2 .= '
    Задержка использования: ' . $this->timeOut($po['battleUseZd']) . ''; } if (isset($po['srok']) && $po['srok'] > 0) { $pl['srok'] = $po['srok']; } - if ($pl['srok'] > 0) { //РЎСЂРѕРє годности предмета - $is2 .= '
    РЎСЂРѕРє годности: ' . $this->timeOut($pl['srok']) . ' (РґРѕ ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')'; + if ($pl['srok'] > 0) { //Срок годности предмета + $is2 .= '
    Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')'; } if ($pl['magic_chance'] > 0) { - $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; + $is2 .= '
    Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; } - if ((int)$pl['magic_inci'] > 0) { //Продолжительность действия магии: + if ((int)$pl['magic_inci'] > 0) { //Продолжительность действия магии: $efi = mysql_fetch_array(mysql_query('SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1')); if (isset($efi['id2']) && $efi['actionTime'] > 0) { - $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); + $is2 .= '
    Продолжительность действия: ' . $this->timeOut($efi['actionTime']); } } @@ -5734,7 +5716,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($po['sudba']) && $po['sudba'] != '0' && $po['sudba'] != $this->info['login']) { $notr++; } - //Требуется минимальное: + //Требуется минимальное: $tr = ''; $t = $this->items['tr']; $x = 0; @@ -5769,7 +5751,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $notr++; } } - $tr .= '
    • '; + $tr .= '
    • '; if ($n == 'rep') { $temp = explode('::', $po['tr_' . $n]); $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0]; @@ -5777,9 +5759,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } elseif ($n != 'align' && $n != 'align_bs') { if ($n == 'sex') { if ($po['tr_' . $n] == 1) { - $tr .= $this->is[$n] . ': Женский'; + $tr .= $this->is[$n] . ': Женский'; } else { - $tr .= $this->is[$n] . ': Мужской'; + $tr .= $this->is[$n] . ': Мужской'; } } else { $tr .= $this->is[$n] . ': ' . $po['tr_' . $n]; @@ -5802,19 +5784,19 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $x++; } if ($tr != '') { - $is2 .= '
    Требуется минимальное:' . $tr; + $is2 .= '
    Требуется минимальное:' . $tr; } - //Действует РЅР°: + //Действует на: $tr = ''; $t = $this->items['add']; if (isset($po['mf_stats']) && $po['mf_stats'] > 0) { - $tr .= '
    Свободные характеристики: ' . $po['mf_stats']; + $tr .= '
    Свободные характеристики: ' . $po['mf_stats']; } if (isset($po['mf_mod']) && $po['mf_mod'] > 0) { - $tr .= '
    Свободные модификаторы: ' . $po['mf_mod']; + $tr .= '
    Свободные модификаторы: ' . $po['mf_mod']; } if (isset($po['mf_mib']) && $po['mf_mib'] > 0) { - $tr .= '
    Свободные улучшения брони: ' . $po['mf_mib']; + $tr .= '
    Свободные улучшения брони: ' . $po['mf_mib']; } $x = 0; @@ -5825,7 +5807,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($po['add_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n]; if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && ($n == 's1' || $n == 's2' || $n == 's3' || $n == 's5')) { $tr .= ' '; } @@ -5835,9 +5817,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $x++; } - //действует РЅР° (Р±СЂРѕРЅСЏ) + //действует на (броня) $i = 1; - $bn = [1 => 'головы', 2 => 'РєРѕСЂРїСѓСЃР°', 3 => 'РїРѕСЏСЃР°', 4 => 'РЅРѕРі']; + $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; while ($i <= 4) { if (isset($po['add_mab' . $i])) { if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) { @@ -5845,9 +5827,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($po['add_mab' . $i] < 0) { $z = ''; } - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i]; } else { - $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i]; + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i]; } if (isset($po['mf_mib']) && $po['mf_mib'] > 0) { $tr .= ' '; @@ -5857,13 +5839,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($tr != '') { - $is2 .= '
    Действует на:' . $tr; + $is2 .= '
    Действует на:' . $tr; } - //Свойства предмета: + //Свойства предмета: $tr = ''; $t = $this->items['sv']; if (isset($po['sv_yron_min'], $po['sv_yron_max'])) { - $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; + $tr .= '
    • Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; } $x = 0; while ($x < count($t)) { @@ -5873,18 +5855,18 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($po['sv_' . $n] < 0) { $z = ''; } - $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; + $tr .= '
    • ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n]; } $x++; } if ($pl['2too'] == 1) { - $tr .= '
    • Второе оружие'; + $tr .= '
    • Второе оружие'; } if ($pl['2h'] == 1) { - $tr .= '
    • Двуручное оружие'; + $tr .= '
    • Двуручное оружие'; } if (isset($po['zonb'])) { - $tr .= '
    • Зоны блокирования: '; + $tr .= '
    • Зоны блокирования: '; if ($po['zonb'] > 0) { $x = 1; while ($x <= $po['zonb']) { @@ -5892,11 +5874,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $x++; } } else { - $tr .= '—'; + $tr .= '—'; } } if ($tr != '') { - $is2 .= '
    Свойства предмета:' . $tr; + $is2 .= '
    Свойства предмета:' . $tr; } @@ -5913,34 +5895,34 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $d[0] = 0; $d[2] = 0; } - //Апгрейды вещей + //Апгрейды вещей $tr = ''; - //Встроенная магия + //Встроенная магия if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') { if ($pl['magic_inc'] == '') { $pl['magic_inc'] = $pl['magic_inci']; } $mgi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1')); if (isset($mgi['id2'])) { - $is2 .= '
    Встроено заклятие ' . $mgi['minfo'] . '
    '; + $is2 .= '
    Встроено заклятие ' . $mgi['minfo'] . '
    '; } } if (isset($po['rune']) && $po['rune'] > 0) { $rnc = explode(' ', $po['rune_name']); - if ($rnc[0] == 'РРіРЅРёСЃ') { + if ($rnc[0] == 'Игнис') { $rnc = '#9b5d40'; - } elseif ($rnc[0] == 'РђРєРІР°') { + } elseif ($rnc[0] == 'Аква') { $rnc = '#3a2b64'; - } elseif ($rnc[0] == 'РђСѓСЂР°') { + } elseif ($rnc[0] == 'Аура') { $rnc = '#20a3b0'; - } elseif ($rnc[0] == 'Тера') { + } elseif ($rnc[0] == 'Тера') { $rnc = '#4c7718'; } else { $rnc = '#4c4c4c'; } - $tr .= '
    • Встроенная СЂСѓРЅР°: ' . $po['rune_name'] . ''; + $tr .= '
    • Встроенная руна: ' . $po['rune_name'] . ''; unset($rnc); } @@ -5957,12 +5939,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } else { $rnc = '#d99800'; } - $po['spell_name'] = str_replace('Зачаровать ', '', $po['spell_name']); - $this->is['mab1'] = 'Броня головы'; - $this->is['mab2'] = 'Броня РєРѕСЂРїСѓСЃР°'; - $this->is['mab3'] = 'Броня РїРѕСЏСЃР°'; - $this->is['mab4'] = 'Броня РЅРѕРі'; - $tr .= '
    • Встроенно зачарование: ' . $po['spell_name'] . ' (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')'; + $po['spell_name'] = str_replace('Зачаровать ', '', $po['spell_name']); + $this->is['mab1'] = 'Броня головы'; + $this->is['mab2'] = 'Броня корпуса'; + $this->is['mab3'] = 'Броня пояса'; + $this->is['mab4'] = 'Броня ног'; + $tr .= '
    • Встроенно зачарование: ' . $po['spell_name'] . ' (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')'; unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']); unset($rnc); } @@ -5979,23 +5961,23 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } else { $rnc = '#282828'; } - $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); - $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; + $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); + $tr .= '
    Наложены заклятия: ' . $po['imposed_name'] . ' '; unset($rnc); } if ($tr != '') { - $is2 .= '
    Улучшения предмета:'; + $is2 .= '
    Улучшения предмета:'; $is2 .= $tr; } if (isset($po['free_stats']) && $po['free_stats'] > 0) { - $is2 .= '
    Распределение статов:'; - $is2 .= '
    Сила: ' . $po['add_s1'] . '
    Ловкость: ' . $po['add_s2'] . '
    Рнтуиция: ' . $po['add_s3'] . '
    Рнтеллект: ' . $po['add_s5'] . '
    '; - $is2 .= '• Осталось распределений: ' . $po['free_stats'] . ''; + $is2 .= '
    Распределение статов:'; + $is2 .= '
    Сила: ' . $po['add_s1'] . '
    Ловкость: ' . $po['add_s2'] . '
    Интуиция: ' . $po['add_s3'] . '
    Интеллект: ' . $po['add_s5'] . '
    '; + $is2 .= '• Осталось распределений: ' . $po['free_stats'] . ''; } if (isset($po['sm_abil'])) { - //Возможно сохранять Рё распределять скилы + //Возможно сохранять и распределять скилы $mx2 = 1; $mx1 = 0; $mx3 = $this->lookStats($this->info['stats']); @@ -6005,27 +5987,27 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $mx1 += $this->info['ability']; if ($mx1 > 0) { - $is2 .= '
    Распределение характеристик:'; + $is2 .= '
    Распределение характеристик:'; if (isset($po['sudba']) && $po['sudba'] == '0') { $mx1 = 0; - $is2 .= '
    • Распределение характеристик будет доступно после первого одевания
    '; + $is2 .= '
    • Распределение характеристик будет доступно после первого одевания
    '; } else { $is2 .= '
    - Сила: ' . (0 + $po['add_s1']) . '
    - Ловкость: ' . (0 + $po['add_s2']) . '
    - Рнтуиция: ' . (0 + $po['add_s3']) . '
    - Выносливость: ' . (0 + $po['add_s4']) . '
    - Рнтеллект: ' . (0 + $po['add_s5']) . '
    - Мудрость: ' . (0 + $po['add_s6']) . '
    + Сила: ' . (0 + $po['add_s1']) . '
    + Ловкость: ' . (0 + $po['add_s2']) . '
    + Интуиция: ' . (0 + $po['add_s3']) . '
    + Выносливость: ' . (0 + $po['add_s4']) . '
    + Интеллект: ' . (0 + $po['add_s5']) . '
    + Мудрость: ' . (0 + $po['add_s6']) . '
    '; - $is2 .= 'Осталось распределений: ' . $mx1; + $is2 .= 'Осталось распределений: ' . $mx1; } } unset($mx1, $mx2, $mx3); } if (isset($po['sm_skill'])) { - //Возможно сохранять Рё распределять скилы + //Возможно сохранять и распределять скилы $mx2 = 1; $mx1 = 0; $mx3 = $this->lookStats($this->info['stats']); @@ -6035,42 +6017,42 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $mx1 += $this->info['skills']; if ($mx1 > 0) { - $is2 .= '
    Распределение владений оружием и магией:'; + $is2 .= '
    Распределение владений оружием и магией:'; if (isset($po['sudba']) && $po['sudba'] == '0') { $mx1 = 0; - $is2 .= '
    • Распределение владений будет доступно после первого одевания
    '; + $is2 .= '
    • Распределение владений будет доступно после первого одевания
    '; } else { $is2 .= '
    - Мастерство владения мечами: ' . (0 + $po['add_a1']) . '
    - Мастерство владения дубинами, булавами: ' . (0 + $po['add_a2']) . '
    - Мастерство владения ножами, кастетами: ' . (0 + $po['add_a3']) . '
    - Мастерство владения топорами, секирами: ' . (0 + $po['add_a4']) . '
    - Мастерство владения магическими посохами: ' . (0 + $po['add_a5']) . '
    - Мастерство владения стихией Огня: ' . (0 + $po['add_mg1']) . '
    - Мастерство владения стихией Воздуха: ' . (0 + $po['add_mg2']) . '
    - Мастерство владения стихией Воды: ' . (0 + $po['add_mg3']) . '
    - Мастерство владения стихией Земли: ' . (0 + $po['add_mg4']) . '
    - Мастерство владения магией Света: ' . (0 + $po['add_mg5']) . '
    - Мастерство владения магией Тьмы: ' . (0 + $po['add_mg6']) . '
    - Мастерство владения серой магией: ' . (0 + $po['add_mg7']) . '
    + Мастерство владения мечами: ' . (0 + $po['add_a1']) . '
    + Мастерство владения дубинами, булавами: ' . (0 + $po['add_a2']) . '
    + Мастерство владения ножами, кастетами: ' . (0 + $po['add_a3']) . '
    + Мастерство владения топорами, секирами: ' . (0 + $po['add_a4']) . '
    + Мастерство владения магическими посохами: ' . (0 + $po['add_a5']) . '
    + Мастерство владения стихией Огня: ' . (0 + $po['add_mg1']) . '
    + Мастерство владения стихией Воздуха: ' . (0 + $po['add_mg2']) . '
    + Мастерство владения стихией Воды: ' . (0 + $po['add_mg3']) . '
    + Мастерство владения стихией Земли: ' . (0 + $po['add_mg4']) . '
    + Мастерство владения магией Света: ' . (0 + $po['add_mg5']) . '
    + Мастерство владения магией Тьмы: ' . (0 + $po['add_mg6']) . '
    + Мастерство владения серой магией: ' . (0 + $po['add_mg7']) . '
    '; - $is2 .= 'Осталось распределений: ' . $mx1; + $is2 .= 'Осталось распределений: ' . $mx1; } } unset($mx1, $mx2, $mx3); } if (isset($po['complect']) || isset($po['complect2'])) { - $is2 .= '
    Дополнительная информация:'; + $is2 .= '
    Дополнительная информация:'; } if (isset($po['complect'])) { - //РЅРµ отображается - $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; - //действие комплекта + //действие комплекта $i1c = 0; $i2c = 0; $i1e = $this->lookStats($plc['data']); @@ -6093,18 +6075,18 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` unset($i1c, $i2c, $i3c); $com1['x']++; } - $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; + $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; $is2 .= $com1['text']; $is2 .= ''; } if (isset($po['complect2'])) { - //РЅРµ отображается - $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20'); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; - //действие комплекта + //действие комплекта $i1c = 0; $i2c = 0; $i1e = $this->lookStats($plc['data']); @@ -6127,13 +6109,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` unset($i1c, $i2c, $i3c); $com1['x']++; } - $is2 .= '
    • Часть комплекта (РїРѕРґРіРѕРЅРєР°): ' . $com1['name'] . '
    '; + $is2 .= '
    • Часть комплекта (подгонка): ' . $com1['name'] . '
    '; $is2 .= $com1['text']; $is2 .= ''; } if ($pl['max_text'] > 0) { - //Рнвентарь + //Инвентарь $sm_sp = mysql_query('SELECT `id`,`item_id`,`time`,`login`,`type`,`text`,`city`,`x` FROM `items_text` WHERE `item_id` = "' . $pl['id'] . '" ORDER BY `id` ASC LIMIT 500'); $sma = 0; $smt = ''; @@ -6152,10 +6134,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $smt .= ''; if ($pl['max_text'] - $pl['use_text'] > 0) { - $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; + $is2 .= '
    Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
    '; } if ($sma > 0) { - $is2 .= '
    На предмете записан текст:
    + $is2 .= '
    На предмете записан текст:
    @@ -6166,7 +6148,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } unset($sm_sp, $sma, $sm_pl); } elseif (isset($po['onitm_text'])) { - $is2 .= '
    На предмете записан текст:
    + $is2 .= '
    На предмете записан текст:
    ' . $smt . '
    @@ -6176,13 +6158,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if (isset($po['gravi'])) { - $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; + $is2 .= '
    На поверхности выгравирована надпись: ' . $po['gravi'] . ''; } $is2 .= ''; if ($pl['info'] != '') { - $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; + $is2 .= '
    Рекомендации:
    ' . $pl['info'] . '
    '; } if (isset($po['info']) && $po['info'] != '') { @@ -6193,10 +6175,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $po['toclan1'] = explode('#', $po['toclan']); $clpo = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $po['toclan1'][0] . '" LIMIT 1')); if (isset($clpo['id'])) { - $is2 .= '
    Предмет принадлежит клану ' . $clpo['name'] . ''; + $is2 .= '
    Предмет принадлежит клану ' . $clpo['name'] . ''; $plpo = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . $po['toclan1'][1] . '" LIMIT 1')); if (isset($plpo['id'])) { - $is2 .= ' (Дар РёРіСЂРѕРєР° ' . $plpo['login'] . ')'; + $is2 .= ' (Дар игрока ' . $plpo['login'] . ')'; if ($plpo['login'] == $this->info['login']) { if (isset($_GET['backmyitm'])) { $pl['inOdet'] = 0; @@ -6205,33 +6187,33 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $pl['data'] = $this->impStats($po); mysql_query('UPDATE `items_users` SET `data` = "' . mysql_real_escape_string($pl['data']) . '",`inOdet` = 0,`uid` = "' . $pl['uid'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); } - $is2 .= '
    (Вы владелец предмета: Вернуть предмет себе)'; + $is2 .= '
    (Вы владелец предмета: Вернуть предмет себе)'; } } $is2 .= '
    '; } } if (isset($po['noremont'])) { - $is2 .= '
    Предмет не подлежит ремонту
    '; + $is2 .= '
    Предмет не подлежит ремонту
    '; } if (isset($po['nosale'])) { - $is2 .= '
    Предмет нельзя продать
    '; + $is2 .= '
    Предмет нельзя продать
    '; } if (isset($po['nomodif'])) { - $is2 .= '
    Предмет нельзя улучшать
    '; + $is2 .= '
    Предмет нельзя улучшать
    '; } if (isset($po['nodelete'])) { - $is2 .= '
    Предмет нельзя выбросить
    '; + $is2 .= '
    Предмет нельзя выбросить
    '; } if (isset($po['frompisher'])) { - $is2 .= '
    Предмет из подземелья
    '; + $is2 .= '
    Предмет из подземелья
    '; } if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) { - $is2 .= '
    Предмет не портится во время сна
    '; + $is2 .= '
    Предмет не портится во время сна
    '; } if (isset($po['fromlaba']) && $po['fromlaba'] > 0) { - $is2 .= '
    Предмет из лабиринта
    '; + $is2 .= '
    Предмет из лабиринта
    '; } if (isset($po['vip_sale']) && $po['vip_sale'] > 0) { @@ -6240,27 +6222,27 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $pl['time_create'] = $this->stats['slvtm']; mysql_query('UPDATE `items_users` SET `time_create` = "' . $pl['time_create'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); } - $is2 .= '
    Предмет будет недоступен через ' . $this->timeOut($pl['time_create'] - time()) . '
    '; + $is2 .= '
    Предмет будет недоступен через ' . $this->timeOut($pl['time_create'] - time()) . '
    '; } else { - $is2 .= '
    Предмет недоступен, приобретите конкретный VIP
    '; + $is2 .= '
    Предмет недоступен, приобретите конкретный VIP
    '; if (($pl['time_create'] - time() + 86400 * 30) < 1) { - $is2 .= '
    Предмет рассыпался у Вас на глазах...
    '; + $is2 .= '
    Предмет рассыпался у Вас на глазах...
    '; } else { - $is2 .= '
    Предмет исчезнет через ' . $this->timeOut($pl['time_create'] - time() + 86400 * 30) . '
    '; + $is2 .= '
    Предмет исчезнет через ' . $this->timeOut($pl['time_create'] - time() + 86400 * 30) . '
    '; } } } if ($pl['dn_delete'] > 0) { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; + $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; } if ($this->pokol > $pl['geni']) { - $is2 .= '
    Предмет устарел
    '; + $is2 .= '
    Предмет устарел
    '; } if (isset($po['zazuby']) && $po['zazuby'] > 0) { - $is2 .= '
    Предмет куплен за зубы
    '; + $is2 .= '
    Предмет куплен за зубы
    '; } $is2 .= '
    '; @@ -6283,18 +6265,18 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($type == 81) { - $is1 .= 'Выбрать данный предмет'; + $is1 .= 'Выбрать данный предмет'; } elseif ($type == 80) { //$this->lookStats($itm['data']); //$pl['id'] $itemrun = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` ="' . $pl['id'] . '" LIMIT 1')); $it = $this->lookStats($itemrun['data']); - if (!isset($it['rune_name']) || $_GET['otdel'] == 2) //отдел 2(заточки) + if (!isset($it['rune_name']) || $_GET['otdel'] == 2) //отдел 2(заточки) { - $is1 .= 'Выбрать данный предмет'; + $is1 .= 'Выбрать данный предмет'; } else { - $is1 .= 'Установленна:
    ' . $it['rune_name'] . '
    '; + $is1 .= 'Установленна:
    ' . $it['rune_name'] . '
    '; } unset($itemrun, $it); } elseif ($type == 69) { @@ -6306,61 +6288,61 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } $prs1 = $this->floordec($po['hprs'] * $col, 2); $rps1 = $this->floordec($po['hprp'] * $col); - $is1 .= 'Обменять на ' . $prs1 . ' кр.
    Обменять РЅР° ' . $rps1 . ' ед. репутации'; + $is1 .= 'Обменять на ' . $prs1 . ' кр.
    Обменять на ' . $rps1 . ' ед. репутации'; $is1 .= '
    '; } elseif ($type == 68) { - $is1 .= 'Забрать
    Отказаться'; + $is1 .= 'Забрать
    Отказаться'; if ($pl['lastUPD'] > 0) { $is1 .= '

    (' . $this->timeOut(($pl['lastUPD'] + 7 * 24 * 60 * 60) - time()) . ')'; } $is1 .= '
    '; } elseif ($type == 67) { - $is1 .= 'передать Р·Р° ' . (round(1 + $pl['price1'] / 100 * 7) * $col) . ' РєСЂ.'; + $is1 .= 'передать за ' . (round(1 + $pl['price1'] / 100 * 7) * $col) . ' кр.'; } elseif ($type == 66) { $pos = explode('#', $po['toclan']); $us_1 = $pos[1]; if ($pl['uid'] < 1) { - $is1 .= 'Взять предмет'; + $is1 .= 'Взять предмет'; } else { $yui = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . mysql_real_escape_string($pl['uid']) . '" LIMIT 1')); - $is1 .= 'Предмет Сѓ РёРіСЂРѕРєР°
    ' . $yui['login'] . '
    '; + $is1 .= 'Предмет у игрока
    ' . $yui['login'] . '
    '; if ($this->info['tt'][14][0] == 1 || ($this->info['id'] == $us_1)) { - $is1 .= '
    Рзъять предмет'; + $is1 .= '
    Изъять предмет'; } } } elseif ($type == 65) { if (!isset($po['toclan'])) { - $is1 .= 'Пожертвовать'; + $is1 .= 'Пожертвовать'; } else { - $is1 .= 'Вернуть'; + $is1 .= 'Вернуть'; } } elseif ($type == 62) { $upgitm = mysql_fetch_array(mysql_query('SELECT * FROM `items_upgrade` WHERE `iid` = "' . $pl['item_id'] . '" LIMIT 1')); if (!isset($upgitm['id'])) { - $is1 .= 'Улучшение невозможно'; + $is1 .= 'Улучшение невозможно'; } else { $prcup = ''; if ($upgitm['price1'] > 0) { - $prcup .= $upgitm['price1'] . ' РєСЂ.'; + $prcup .= $upgitm['price1'] . ' кр.'; } if ($upgitm['price2'] > 0) { if ($prcup != '') { - $prcup .= ' Рё '; + $prcup .= ' и '; } - $prcup .= $upgitm['price2'] . ' екр.'; + $prcup .= $upgitm['price2'] . ' екр.'; } - $is1 .= 'Улучшить Р·Р° ' . $prcup . ''; + $is1 .= 'Улучшить за ' . $prcup . ''; unset($prcup); } } elseif ($type == 63) { $prcup = ''; - $is1 .= 'комплект'; + $is1 .= 'комплект'; unset($prcup); } elseif ($type == 64) { $prcup = ''; - $is1 .= 'Выбрать РґСЂСѓРіРѕР№ предмет'; + $is1 .= 'Выбрать другой предмет'; unset($prcup); - } elseif ($type == 61) { //улучшение предмета + } elseif ($type == 61) { //улучшение предмета if ($pl['price1'] > $pl['1price']) { $pl['1price'] = $pl['price1']; } @@ -6376,8 +6358,8 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $prpod = $prpod / 2.37; } $prpod = round($prpod + $prpod / 100 * (37.795 * ($po['upgrade'] + 1))); - $is1 .= 'Усилить Р·Р° ' . $prpod . ' РєСЂ.'; - } elseif ($type == 60) { //модифицирование + $is1 .= 'Усилить за ' . $prpod . ' кр.'; + } elseif ($type == 60) { //модифицирование if ($pl['price1'] > $pl['1price']) { $pl['1price'] = $pl['price1']; } @@ -6393,24 +6375,24 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $prpod = $prpod / 2; } $prpod = round($prpod); - $is1 .= 'Модифицировать Р·Р° ' . $prpod . ' РєСЂ.'; + $is1 .= 'Модифицировать за ' . $prpod . ' кр.'; - } elseif ($type == 59) { //дезинтеграция + } elseif ($type == 59) { //дезинтеграция if ($po['tr_lvl'] > $pl['level']) { $pl['level'] = $po['tr_lvl']; } //$prpod = $pl['level']*200; $prpod = 250; $prpod_ekr = $pl['level'] * 0.25; - //$is1 .= 'Дезинтегрировать Р·Р° '.$prpod.' РєСЂ.'; + //$is1 .= 'Дезинтегрировать за '.$prpod.' кр.'; if ($this->stats['repair_z'] >= 1) { - $is1 .= 'Бесплатная дезинтеграция'; + $is1 .= 'Бесплатная дезинтеграция'; } else { - $is1 .= 'Дезинтегрировать Р·Р° ' . $prpod . ' РљСЂ. - '; + $is1 .= 'Дезинтегрировать за ' . $prpod . ' Кр. + '; } - } elseif ($type == 58) { //вытаскивание СЂСѓРЅ + } elseif ($type == 58) { //вытаскивание рун if ($po['tr_lvl'] > $pl['level']) { $pl['level'] = $po['tr_lvl']; } @@ -6418,10 +6400,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $prpod = 2500; $prpod_ekr = $pl['level'] * 0.15; if ($this->stats['repair_r'] >= 1) { - $is1 .= 'Бесплатно извлечь СЂСѓРЅС‹'; + $is1 .= 'Бесплатно извлечь руны'; } else { - $is1 .= 'Рзвлечь СЂСѓРЅС‹ Р·Р° ' . $prpod . ' РљСЂ.
    - '; } } elseif ($type == 57) { @@ -6432,19 +6414,19 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $prpod = 15; } if (isset($po['gravi'])) { - $is1 .= 'Рзменить надпись Р·Р° ' . $prpod . ' РєСЂ.'; + $is1 .= 'Изменить надпись за ' . $prpod . ' кр.'; } else { - $is1 .= 'Выгравировать надпись Р·Р° ' . $prpod . ' РєСЂ.'; + $is1 .= 'Выгравировать надпись за ' . $prpod . ' кр.'; } - } elseif ($type == 56) { //РџРѕРґРіРѕРЅРєР° + } elseif ($type == 56) { //Подгонка if ($po['tr_lvl'] > $pl['level']) { $pl['level'] = $po['tr_lvl']; } $prpod = 5 * $pl['level'] + 10; $prhp = 6 * $pl['level'] + 6; - $is1 .= 'Подогнать Р·Р° ' . $prpod . ' РєСЂ.'; - } elseif ($type == 15) { //кормушка зверя - $is1 .= 'Кормить'; + $is1 .= 'Подогнать за ' . $prpod . ' кр.'; + } elseif ($type == 15) { //кормушка зверя + $is1 .= 'Кормить'; } elseif ($type == 11) { $pl['rep'] = 0; if ($this->rep['rep1'] < 100) { @@ -6473,49 +6455,49 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $pl['rep'] = 2; } } - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 14) { - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 12) { - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 10) { - //Общага (отображение предметов РІ общаге (РїРѕРґ стеклом)) - $is1 .= 'Р’ рюкзак'; + //Общага (отображение предметов в общаге (под стеклом)) + $is1 .= 'В рюкзак'; } elseif ($type == 9) { - //Общага (отображение предметов РІ инвентаре (РїРѕРґ стеклом)) - $is1 .= 'РџРѕРґ стекло'; + //Общага (отображение предметов в инвентаре (под стеклом)) + $is1 .= 'Под стекло'; } elseif ($type == 8) { - //Общага (отображение предметов РІ инвентаре) - $is1 .= 'Р’ СЃСѓРЅРґСѓРє'; + //Общага (отображение предметов в инвентаре) + $is1 .= 'В сундук'; } elseif ($type == 7) { - //Общага (отображение предметов РІ общаге) - $is1 .= 'Р’ рюкзак'; + //Общага (отображение предметов в общаге) + $is1 .= 'В рюкзак'; } elseif ($type == 6) { - //Цветочный магазин - $is1 .= 'Добавить'; + //Цветочный магазин + $is1 .= 'Добавить'; } elseif ($type == 5) { - //передача - $is1 .= 'подарить
    передать
    (налог: 1 РєСЂ.)'; + //передача + $is1 .= 'подарить
    передать
    (налог: 1 кр.)'; } elseif ($type == 12) { - //передача почта + //передача почта $skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2); if ($skcd < 0.06) { $skcd = 0.06; } - $is1 .= 'передать Р·Р° ' . (1 + $skcd) . ' РєСЂ.'; + $is1 .= 'передать за ' . (1 + $skcd) . ' кр.'; } elseif ($type == 13) { - //Забираем шмот + //Забираем шмот if ($pl['1price'] > 0) { - $mess = "Отказаться РѕС‚ предмета? Предмет будет уничтожен!"; - $pl['name'] = 'Деньги ' . $pl['1price'] . ' РєСЂ.'; + $mess = "Отказаться от предмета? Предмет будет уничтожен!"; + $pl['name'] = 'Деньги ' . $pl['1price'] . ' кр.'; } else { - $mess = "Отказаться РѕС‚ предмета? Предмет будет возвращен отправителю"; + $mess = "Отказаться от предмета? Предмет будет возвращен отправителю"; } $date1 = $pl['delete'] - time(); - $is1 .= '
    Забрать -
    Отказаться

    (' . date("j РґРЅ. H С‡.", $date1) . ' )
    '; + $is1 .= '
    Забрать +
    Отказаться

    (' . date("j дн. H ч.", $date1) . ' )
    '; } elseif ($type == 4) { - //ремонт + //ремонт $r1 = round($pl['price1'] * 0.1 / 100, 2); $r2 = round($pl['price1'] * 0.1 / 10, 2); $r3 = round($pl['price1'] * $pl['iznosNOW'] * 0.10 / 100, 2); @@ -6535,22 +6517,22 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($r3 < 0.01) { $r3 = 0.01; } - $is1 .= 'Ремонт 1 ед. Р·Р° ' . $r1 . ' РєСЂ.
    '; + $is1 .= 'Ремонт 1 ед. за ' . $r1 . ' кр.
    '; if ($pl['iznosNOW'] >= 10) { - $is1 .= 'Ремонт 10 ед. за ' . $r2 . ' кр.
    '; + $is1 .= 'Ремонт 10 ед. за ' . $r2 . ' кр.
    '; } - $is1 .= 'Полный ремонт за ' . $r3 . ' кр.
    '; + $is1 .= 'Полный ремонт за ' . $r3 . ' кр.
    '; if ($c['zuby'] == true) { if ($this->info['level'] < 8) { - $is1 .= '
    Ремонт 1 ед. за ' . $this->zuby($r1) . '
    '; + $is1 .= '
    Ремонт 1 ед. за ' . $this->zuby($r1) . '
    '; if ($pl['iznosNOW'] >= 10) { - $is1 .= 'Ремонт 10 ед. за ' . $this->zuby($r2) . '
    '; + $is1 .= 'Ремонт 10 ед. за ' . $this->zuby($r2) . '
    '; } - $is1 .= 'Полный ремонт за ' . $this->zuby($r3) . '
    '; + $is1 .= 'Полный ремонт за ' . $this->zuby($r3) . '
    '; } } } elseif ($type == 3) { - $is1 .= ''; + $is1 .= ''; } elseif ($type == 2) { global $shopProcent; $shpCena = $pl['1price']; @@ -6593,13 +6575,13 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } else { $d_s = true; } - if ($d_s == true) { // Продать Р·Р° РєСЂ тут - $is1 .= 'Продать Р·Р° ' . $shpCena . ' РєСЂ.'; + if ($d_s == true) { // Продать за кр тут + $is1 .= 'Продать за ' . $shpCena . ' кр.'; if ($pl['pricerep'] > 0) { - $is1 .= '
    Обменять на ' . floor($pl['pricerep'] * $pl['kolvo'] / 2) . ' Воинc. '; + $is1 .= '
    Обменять на ' . floor($pl['pricerep'] * $pl['kolvo'] / 2) . ' Воинc. '; } } else { - $is1 .= 'Это РЅРµ ваш предмет.'; + $is1 .= 'Это не ваш предмет.'; } } elseif ($type == 16) { $shpCena = $pl['price2']; @@ -6625,11 +6607,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > $pl['iznosMAX']) { $shpCena = $shpCena / 100 * ($pl['iznosMAX'] / $pl['iznosMAXi'] * 100); } - //$shpCena = $this->round2($shpCena*0.5); // Цена предметов + //$shpCena = $this->round2($shpCena*0.5); // Цена предметов if (isset($po['art'])) { - $shpCena = $this->round2($shpCena * $this->berezCena()); // Цена арта + $shpCena = $this->round2($shpCena * $this->berezCena()); // Цена арта } else { - $shpCena = $this->round2($shpCena * $this->berezCena()); // Цена + $shpCena = $this->round2($shpCena * $this->berezCena()); // Цена } if ($shpCena < 0) { $shpCena = 0; @@ -6646,9 +6628,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $d_s = true; } if ($d_s == true) { - $is1 .= 'Продать Р·Р° ' . $shpCena . ' екр.'; + $is1 .= 'Продать за ' . $shpCena . ' екр.'; } else { - $is1 .= 'Это РЅРµ ваш предмет.'; + $is1 .= 'Это не ваш предмет.'; } } elseif ($type == 30) { if (isset($po['toclan'])) { @@ -6663,40 +6645,40 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $d_s = true; } if ($d_s == true) { - $is1 .= '
    '; + $is1 .= '
    '; } else { - $is1 .= 'Это РЅРµ ваш предмет.'; + $is1 .= 'Это не ваш предмет.'; } } elseif ($type == 31) { - $is1 .= '
    '; + $is1 .= '
    '; } else { - if ($d[2] == 1) { //можно использовать + if ($d[2] == 1) { //можно использовать $inv1 = ''; if (isset($_GET['inv'])) { $inv1 = 'inv=1&'; } if ($pl['item_id'] == 74) { - $is1 .= 'РёСЃРї-ть'; + $is1 .= 'исп-ть'; } else { $useUrl = ''; if ($pl['magic_inc'] == '') { $pl['magic_inc'] = $pl['magic_inci']; } if ($pl['magic_inc'] && $pl['type'] == 30) { - //используем эликсир - $pldate = '
    ' . $po['onitm_text'] . '
    "' . $pl['name'] . '"
    Рспользовать сейчас?
    '; + //используем эликсир + $pldate = '
    "' . $pl['name'] . '"
    Использовать сейчас?
    '; $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; - } elseif ($pl['magic_inc'] && $pl['type'] == 29) { //используем заклятие - if (isset($po['useOnLogin']) && !isset($po['zazuby'])) { //РЅР° персонажа + } elseif ($pl['magic_inc'] && $pl['type'] == 29) { //используем заклятие + if (isset($po['useOnLogin']) && !isset($po['zazuby'])) { //на персонажа $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'otdel=' . ((int)$_GET['otdel']) . '&use_pid=' . $pl['id'] . '&rnd=' . $code . '\');'; - } else { //просто использование (РЅР° себя, либо без указания предмета\логина) - $pldate = '
    "' . $pl['name'] . '"
    Рспользовать сейчас?
    '; + } else { //просто использование (на себя, либо без указания предмета\логина) + $pldate = '
    "' . $pl['name'] . '"
    Использовать сейчас?
    '; $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\',' . (0 + $_GET['otdel']) . ');'; } - //РЅР° предмет + //на предмет } if ($useUrl != '') { - $is1 .= 'РёСЃРї-ть'; + $is1 .= 'исп-ть'; } else { $d[2] = 0; } @@ -6704,46 +6686,46 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) { - $is1 .= 'Записать
    '; + $is1 .= 'Записать
    '; } if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) { if ($d[2] == 1) { $is1 .= '
    '; } if (($pl['type'] != 37 || !isset($po['item_inbox']) || $po['item_inbox'] == 0) && $pl['item_id'] != 10038 && $pl['item_id'] != 10039 && $pl['item_id'] != 10040) { - $is1 .= 'РёСЃРї-ть'; + $is1 .= 'исп-ть'; } } - if ($d[0] == 1 && $pl['type'] != 30 && $pl['type'] != 31 && (($pl['type'] != 38 && $pl['type'] != 39 && $pl['type'] != 37) || $pl['gift'] != '')) {//можно одеть + if ($d[0] == 1 && $pl['type'] != 30 && $pl['type'] != 31 && (($pl['type'] != 38 && $pl['type'] != 39 && $pl['type'] != 37) || $pl['gift'] != '')) {//можно одеть if (!isset($po['noodet']) && $pl['inslot'] > 0) { if ($d[2] == 1) { $is1 .= '
    '; } - $is1 .= 'надеть'; + $is1 .= 'надеть'; } } if (isset($po['open']) && $d[0] == 1) { if ($d[2] == 1) { $is1 .= '
    '; } - $is1 .= 'Открыть'; + $is1 .= 'Открыть'; } if (isset($po['close'])) { if ($d[2] == 1) { $is1 .= '
    '; } - $is1 .= 'Предмет закрыт'; + $is1 .= 'Предмет закрыт'; } if ($pl['group'] > 0) { $is1 .= '
    '; if ($this->itemsX($pl['id']) < $pl['group_max']) { - $is1 .= ''; + $is1 .= ''; } if ($this->itemsX($pl['id']) > 1) { $is1 .= ' ' . $script; + onClick="top.unstack(' . $pl['id'] . ',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'
    Разделить предмет ' . $pl['name'] . '?
    \',\'' . intval($_GET['otdel']) . '\'); return false;" + href="main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&unstack=' . $pl['id'] . '&rnd=' . $code . '" title="Разделить">' . $script; } } if (isset($po['toclan'])) { @@ -6754,17 +6736,17 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } - $is1 .= ' '; + $is1 .= ' '; - if ($d[1] == 1) { //можно выкинуть + if ($d[1] == 1) { //можно выкинуть if (!isset($po['nodelete'])) { - $is1 .= ' '; + $is1 .= ' '; } - //$is1 .= ' '; + //$is1 .= ' '; } } - //собираем РІСЃРµ РІ РѕРґРЅРѕ (: + //собираем все в одно (: $rt[2] .= '
    ' . $is1 . '
    ' . $is2 . '
    '; $rt[1] += $pl['massa']; $i++; @@ -6791,7 +6773,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } private function stackGroupCheck($uid, $group, $item) - { // Находит неиспользованный ID РіСЂСѓРїРїС‹ предметов. + { // Находит неиспользованный ID группы предметов. $g = 0; $i = 0; do { @@ -6817,15 +6799,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id AND `iuu`.inShop = 0) WHERE `iu`.`id` = "' . mysql_real_escape_string((int)$id) . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iuu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT 1')); - if (isset($itm['id']) && $itm['iznosNOW'] == 0) { //группируем похожие свободные предметы СЃ этим - // создаем РіСЂСѓРїРїСѓ - if ($itm['inGroup'] == 0) { // Если предмет РЅРµ РІ РіСЂСѓРїРїРµ, собираем РІСЃРµ похожие предметы РїРѕ группам. + if (isset($itm['id']) && $itm['iznosNOW'] == 0) { //группируем похожие свободные предметы с этим + // создаем группу + if ($itm['inGroup'] == 0) { // Если предмет не в группе, собираем все похожие предметы по группам. $items = mysql_num_rows(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"')); $items = ceil($items / $itm['group_max']); - } else { // Добираем предметы РІ РіСЂСѓРїРїСѓ РґРѕ полного количества, РёР· предметов СЃ inGroup == 0 - $curG = mysql_num_rows(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $itm['inGroup'] . '" AND `iu`.item_id="' . $itm['item_id'] . '"')); // Текущее количество предметов РІ выбранной РіСЂСѓРїРїРµ - $curNG = mysql_num_rows(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"')); // Текущее количество предметов которые без РіСЂСѓРїРїС‹ - $needG = $itm['group_max'] - $curG; // Задаем требуемое количество для РґРѕР±РѕСЂР°, если нужно больше 0 Рё требуемое количество меньше + } else { // Добираем предметы в группу до полного количества, из предметов с inGroup == 0 + $curG = mysql_num_rows(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $itm['inGroup'] . '" AND `iu`.item_id="' . $itm['item_id'] . '"')); // Текущее количество предметов в выбранной группе + $curNG = mysql_num_rows(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"')); // Текущее количество предметов которые без группы + $needG = $itm['group_max'] - $curG; // Задаем требуемое количество для добора, если нужно больше 0 и требуемое количество меньше if ($needG > 0 and $curNG == 0) { $curItem = mysql_fetch_array(mysql_query('SELECT `iu`.id, `iu`.inGroup, count(`iu`.inGroup) as itemsInGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`inGroup`!="' . $itm['inGroup'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.item_id="' . $itm['item_id'] . '" GROUP BY `iu`.inGroup HAVING itemsInGroup <= "' . $needG . '" ORDER BY itemsInGroup DESC LIMIT 1')); @@ -6875,7 +6857,7 @@ ORDER BY `iu`.lastUPD DESC LIMIT 1')); if (isset($itm['id']) && $itm['inGroup'] > 0 && $itm['inGroupCount'] > 0) { if ($x == 0 or $x == null) { - $x = $this->itemsX($itm['id']); //РєРѕР»-РІРѕ распада + $x = $this->itemsX($itm['id']); //кол-во распада $inGroup = 0; } elseif ($x != 0) { $inGroup = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']); @@ -6945,7 +6927,7 @@ LIMIT 1')); } if (isset($u['id'])) { $snIt = 0; - //Проверяем одетые вещи Рё вещи СЃ СЃСЂРѕРєРѕРј годности + //Проверяем одетые вещи и вещи с сроком годности $cl = mysql_query('SELECT `iu`.`id` AS `iduid`, `iu`.`time_sleep`,`im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`, @@ -6955,7 +6937,7 @@ LIMIT 1')); $po = []; $po = $this->lookStats($itm['data']); $po['lvl'] = $u['level']; - //проверяем требования + //проверяем требования $t = $this->items['tr']; $x = 0; $notr = 0; @@ -6980,11 +6962,11 @@ LIMIT 1')); $x++; } if ($this->info['twink'] > 0) { - //РќРµ дороже 100 екр. + //Не дороже 100 екр. if ($itm['price2'] > 1 || $itm['2price'] > 1) { $notr++; } - //Нельзя СЂСѓРЅС‹ + чарки + //Нельзя руны + чарки if (isset($po['rune']) && $po['rune'] > 0) { $notr++; } @@ -6998,7 +6980,7 @@ LIMIT 1')); mysql_query('UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'); } if (isset($po['zazuby']) && !isset($po['srok']) && ($itm['type'] == 29 || $itm['type'] == 30 || $itm['type'] == 36 || $itm['type'] == 49 || $itm['type'] == 46 || $itm['type'] == 34)) { - //Предметы Р·Р° Р·СѓР±С‹ СЃРѕ СЃСЂРѕРєРѕРј годности + //Предметы за зубы со сроком годности $po['srok'] = 86400 * 7; $itm['data'] = $this->impStats($po); mysql_query('UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'); @@ -7019,13 +7001,13 @@ LIMIT 1')); $notr++; } if ($notr > 0 && $itm['inOdet'] != 0) { - //снимаем предмет + //снимаем предмет $this->snatItem($itm['id'], $u['id']); $snIt++; } - //проверяем СЃСЂРѕРє годности + //проверяем срок годности if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) { - //предмет сломался + //предмет сломался if (isset($po['musor'])) { if ($po['musor'] > 0) { $this->recr($itm['id'], $itm['type'], $u['id'], (int)$po['musor']); @@ -7037,7 +7019,7 @@ LIMIT 1')); $this->snatItem($itm['id'], $u['id']); $snIt++; } - //удаляем предмет + //удаляем предмет if ($itm['item_id'] == 4704) { $po['musor2'] = 4708; } @@ -7067,9 +7049,9 @@ LIMIT 1')); } $upd = mysql_query('UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1'); if ($upd) { - $this->addDelo(2, $uid, '"System.inventory": Предмет [itm:' . $it . '] был сломан.', time(), $this->info['city'], 'System.inventory', 0, 0); + $this->addDelo(2, $uid, '"System.inventory": Предмет [itm:' . $it . '] был сломан.', time(), $this->info['city'], 'System.inventory', 0, 0); if ($id2 > 1) { - //Добавляем пустую бутылку + //Добавляем пустую бутылку $this->addItem($id2, $uid, 'noodet=1|noremont=1'); } } @@ -7090,9 +7072,9 @@ LIMIT 1')); $upd = mysql_query('UPDATE `items_users` SET `delete`="' . time() . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'); if ($upd) { $upd = mysql_query('UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time() . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''); - $this->addDelo(2, $uid, '"System.inventory": Предмет ' . $name . ' [itm:' . $it . '] был испорчен.', time(), $this->info['city'], 'System.inventory', 0, 0); + $this->addDelo(2, $uid, '"System.inventory": Предмет ' . $name . ' [itm:' . $it . '] был испорчен.', time(), $this->info['city'], 'System.inventory', 0, 0); if ($tp != 0) { - //Добавляем испорченый предмет РІ инвентарь, РІ зависимости РѕС‚ типа + //Добавляем испорченый предмет в инвентарь, в зависимости от типа $zzba = ''; if ($zub > 0) { $zzba = '|zazuby=1'; @@ -7106,7 +7088,7 @@ LIMIT 1')); } } else { if ($type == 30) { - //испорченный эликсир + //испорченный эликсир $this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba); } } @@ -7121,7 +7103,7 @@ LIMIT 1')); $i = 1; $sv = []; while ($i <= 10) { - $sv[$i] = ''; + $sv[$i] = ''; $i++; } $i = 0; @@ -7138,7 +7120,7 @@ LIMIT 1')); } $vl = 'style="cursor:pointer" onclick="' . $useUrl . '"'; } - $sv[$this->stats['items'][$i]['inOdet'] - 39] = ''; + $sv[$this->stats['items'][$i]['inOdet'] - 39] = ''; } $i++; } @@ -7170,18 +7152,18 @@ LIMIT 1')); //if( $this->info['admin'] > 0 ) { if (isset($po['rune']) && $po['rune'] > 0) { $rnc = explode(' ', $po['rune_name']); - if ($rnc[0] == 'РРіРЅРёСЃ') { + if ($rnc[0] == 'Игнис') { $rnc = '#9b5d40'; - } elseif ($rnc[0] == 'РђРєРІР°') { + } elseif ($rnc[0] == 'Аква') { $rnc = '#3a2b64'; - } elseif ($rnc[0] == 'РђСѓСЂР°') { + } elseif ($rnc[0] == 'Аура') { $rnc = '#20a3b0'; - } elseif ($rnc[0] == 'Тера') { + } elseif ($rnc[0] == 'Тера') { $rnc = '#4c7718'; } else { $rnc = '#4c4c4c'; } - $r .= '
    Р СѓРЅР°: ' . $po['rune_name'] . ''; + $r .= '
    Руна: ' . $po['rune_name'] . ''; unset($rnc); } if (isset($po['spell'])) { @@ -7209,7 +7191,7 @@ LIMIT 1')); $td = $this->lookStats($pl['data']); if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) { - $lvar .= '
    РЈСЂРѕРЅ: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . ''; + $lvar .= '
    Урон: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . ''; } if (isset($td['add_mab1']) && $td['add_mab1'] > 0) { if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { @@ -7217,9 +7199,9 @@ LIMIT 1')); if ($td['add_mab1'] < 0) { $m1l = ''; } - $lvar .= '
    Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; + $lvar .= '
    Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; } else { - $lvar .= '
    Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; + $lvar .= '
    Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; } } // @@ -7252,10 +7234,10 @@ LIMIT 1')); $x++; } if ($pl['2h'] == 1) { - $lvar .= '
    • Двуручное оружие'; + $lvar .= '
    • Двуручное оружие'; } if (isset($po['zonb'])) { - $lvar .= '
    Зоны блокирования: '; + $lvar .= '
    Зоны блокирования: '; if ($lvar['zonb'] > 0) { $x = 1; while ($x <= $td['zonb']) { @@ -7263,7 +7245,7 @@ LIMIT 1')); $x++; } } else { - $lvar .= '—'; + $lvar .= '—'; } } @@ -7274,9 +7256,9 @@ LIMIT 1')); if ($td['add_mab2'] < 0) { $m1l = ''; } - $lvar .= '
    Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; + $lvar .= '
    Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; } else { - $lvar .= '
    Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; + $lvar .= '
    Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; } } if (isset($td['add_mab3']) && $td['add_mab3'] > 0) { @@ -7285,9 +7267,9 @@ LIMIT 1')); if ($td['add_mab3'] < 0) { $m1l = ''; } - $lvar .= '
    Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; + $lvar .= '
    Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; } else { - $lvar .= '
    Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; + $lvar .= '
    Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; } } if (isset($td['add_mab4']) && $td['add_mab4'] > 0) { @@ -7296,17 +7278,17 @@ LIMIT 1')); if ($td['add_mab4'] < 0) { $m1l = ''; } - $lvar .= '
    Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; + $lvar .= '
    Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; } else { - $lvar .= '
    Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; + $lvar .= '
    Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; } } if ($pl['iznosMAX'] > 0) { - $lvar .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']); + $lvar .= '
    Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']); } if ($po['battleUseZd'] > 0) { - $lvar .= '
    Задержка использования: ' . $this->timeOut($po['battleUseZd']) . ''; + $lvar .= '
    Задержка использования: ' . $this->timeOut($po['battleUseZd']) . ''; } if (isset($td['gravi'])) { @@ -7354,8 +7336,8 @@ LIMIT 1')); 10 => 13, 9 => 14, 8 => 15, - 11 => 17, //кольцо 2 - 12 => 18 //кольцо 3 + 11 => 17, //кольцо 2 + 12 => 18 //кольцо 3 ]; if (isset($u['id'], $u['stats'])) { @@ -7368,29 +7350,29 @@ LIMIT 1')); $st['login'] = $u['login']; $st['lvl'] = $u['level']; - //Характеристики РѕС‚ предметов Рё РёС… изображение + //Характеристики от предметов и их изображение $witm = []; - $witm[1] = ''; - $witm[2] = ''; - $witm[3] = ''; - $witm[4] = ''; - $witm[7] = ''; - $witm[8] = ''; - $witm[9] = ''; - $witm[10] = ''; - $witm[11] = ''; - $witm[12] = ''; - $witm[13] = ''; - $witm[14] = ''; - $witm[16] = ''; - $witm[17] = ''; - //40-52 слот РїРѕРґ магию - $witm[53] = ''; - $witm[54] = ''; - $witm[55] = ''; - $witm[56] = ''; - $witm[57] = ''; - $witm[58] = ''; + $witm[1] = ''; + $witm[2] = ''; + $witm[3] = ''; + $witm[4] = ''; + $witm[7] = ''; + $witm[8] = ''; + $witm[9] = ''; + $witm[10] = ''; + $witm[11] = ''; + $witm[12] = ''; + $witm[13] = ''; + $witm[14] = ''; + $witm[16] = ''; + $witm[17] = ''; + //40-52 слот под магию + $witm[53] = ''; + $witm[54] = ''; + $witm[55] = ''; + $witm[56] = ''; + $witm[57] = ''; + $witm[58] = ''; $cl = mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`, `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` @@ -7402,7 +7384,7 @@ LIMIT 1')); $td = $this->lookStats($pl['data']); if (isset($td['modif'])) { - $pl['name'] = $pl['name'] . ' (РјС„)'; + $pl['name'] = $pl['name'] . ' (мф)'; } if (isset($td['upatack_lvl'])) { @@ -7438,12 +7420,12 @@ LIMIT 1')); $pl['magic_inc'] = $pl['magic_inci']; } if ($pl['magic_inc'] && $pl['type'] == 30) { - //используем эликсир - $pldate = '
    "' . $pl['name'] . '"
    Рспользовать сейчас?
    '; + //используем эликсир + $pldate = '
    "' . $pl['name'] . '"
    Использовать сейчас?
    '; $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; } elseif ($pl['magic_inc'] && $pl['type'] == 29) { - //используем заклятие - //РЅР° персонажа + //используем заклятие + //на персонажа if (isset($td['useOnLogin'])) { $inv1 = ''; if (isset($_GET['inv'])) { @@ -7451,21 +7433,21 @@ LIMIT 1')); } $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');'; } else { - //просто использование (РЅР° селя, либо без указания предмета\логина) - $pldate = '
    "' . $pl['name'] . '"
    Рспользовать сейчас?
    '; + //просто использование (на селя, либо без указания предмета\логина) + $pldate = '
    "' . $pl['name'] . '"
    Использовать сейчас?
    '; $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; } } $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) { - //варежки + //варежки $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; } else { $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; } } } - //Шлем,Венок + //Шлем,Венок $wj1i = ''; $br = '
    '; if ($wj[1] != false) { @@ -7490,7 +7472,7 @@ LIMIT 1')); $wj[1]['id'] = $wj[52]['id']; $wj[1]['inRazdel'] = $wj[52]['inRazdel']; } - //Рубаха,Броня,Плащ + //Рубаха,Броня,Плащ $wj4idd = $wj[5]['item_id']; $wj4i = ''; if ($wj[6] != false) { @@ -7570,7 +7552,7 @@ LIMIT 1')); $witm[4] = '' . $witm[4] . ''; } } - /*------------ ГЕНЕРРРУЕМ РРќР¤. Рћ ПЕРСОНАЖЕ ---------------*/ + /*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/ $nmmsgl1 = 0; if ($u['align'] >= 1 && $u['align'] < 2) { $nmmsgl1 = 1; @@ -7594,13 +7576,13 @@ LIMIT 1')); 7 => 'dragon' ]; $anan2 = [ - 1 => 'РљРѕС‚', - 2 => 'РЎРѕРІР°', - 3 => 'Светляк', - 4 => 'Чертяка', - 5 => 'Пёс', - 6 => 'РЎРІРёРЅ', - 7 => 'Дракон' + 1 => 'Кот', + 2 => 'Сова', + 3 => 'Светляк', + 4 => 'Чертяка', + 5 => 'Пёс', + 6 => 'Свин', + 7 => 'Дракон' ]; $anml = ''; if ($u['animal'] > 0) { @@ -7608,9 +7590,9 @@ LIMIT 1')); if (isset($an['id'])) { $petimg = mysql_fetch_array(mysql_query('SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1')); if (isset($petimg['id'])) { - $anml = ''; + $anml = ''; } else { - $anml = ''; + $anml = ''; } } } @@ -7630,7 +7612,7 @@ LIMIT 1')); $oi = ''; if ($i1 != 1) { $jf = 'main'; - $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти РІ "Рнвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"'; + $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"'; $msl = ' @@ -7646,7 +7628,7 @@ LIMIT 1')); } $hpmp = ''; $eff = ''; - //-------- генерируем эффекты + //-------- генерируем эффекты $efs = mysql_query('SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`tr_life_user`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`, `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` @@ -7669,23 +7651,23 @@ LIMIT 1')); if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) { $ei = '' . $e['name'] . ''; if ($e['type1'] > 0 && $e['type1'] < 7) { - $ei .= ' (Эликсир)'; + $ei .= ' (Эликсир)'; } elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) { - $ei .= ' (Заклятие)'; + $ei .= ' (Заклятие)'; } elseif ($e['type1'] == 14) { - $ei .= ' (Прием)'; + $ei .= ' (Прием)'; } elseif ($e['type1'] == 15) { - $ei .= ' (Рзучение)'; + $ei .= ' (Изучение)'; } elseif ($e['type1'] == 17) { - $ei .= ' (Проклятие)'; + $ei .= ' (Проклятие)'; } elseif ($e['type1'] == 18 || $e['type1'] == 19) { - $ei .= ' (Травма)'; + $ei .= ' (Травма)'; } elseif ($e['type1'] == 20) { - $ei .= ' (Пристрастие)'; + $ei .= ' (Пристрастие)'; } elseif ($e['type1'] == 22) { - $ei .= ' (Ожидание)'; + $ei .= ' (Ожидание)'; } else { - $ei .= ' (Эффект)'; + $ei .= ' (Эффект)'; } $ei .= '
    '; @@ -7697,7 +7679,7 @@ LIMIT 1')); if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " мес. "; + $out .= $tmp . " мес. "; } $time_still = $time_still - $tmp * 2592000; } @@ -7705,7 +7687,7 @@ LIMIT 1')); if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " нед. "; + $out .= $tmp . " нед. "; } $time_still = $time_still - $tmp * 604800; } @@ -7713,7 +7695,7 @@ LIMIT 1')); if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " РґРЅ. "; + $out .= $tmp . " дн. "; } $time_still = $time_still - $tmp * 86400; } @@ -7721,7 +7703,7 @@ LIMIT 1')); if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " С‡. "; + $out .= $tmp . " ч. "; } $time_still = $time_still - $tmp * 3600; } @@ -7729,16 +7711,16 @@ LIMIT 1')); if ($tmp > 0) { $id++; if ($id < 3) { - $out .= $tmp . " РјРёРЅ. "; + $out .= $tmp . " мин. "; } } if ($out == '') { - $out = $time_still . ' сек.'; + $out = $time_still . ' сек.'; } - $ei .= 'Осталось: ' . $out . ''; + $ei .= 'Осталось: ' . $out . ''; } - //Действие эффекта + //Действие эффекта $tr = ''; $t = $this->items['add']; $x = 0; @@ -7758,7 +7740,7 @@ LIMIT 1')); $ei .= $tr; } if ($e['info'] != '') { - $ei .= '
    Рнформация:
    ' . $e['info']; + $ei .= '
    Информация:
    ' . $e['info']; } if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') { $e['img'] = $e['img2']; @@ -7768,7 +7750,7 @@ LIMIT 1')); } $eff .= ''; } elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) { - //удаляем эффект + //удаляем эффект $ed = $this->lookStats($e['data']); if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) { $this->endEffect($e['id'], $u); @@ -7776,7 +7758,7 @@ LIMIT 1')); } } - //Р·РґРѕСЂРѕРІСЊРµ + //здоровье if ($type_info == 1) { $hptop = 0; $lh = [0 => 'hp_none', 1 => 1]; @@ -7791,24 +7773,24 @@ LIMIT 1')); $lh[0] = 'hp_3'; } if ($sn['mpAll'] > 0) { - //мана + //мана $lm = [0 => 'hp_none', 1 => 1]; $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120); if ($lm[1] > 0) { $lm[0] = 'hp_mp'; } - $hpmp .= '
    ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
    -
    + $hpmp .= '
    ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
    +
    -
    '; +
    '; } else { $hptop = 5; } - $hpmp = '
    ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
    -
    + $hpmp = '
    ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
    +
    -
    ' . $hpmp; - //Собираем НР и МР +
    ' . $hpmp; + //Собираем НР и МР $hpmp = '
    ' . $hpmp . '
    '; } elseif ($type_info == 2) { $hptop = 0; @@ -7825,24 +7807,24 @@ LIMIT 1')); } if ($sn['mpAll'] > 0) { - //мана + //мана $lm = [0 => 'hp_none', 1 => 1]; $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 200); if ($lm[1] > 0) { $lm[0] = 'hp_mp'; } - $hpmp .= '
    ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
    -
    + $hpmp .= '
    ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
    +
    -
    '; +
    '; } else { $hptop = 5; } - $hpmp = '
    ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
    -
    + $hpmp = '
    ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
    +
    -
    ' . $hpmp; - //Собираем НР и МР +
    ' . $hpmp; + //Собираем НР и МР $hpmp = '
    ' . $hpmp . '
    '; } @@ -7860,30 +7842,30 @@ LIMIT 1')); } $pb = ''; if ($u['banned'] > 0) { - $pb .= '
    Персонаж заблокирован
    '; + $pb .= '
    Персонаж заблокирован
    '; } if ($u['allLock'] > time()) { - $pb .= '
    Временный запрет передач!
    '; + $pb .= '
    Временный запрет передач!
    '; } - $swm = 0; //свитки магии + $swm = 0; //свитки магии $l = 40; while ($l <= 52) { if (isset($witm[$l])) { $swm++; } else { - $witm[$l] = ''; + $witm[$l] = ''; } $l++; } - $ssm = 0; //слоты СЃСѓРјРєРё + $ssm = 0; //слоты сумки $l = 59; while ($l <= 62) { if (isset($witm[$l])) { $ssm++; } else { - $witm[$l] = ''; + $witm[$l] = ''; } $l++; } @@ -7977,36 +7959,36 @@ LIMIT 1')); if ($zag == '') { if ($i1 == 0) { if (!isset($_GET['inv'])) { - $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; + $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; } else { - $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; + $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; } } else { $o = mysql_fetch_array(mysql_query('SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string($this->info['obraz']) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1')); - $invg = [0 => 'https://new-combats.com/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов']; + $invg = [0 => 'https://new-combats.com/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов']; } $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . ''; if (isset($sn['items_img'][1])) { $uobr = 'rimg/r' . $sn['items_img'][1]; } $rt[0] .= '
    - -
    + +
    ' . $eff . '
    ' . $anml . '
    '; } else { if ($i1 == 0) { if (!isset($_GET['inv'])) { - $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; + $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; } else { - $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; + $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; } } else { - $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов']; + $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов']; } $rt[0] .= '
    - -
    + +
    ' . $eff . '
    ' . $anml . '
    '; } @@ -8096,12 +8078,12 @@ LIMIT 1')); if ($zag == '') { if ($i1 == 0) { if (!isset($_GET['inv'])) { - $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; + $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; } else { - $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; + $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; } } else { - $invg = [0 => 'https://lib.new-combats.com/obraz.php?name=' . $u['obraz'] . '" target="_blank', 1 => 'Галерея образов']; + $invg = [0 => 'https://lib.new-combats.com/obraz.php?name=' . $u['obraz'] . '" target="_blank', 1 => 'Галерея образов']; } $u['obraz'] = '0.gif'; $uobr = 'i/obraz/' . $u['sex'] . '/old/' . $u['obraz'] . ''; @@ -8109,8 +8091,8 @@ LIMIT 1')); $uobr = 'rimg/r' . $sn['items_img'][1]; } $rt[0] .= '
    - -
    + +
    ' . $eff . '
    ' . $anml . '
    '; } @@ -8165,8 +8147,8 @@ LIMIT 1')); if (isset($e['id'])) { $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1); if ($e['id_eff'] == 2) { - //Проверка - $ev = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(str_replace('Рзучение: ', '', $e['name'])) . '" LIMIT 1')); + //Проверка + $ev = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(str_replace('Изучение: ', '', $e['name'])) . '" LIMIT 1')); $et = mysql_fetch_array(mysql_query('SELECT `id` FROM `actions` WHERE `uid` = "' . $e['uid'] . '" AND `vars` LIKE "%read%" AND `vals` = "' . $ev['id'] . '" LIMIT 1')); if (isset($et['id'])) { if ($et['time'] < time()) { @@ -8193,7 +8175,7 @@ LIMIT 1')); } } if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) { - $text = 'Закончилось действие эффекта "' . $e['name'] . '"'; + $text = 'Закончилось действие эффекта "' . $e['name'] . '"'; mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('" . $u['city'] . "','" . $u['room'] . "','','" . $u['login'] . "','" . $text . "','-1','6','0',1)"); if ($u['battle'] > 0) { $lastHOD = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $u['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1')); @@ -8202,7 +8184,7 @@ LIMIT 1')); if ($lastHOD['type'] != 6) { $id_hod++; } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' Сѓ персонажа {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")'); + mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' у персонажа {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")'); } } } @@ -8301,16 +8283,16 @@ LIMIT 1')); if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) { $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` > 0 AND `delete` = 0 AND `data` LIKE "%maks_itm_one=' . $tr['maks_itm_one'] . '%" LIMIT 1')); if (isset($test['id'])) { - $this->error = 'Возможное использование максимум РѕРґРЅРѕРіРѕ предмета!'; + $this->error = 'Возможное использование максимум одного предмета!'; $notr++; } } if ($this->info['twink'] > 0) { - //РќРµ дороже 100 екр. + //Не дороже 100 екр. if ($itm['price2'] > 100 || $itm['2price'] > 100) { $notr++; } - //Нельзя СЂСѓРЅС‹ + чарки + //Нельзя руны + чарки if (isset($tr['rune']) && $tr['rune'] > 0) { $notr++; } @@ -8348,11 +8330,11 @@ LIMIT 1')); } } if ($notr > 0) { - //РќРµ хватает характеристик или РЅРµ совпадают условия + //Не хватает характеристик или не совпадают условия if (isset($tr['open']) && isset($_GET['open'])) { - $this->error = 'Р’С‹ РЅРµ можете открыть данный предмет'; + $this->error = 'Вы не можете открыть данный предмет'; } else { - $this->error = 'Нельзя одеть больше РѕРґРЅРѕРіРѕ предмета данного типа'; + $this->error = 'Нельзя одеть больше одного предмета данного типа'; } return 0; } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) { @@ -8364,45 +8346,45 @@ LIMIT 1')); require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php'); if (!isset($no_open_itm)) { $this->deleteItem($itm['id'], $this->info['id']); - $this->error = 'Р’С‹ успешно открыли "' . $itm['name'] . '":
    ' . $io . '...'; + $this->error = 'Вы успешно открыли "' . $itm['name'] . '":
    ' . $io . '...'; } else { unset($no_open_itm); } } else { - $this->error = 'Предмет "' . $itm['name'] . '" невозможно открыть...'; + $this->error = 'Предмет "' . $itm['name'] . '" невозможно открыть...'; } } elseif (isset($tr['open']) && isset($_GET['open'])) { - //открываем предмет + //открываем предмет $io = ''; $i = 0; $itms = explode(',', $tr['items_in']); if ($itm['type'] == 37) { - //Распаковываем упаковку + //Распаковываем упаковку $io = ''; $itmin = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "' . $tr['item_inbox'] . '" LIMIT 1')); $itmmn = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $itmin['item_id'] . '" LIMIT 1')); // if ($itm['gift'] == '' || $itm['gift'] == '0') { - $this->error = 'Предмет должен быть подарен, прежде чем его открывать!'; + $this->error = 'Предмет должен быть подарен, прежде чем его открывать!'; } elseif (!isset($itmin['id'])) { - $this->error = 'Р’ упаковке ничего нет, скорее всего предмет кто-то вытащил РѕС‚ туда...'; + $this->error = 'В упаковке ничего нет, скорее всего предмет кто-то вытащил от туда...'; } else { $io .= $itmmn['name']; if ($itmin['item_id'] == 4867) { - //РќРµ откроешь + //Не откроешь $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); - $this->error = 'РќРµ удалось открыть подарок. Содержимое испорчено.'; + $this->error = 'Не удалось открыть подарок. Содержимое испорчено.'; } elseif ($itmin['item_id'] == 4868) { - //Летучая мышь + //Летучая мышь mysql_query('UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); - $this->error = 'Р’С‹ потеряли РІСЃРµ HP...'; + $this->error = 'Вы потеряли все HP...'; } elseif ($itmin['item_id'] == 4870) { - //Минута молчания + //Минута молчания if ($this->info['molch1'] > time()) { $this->info['molch1'] += 3600; } else { @@ -8411,90 +8393,90 @@ LIMIT 1')); mysql_query('UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); - $this->error = 'Р’С‹ оказались РїРѕРґ действие заклятия молчания...'; + $this->error = 'Вы оказались под действие заклятия молчания...'; } elseif ($itmin['item_id'] == 4873) { - //Крысиный СЏРґ + //Крысиный яд $a = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); if (isset($a['id'])) { - $this->error = 'Ваш зверь "' . $a['name'] . '" странно позеленел...'; + $this->error = 'Ваш зверь "' . $a['name'] . '" странно позеленел...'; mysql_query('UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'); } else { - $this->error = 'Кто-то пытался отравить вашего зверя, которого Сѓ вас нет :)'; + $this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)'; } } elseif ($itmin['item_id'] == 4869) { - //Неасчастный случай (легкая травма РЅР° 1 час) + //Неасчастный случай (легкая травма на 1 час) $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 3600) . '","-1", - "Неверие РІ человечество","add_s' . rand(1, 3) . '=-' . rand(5, 15) . '","' . $this->info['id'] . '", + "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(5, 15) . '","' . $this->info['id'] . '", "4", "bad_present_travma1.gif","0", "1" )'); - $this->error = 'Р’С‹ травмированы. Р’ том числе Рё физически...'; + $this->error = 'Вы травмированы. В том числе и физически...'; } elseif ($itmin['item_id'] == 4872) { - //Трагедия (средняя травма РЅР° 1 час) + //Трагедия (средняя травма на 1 час) $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 3600) . '","-1", - "Неверие РІ человечество","add_s' . rand(1, 3) . '=-' . rand(16, 25) . '","' . $this->info['id'] . '", + "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(16, 25) . '","' . $this->info['id'] . '", "4", "bad_present_travma2.gif","0", "2" )'); - $this->error = 'Р’С‹ травмированы. Р’ том числе Рё физически...'; + $this->error = 'Вы травмированы. В том числе и физически...'; } elseif ($itmin['item_id'] == 4876) { - //Катастрофа (тяжелая травма РЅР° 1 час) + //Катастрофа (тяжелая травма на 1 час) $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 3600) . '","-1", - "Неверие РІ человечество","add_s' . rand(1, 3) . '=-' . rand(26, 35) . '","' . $this->info['id'] . '", + "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(26, 35) . '","' . $this->info['id'] . '", "4", "bad_present_travma3.gif","0", "3" )'); - $this->error = 'Р’С‹ травмированы. Р’ том числе Рё физически...'; + $this->error = 'Вы травмированы. В том числе и физически...'; } elseif ($itmin['item_id'] == 4878) { - //Недвижимость (add_puti=7200) + //Недвижимость (add_puti=7200) $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 7200) . '","-1", - "Недвижимость","add_puti=1","' . $this->info['id'] . '", + "Недвижимость","add_puti=1","' . $this->info['id'] . '", "4", "bad_present_chains.gif","0", "3" )'); - $this->error = 'Р’С‹ РЅРµ можете передвигаться...'; + $this->error = 'Вы не можете передвигаться...'; } elseif ($itmin['item_id'] == 4874) { - //РЎСЋСЂРїСЂРёР· для мага РЅР° час + //Сюрприз для мага на час $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 3600) . '","-1", - "РЎСЋСЂРїСЂРёР· для Мага","add_s5=-50","' . $this->info['id'] . '", + "Сюрприз для Мага","add_s5=-50","' . $this->info['id'] . '", "4", "bad_present_dmage.gif","0", "3" )'); - $this->error = 'Вам нехорошо...'; + $this->error = 'Вам нехорошо...'; } elseif ($itmin['item_id'] == 4871) { - //РЎСЋСЂРїСЂРёР· для РІРѕРёРЅР° РЅР° час + //Сюрприз для воина на час $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ( "0","' . (time() + 3600) . '","-1", - "РЎСЋСЂРїСЂРёР· для Р’РѕРёРЅР°","add_s1=-50","' . $this->info['id'] . '", + "Сюрприз для Воина","add_s1=-50","' . $this->info['id'] . '", "4", "bad_present_dfighter.gif","0", "3" )'); - $this->error = 'Вам нехорошо...'; - } elseif (mysql_query('UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет РёР· упаковки. Дата запаковки: ' . date('d.m.Y H:i:s', $itmin['time_create']) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1')) { - //Удаляем упаковку + $this->error = 'Вам нехорошо...'; + } elseif (mysql_query('UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date('d.m.Y H:i:s', $itmin['time_create']) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1')) { + //Удаляем упаковку $this->deleteItem($itm['id'], $this->info['id']); - $this->error = 'Р’С‹ успешно открыли "' . $itm['name'] . '", внутри было найдено:
    ' . $io . '...'; + $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
    ' . $io . '...'; } else { - $this->error = 'Неудалось открыть подарок, что же там?'; + $this->error = 'Неудалось открыть подарок, что же там?'; } // } @@ -8526,7 +8508,7 @@ LIMIT 1')); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } $this->deleteItem($itm['id'], $this->info['id']); - $this->error = 'Р’С‹ успешно открыли "' . $itm['name'] . '", внутри было найдено:
    ' . $io . '...'; + $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
    ' . $io . '...'; } } else { $inSlot = $itm['inslot']; @@ -8536,13 +8518,13 @@ LIMIT 1')); $d[$p['inOdet']] = $p['id']; } - //Если РІ слот оружия Рё можно одеть РІ левую СЂСѓРєСѓ + //Если в слот оружия и можно одеть в левую руку if ($itm['2too'] == 1 && $inSlot == 3 && isset($d[3])) { $inSlot = 14; } if ($inSlot == 3 || $inSlot == 14) { - //Проверяем есть-ли двуручное оружие + //Проверяем есть-ли двуручное оружие if ($this->stats['items'][$this->stats['wp3id']]['2h'] == 1 || $this->stats['items'][$this->stats['wp14id']]['2h'] == 1 || $itm['2h'] == 1) { $this->snatItem($this->stats['items'][$this->stats['wp3id']]['id'], $uid); $this->snatItem($this->stats['items'][$this->stats['wp14id']]['id'], $uid); @@ -8605,7 +8587,7 @@ LIMIT 1')); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); } if ($upd) { - //Если предмет привязывается после одевания + //Если предмет привязывается после одевания //if($itm['']) //{ // @@ -8614,12 +8596,12 @@ LIMIT 1')); mysql_query('UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); return 1; } else { - $this->error = '(!) Ошибка обновления данных'; + $this->error = '(!) Ошибка обновления данных'; return 0; } } } else { - $this->error = 'Предмет РЅРµ найден РІ вашем рюкзаке'; + $this->error = 'Предмет не найден в вашем рюкзаке'; return 0; } } @@ -8636,14 +8618,14 @@ LIMIT 1')); if (isset($itm['id'])) { if ($coldel == 0) { - //Удаляем целиком + //Удаляем целиком $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'); $col = $this->itemsX($itm['id']); if ($col > 0) { mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col); } } else { - //Удаляем конкретное РєРѕР»-РІРѕ + //Удаляем конкретное кол-во $col = $this->itemsX($itm['id']); if ($col > 1) { if ($col <= $coldel) { @@ -8651,7 +8633,7 @@ LIMIT 1')); } $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel); } else { - //Удаляем целиком + //Удаляем целиком $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'); $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col); } @@ -8666,18 +8648,18 @@ LIMIT 1')); $col = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr)); $col = $col[0]; mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr); - $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены'; - $this->addDelo(1, $uid, '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(), $this->info['city'], 'System.inventory', 0, 0); + $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены'; + $this->addDelo(1, $uid, '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(), $this->info['city'], 'System.inventory', 0, 0); } else { - $this->error = 'Предмет "' . $itm['name'] . '" выброшен'; - $this->addDelo(1, $uid, '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.', time(), $this->info['city'], 'System.inventory', 0, 0); + $this->error = 'Предмет "' . $itm['name'] . '" выброшен'; + $this->addDelo(1, $uid, '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.', time(), $this->info['city'], 'System.inventory', 0, 0); } return 1; } else { return 0; } } else { - $this->error = 'Предмет РЅРµ найден РІ вашем рюкзаке'; + $this->error = 'Предмет не найден в вашем рюкзаке'; } } @@ -8763,7 +8745,7 @@ LIMIT 1')); $sts = explode('|', $u['stats']); $i = 0; $ste = ''; - //Родные характеристики + //Родные характеристики while ($i < count($sts)) { $ste = explode('=', $sts[$i]); if (isset($ste[1])) { @@ -8794,7 +8776,7 @@ LIMIT 1')); '); } - //Шаблонные картинки + //Шаблонные картинки if ($this->info['id'] == $u['id'] || $reimg != false) { $sp_img = mysql_query('SELECT * FROM `items_img` WHERE `uid` = "' . $u['id'] . '" AND `img_id` != "0" LIMIT 16'); while ($pl_img = mysql_fetch_array($sp_img)) { @@ -8807,7 +8789,7 @@ LIMIT 1')); } } - //Характеристики РѕС‚ предметов //РўРЈРў tr_lvl + //Характеристики от предметов //ТУТ tr_lvl $cl = mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`, `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` @@ -8818,7 +8800,7 @@ LIMIT 1')); $hnd2 = 0; $sht1 = 0; $reitm = []; - $coms = []; // комплекты + $coms = []; // комплекты $dom = []; $btl_cof = 0; $oza = [ @@ -8826,13 +8808,13 @@ LIMIT 1')); 2 => [0, 0], 3 => [0, 0], 4 => [0, 0] - ]; //особенности защиты + ]; //особенности защиты $ozm = [ 1 => [0, 0], 2 => [0, 0], 3 => [0, 0], 4 => [0, 0] - ]; //особенности магии + ]; //особенности магии $itmslvl = 0; $itmsCfc = 0; @@ -8905,46 +8887,46 @@ LIMIT 1')); if (isset($sti['add_oza' . $ko])) { if (isset($sti['add_oza'])) { if ($sti['add_oza'] == 1) { - //Слабая + //Слабая $oza[$ko][0] += 1; $oza[$ko][1] += 9; } elseif ($sti['add_oza'] == 2) { - //Нормальная + //Нормальная $oza[$ko][0] += 20; $oza[$ko][1] += 39; } elseif ($sti['add_oza'] == 3) { - //Хорошая + //Хорошая $oza[$ko][0] += 40; $oza[$ko][1] += 69; } elseif ($sti['add_oza'] == 4) { - //Посредственная + //Посредственная $oza[$ko][0] += 10; $oza[$ko][1] += 19; } elseif ($sti['add_oza'] == 5) { - //Великолепная + //Великолепная $oza[$ko][0] += 70; $oza[$ko][1] += 89; } } if (isset($sti['add_ozm'])) { if ($sti['add_ozm'] == 1) { - //Слабая + //Слабая $ozm[$ko][0] += 1; $ozm[$ko][1] += 9; } elseif ($sti['add_ozm'] == 2) { - //Нормальная + //Нормальная $ozm[$ko][0] += 20; $ozm[$ko][1] += 39; } elseif ($sti['add_ozm'] == 3) { - //Хорошая + //Хорошая $ozm[$ko][0] += 40; $ozm[$ko][1] += 69; } elseif ($sti['add_ozm'] == 4) { - //Посредственная + //Посредственная $ozm[$ko][0] += 10; $ozm[$ko][1] += 19; } elseif ($sti['add_ozm'] == 5) { - //Великолепная + //Великолепная $ozm[$ko][0] += 70; $ozm[$ko][1] += 89; } @@ -8953,45 +8935,45 @@ LIMIT 1')); $ozm[$ko][1] += 9; } if ($sti['add_oza' . $ko] == 1) { - //Слабая + //Слабая $oza[$ko][0] += 1; $oza[$ko][1] += 9; } elseif ($sti['add_oza' . $ko] == 2) { - //Нормальная + //Нормальная $oza[$ko][0] += 20; $oza[$ko][1] += 39; } elseif ($sti['add_oza' . $ko] == 3) { - //Хорошая + //Хорошая $oza[$ko][0] += 40; $oza[$ko][1] += 69; } elseif ($sti['add_oza' . $ko] == 4) { - //Посредственная + //Посредственная $oza[$ko][0] += 10; $oza[$ko][1] += 19; } elseif ($sti['add_oza' . $ko] == 5) { - //Великолепная + //Великолепная $oza[$ko][0] += 70; $oza[$ko][1] += 89; } if (isset($sti['add_ozm' . $ko])) { if ($sti['add_ozm' . $ko] == 1) { - //Слабая + //Слабая $ozm[$ko][0] += 1; $ozm[$ko][1] += 9; } elseif ($sti['add_ozm' . $ko] == 2) { - //Нормальная + //Нормальная $ozm[$ko][0] += 20; $ozm[$ko][1] += 39; } elseif ($sti['add_ozm' . $ko] == 3) { - //Хорошая + //Хорошая $ozm[$ko][0] += 40; $ozm[$ko][1] += 69; } elseif ($sti['add_ozm' . $ko] == 4) { - //Посредственная + //Посредственная $ozm[$ko][0] += 10; $ozm[$ko][1] += 19; } elseif ($sti['add_ozm' . $ko] == 5) { - //Великолепная + //Великолепная $ozm[$ko][0] += 70; $ozm[$ko][1] += 89; } @@ -9072,13 +9054,13 @@ LIMIT 1')); $st['zona'] += $sti['zona']; } - //Добавляем статы РѕС‚ данного предмета + //Добавляем статы от данного предмета if (!isset($sti['restart_stats'])) { $i = 0; while ($i < count($ia)) { if (isset($ia[$i])) { - //Действует РЅР° (Действует РЅР°) + //Действует на (Действует на) if (isset($sti['add_' . $ia[$i]])) { if ($ia[$i] != 'zmproc' && $ia[$i] != 'zaproc') { @@ -9118,13 +9100,13 @@ LIMIT 1')); } } - //Сохраненные хар-РєРё Рё умения + //Сохраненные хар-ки и умения if (count($reitm) > 0) { $i39 = [0 => 0, 1 => 0, 2 => 0]; $i = 0; while ($i < count($reitm)) { if (isset($reitm[$i]['sm_skill']) && $i39[0] == 0) { - //умения + //умения $i9 = 1; $i39[0] = 1; while ($i9 <= 7) { @@ -9133,7 +9115,7 @@ LIMIT 1')); $i9++; } } elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) { - //статы + //статы $i9 = 1; $i39[1] = 1; while ($i9 <= 12) { @@ -9141,7 +9123,7 @@ LIMIT 1')); $i9++; } } elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) { - //навыки + //навыки $i39[2] = 1; } @@ -9149,7 +9131,7 @@ LIMIT 1')); } } - //Харки РѕС‚ РёРєРѕРЅРѕРє + //Харки от иконок $efs = mysql_query('SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string($u['id']) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'); while ($e = mysql_fetch_array($efs)) { $sts = $this->lookStats($e['bonus']); @@ -9183,7 +9165,7 @@ LIMIT 1')); $test_noef = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_actions` WHERE `uid` = "' . $u['id'] . '" AND `vars` = "noeffectbattle1" AND `btl` = "' . $u['battle'] . '" LIMIT 1')); } //} - //Характеристики РѕС‚ эффектов + //Характеристики от эффектов $h = 0; $nbs = []; $prsu = []; @@ -9195,7 +9177,7 @@ LIMIT 1')); if ($u['dnow'] == 0) { if ($u['battle'] == 0) { mysql_query('DELETE FROM `eff_users` WHERE `id_eff` = "' . $e['id_eff'] . '" AND `uid` = "' . $u['id'] . '" AND `id` != "' . $e['id'] . '" ORDER BY `id` ASC'); - //Переводим РІ заряды + //Переводим в заряды if ($e['v1'] != 'priem') { if ($e['hod'] != -1) { mysql_query('UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time() + ($e['hod'] * $c['effz']) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'); @@ -9274,7 +9256,7 @@ LIMIT 1')); $i++; } } elseif ($e['timeUse'] != 77) { - //удаляем эффект + //удаляем эффект if ($e['img2'] != 'tz.gif' || $u['id'] == $this->info['id']) { if ($e['sleeptime'] == 0) { $this->endEffect($e['id'], $u); @@ -9287,38 +9269,38 @@ LIMIT 1')); $st['noeffectbattle1'] = 1; } - //Заглушки РѕС‚ эффектов + //Заглушки от эффектов //$st['items_img'][$pl_img['type']] = $pl_img_r['id'].'.'.$pl_img_r['format']; if ($nbs[4899] > 0) { - //Зеленый комплект + //Зеленый комплект $st['items_img'][8] = 'robe_illusion4.gif'; $st['items_img'][11] = 'leg_illusion4.gif'; } elseif ($nbs[4900] > 0) { - //Золото комплект + //Золото комплект $st['items_img'][8] = 'robe_illusion5.gif'; $st['items_img'][11] = 'leg_illusion5.gif'; } elseif ($nbs[4901] > 0) { - //Голубой комплект + //Голубой комплект $st['items_img'][8] = 'robe_illusion3.gif'; $st['items_img'][11] = 'leg_illusion3.gif'; } elseif ($nbs[4902] > 0) { - //РЎРёРЅРёР№ комплект + //Синий комплект $st['items_img'][8] = 'robe_illusion6.gif'; $st['items_img'][11] = 'leg_illusion6.gif'; } elseif ($nbs[4903] > 0) { - //Желтый комплект + //Желтый комплект $st['items_img'][8] = 'robe_illusion8.gif'; $st['items_img'][11] = 'leg_illusion8.gif'; } elseif ($nbs[4904] > 0) { - //Сиреневое платье + //Сиреневое платье $st['items_img'][8] = 'robe_illusion7.gif'; $st['items_img'][11] = 'leg_illusion7.gif'; } elseif ($nbs[4905] > 0) { - //Оранжевое платье + //Оранжевое платье $st['items_img'][8] = 'robe_illusion9.gif'; $st['items_img'][11] = 'leg_illusion9.gif'; } elseif ($nbs[4908] > 0) { - //Набор Темной Одежды + //Набор Темной Одежды $st['items_img'][8] = 'robe_illusion2.gif'; $st['items_img'][11] = 'leg_illusion2.gif'; $st['items_img'][10] = 'boots_illusion2.gif'; @@ -9327,7 +9309,7 @@ LIMIT 1')); $st['items_img'][4] = 'helmet_illusion2.gif'; $st['items_img'][12] = 'perchi_illusion2.gif'; } elseif ($nbs[4906] > 0) { - //Набор Бриллиантовой Одежды + //Набор Бриллиантовой Одежды $st['items_img'][8] = 'robe_illusion1.gif'; $st['items_img'][11] = 'leg_illusion1.gif'; $st['items_img'][10] = 'boots_illusion1.gif'; @@ -9337,14 +9319,14 @@ LIMIT 1')); $st['items_img'][12] = 'perchi_illusion1.gif'; } if ($nbs[4909] > 0) { - //Набор Золотых украшений + //Набор Золотых украшений $st['items_img'][13] = 'ring_illusion2.gif'; $st['items_img'][17] = 'ring_illusion2.gif'; $st['items_img'][18] = 'ring_illusion2.gif'; $st['items_img'][14] = 'amulet_illusion2.gif'; $st['items_img'][15] = 'earrings_illusion2.gif'; } elseif ($nbs[4907] > 0) { - //Набор Золотых украшений + //Набор Золотых украшений $st['items_img'][13] = 'ring_illusion1.gif'; $st['items_img'][17] = 'ring_illusion1.gif'; $st['items_img'][18] = 'ring_illusion1.gif'; @@ -9353,7 +9335,7 @@ LIMIT 1')); } if ($itmslvl < 5) { - //Эффект ослабления + //Эффект ослабления $st['itmslvl'] = 0; } else { $st['itmslvl'] = 1; @@ -9364,7 +9346,7 @@ LIMIT 1')); unset($test_btl_info); if ($u['battle'] > 0) { - //Характеристики РѕС‚ приемов + //Характеристики от приемов $efs = mysql_query('SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`tr_life_user`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string($u['id']) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC'); $st['set_pog'] = []; $st['set_pog2'] = []; @@ -9453,14 +9435,14 @@ LIMIT 1')); $i++; } } elseif ($e['timeUse'] != 77) { - //удаляем эффект + //удаляем эффект $this->endEffect($e['id'], $u); $st['act'] = 1; } } } - //Характеристики РѕС‚ статов + //Характеристики от статов if (!isset($st['hpAll'])) { $st['hpAll'] = 0; @@ -9472,26 +9454,26 @@ LIMIT 1')); } @$st['mpAll'] += @$st['s6'] * 10; - //РўСѓСЂРЅРёСЂ + //Турнир if (!isset($st['m1'])) { $st['m1'] = 0; } $st['m1'] += $st['s3'] * 5; - // РјС„.анти-РєСЂРёС‚ = 2.5 + // мф.анти-крит = 2.5 if (!isset($st['m2'])) { $st['m2'] = 0; } $st['m2'] += $st['s3'] * 5; - // РјС„.СѓРІРѕСЂРѕС‚ = 2.5 + // мф.уворот = 2.5 if (!isset($st['m4'])) { $st['m4'] = 0; } $st['m4'] += $st['s2'] * 5; - // РјС„.анти-СѓРІРѕСЂРѕС‚ = 2.5 + // мф.анти-уворот = 2.5 if (!isset($st['m5'])) { $st['m5'] = 0; } @@ -9505,9 +9487,9 @@ LIMIT 1')); if (!isset($st['zm'])) { $st['zm'] = 0; } - $st['zm'] += $st['s4'] * 1.0; + $st['zm'] += $st['s4'] * 0.0; - if (!isset($st['zaproc'])) { //РўСѓС‚ Р·Рј 'zaproc'=>'Защита РѕС‚ СѓСЂРѕРЅР° (%)','zmproc'=>'Защита РѕС‚ магии стихий (%) + if (!isset($st['zaproc'])) { //Тут зм 'zaproc'=>'Защита от урона (%)','zmproc'=>'Защита от магии стихий (%) $st['zaproc'] = 0; } $st['zaproc'] += round($st['s5'] * 0); @@ -9517,12 +9499,12 @@ LIMIT 1')); } $st['m19'] += round($st['s3'] * 0.03); - //Мощности - //Мощность против "Мощность РєСЂРёС‚. СѓСЂРѕРЅР°". Гамс + //Мощности + //Мощность против "Мощность крит. урона". Гамс if (!isset($st['antm3'])) { $st['antm3'] = 0; } - $st['antm3'] += $st['s2'] * 0.5; + $st['antm3'] += $st['s5'] * 0.5; if (!isset($st['m10'])) { @@ -9546,15 +9528,15 @@ LIMIT 1')); } $st['m8'] += 0; - //Бонусы комплектов + //Бонусы комплектов $i = 0; while ($i <= count(@$coms['new'])) { if (@isset($coms['new'][$i])) { - //$coms[$i]['id'] - id комплекта, $j - РєРѕР»-РІРѕ предметов данного комплекта + //$coms[$i]['id'] - id комплекта, $j - кол-во предметов данного комплекта $j = @$coms['com'][$coms['new'][$i]]; $com = mysql_fetch_array(mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . ((int)$coms['new'][$i]) . '" AND `x` <= ' . ((int)$j) . ' ORDER BY `x` DESC LIMIT 1')); if (isset($com['id'])) { - //добавляем действия комплекта + //добавляем действия комплекта $ij = 0; $sti = $this->lookStats($com['data']); while ($ij < count($ia)) { @@ -9568,10 +9550,10 @@ LIMIT 1')); $i++; } - //Бонусы статов - //Замена свитков + //Бонусы статов + //Замена свитков if ($u['autospell'] != '' && $u['autospell'] != 0 && $u['battle'] == 0) { - //проверяем свитки + //проверяем свитки $splink = ''; $spi = mysql_query('SELECT `id`,`item_id`,`inOdet` FROM `items_users` WHERE `inOdet` >= 40 AND `inOdet` <= 50 AND `uid` = "' . $u['id'] . '" AND `delete` = 0 ORDER BY `item_id` DESC LIMIT 20'); while ($pli = mysql_fetch_array($spi)) { @@ -9579,13 +9561,13 @@ LIMIT 1')); } $splink = rtrim($splink, ','); - //Запоминаем новый комплект свитков + //Запоминаем новый комплект свитков if ($u['autospell'] == 1) { $u['autospell'] = $splink; mysql_query('UPDATE `users` SET `autospell` = "' . $splink . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'); } - //Выдаем нужный свиток, если РѕРЅ есть РІ инвентаре + //Выдаем нужный свиток, если он есть в инвентаре if ($u['autospell'] != $splink) { $spe1 = explode(',', $splink); $spe2 = explode(',', $u['autospell']); @@ -9619,9 +9601,9 @@ LIMIT 1')); } - //Бонусы статов - //РўРЈРў - //сила + //Бонусы статов + //ТУТ + //сила if ($st['s1'] > 24 && $st['s1'] < 50) { $st['m2'] += 15; @@ -9655,7 +9637,7 @@ LIMIT 1')); $st['m7'] += 7; } - //ловкость $st[1]['pa1'] += 2; $st['m7'] += 35; + //ловкость $st[1]['pa1'] += 2; $st['m7'] += 35; if ($st['s2'] > 24 && $st['s2'] < 50) { $st['pa1'] += 2; @@ -9701,7 +9683,7 @@ LIMIT 1')); $st['m15'] += 5; } - //интуиция + //интуиция if ($st['s3'] > 24 && $st['s3'] < 50) { $st['pa4'] += 2; @@ -9754,7 +9736,7 @@ LIMIT 1')); $st['m14'] += 5; } - //выносливость + //выносливость if ($st['s4'] > 0) { $st['hpAll'] += 30; @@ -9793,7 +9775,7 @@ LIMIT 1')); $st['za'] += 125; $st['zm'] += 125; } - //интелект + //интелект if ($st['s5'] > 24 && $st['s5'] < 50) { $st['m11'] += 10; @@ -9820,7 +9802,7 @@ LIMIT 1')); if ($st['s5'] > 199) { $st['pzm'] += 5; } - //мудрость + //мудрость if ($st['s6'] > 24 && $st['s6'] < 50) { $st['mpAll'] += 150; @@ -9859,7 +9841,7 @@ LIMIT 1')); $st['pzm'] += 7; } - //если второе оружие одето + //если второе оружие одето if ($hnd2 == 1 && $hnd1 == 1) { $st['zona']++; } @@ -9868,7 +9850,7 @@ LIMIT 1')); $st['zonb']++; } - /* Владения */ + /* Владения */ $i = 1; while ($i <= 7) { if (!isset($st['pm' . $i])) { @@ -9938,23 +9920,23 @@ LIMIT 1')); $i++; } - //Уязвимость оружие Рё магиям + //Уязвимость оружие и магиям $i = 1; while ($i <= 7) { @$st['yzm' . $i] += @$st['yzma']; if ($i <= 4) { - @$st['yzm' . $i] += @$st['yzm'];//стихийный СѓСЂРѕРЅ только - @$st['yza' . $i] += @$st['yza']; //СѓСЂРѕРЅ оружия + @$st['yzm' . $i] += @$st['yzm'];//стихийный урон только + @$st['yza' . $i] += @$st['yza']; //урон оружия } - //Отнимает РѕС‚ защиты РѕС‚ СѓСЂРѕРЅР° + //Отнимает от защиты от урона if (isset($st['yza' . $i]) && $i <= 4) { $st['za' . $i] = ($st['za' . $i] / 100 * (100 + ($st['yza' . $i]))); if ($st['za' . $i] < 0) { $st['za' . $i] = 0; } } - //Отнимает РѕС‚ защиты РѕС‚ магии + //Отнимает от защиты от магии if (isset($st['yzm' . $i])) { $st['zm' . $i] = ($st['zm' . $i] / 100 * (100 + ($st['yzm' . $i]))); if ($st['zm' . $i] < 0) { @@ -9981,10 +9963,10 @@ LIMIT 1')); $st['mpAll'] += round($st['mpAll'] / 100 * $st['mpProc']); } - //Реген. - 250 ед. + //Реген. - 250 ед. - //конец Р±РѕРЅСѓСЃРѕРІ + //конец бонусов if ($st['hpNow'] < 0) { $st['hpNow'] = 0; } elseif ($st['hpNow'] > $st['hpAll']) { @@ -9996,7 +9978,7 @@ LIMIT 1')); $st['mpNow'] = $st['mpAll']; } - //Р·РѕРЅС‹ блока Рё удара + //зоны блока и удара if ($st['zona'] < 1) { $st['zona'] = 1; } @@ -10035,7 +10017,7 @@ LIMIT 1')); $st['pzm'] += 5; } - //Бонус РѕС‚ медалей + //Бонус от медалей $rep1 = mysql_fetch_array(mysql_query('SELECT `add_slot`,`nu_sandcity`,`n_sandcity`, `dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`, @@ -10056,49 +10038,49 @@ LIMIT 1')); $st['hpAll'] += 250; } - //Водосток + //Водосток if ($rep1['repdreamscity'] >= 24999) { $st['m10'] += 10; $st['pzm'] += 1; } - //излом + //излом if ($rep1['repizlom'] == 9999) { $st['m10'] += 10; $st['pzm'] += 1; } - //Бездна + //Бездна if ($rep1['repangelscity'] == 25000) { $st['m10'] += 10; $st['pzm'] += 1; } - //Катакомбы + //Катакомбы if ($rep1['repdemonscity'] == 25000) { $st['m10'] += 10; $st['pzm'] += 1; } - //Грибница + //Грибница if ($rep1['repdemonscity'] == 25000) { $st['m10'] += 10; $st['pzm'] += 1; } - //Пещера тысячи проклятий + //Пещера тысячи проклятий if ($rep1['repcapitalcity'] == 25000) { $st['m10'] += 10; $st['pzm'] += 1; } - //Санд + //Санд if ($rep1['repsandcity'] == 25000) { $st['m10'] += 10; $st['pzm'] += 1; } - //Гора легиона + //Гора легиона if ($rep1['repabandonedplain'] == 24999) { $st['m10'] += 10; $st['pzm'] += 1; } - //Добавочный подьем для РёРіСЂРѕРєРѕРІ + //Добавочный подьем для игроков $st['maxves'] += 500; if ($st['silver'] >= 5) { @@ -10114,7 +10096,7 @@ LIMIT 1')); $st['exp'] += 25; } - //Сохраняем рейтинг РёРіСЂРѕРєР° + //Сохраняем рейтинг игрока $st['reting'] = floor($st['reting']); if (@$st['btl_cof'] != @$st['prckr']) { @@ -10131,14 +10113,14 @@ LIMIT 1')); } if ($u['room'] == 411) { - //Хоккей, эффект РѕС‚ шайбы -25% РќР  + //Хоккей, эффект от шайбы -25% НР $shb = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u['id'] . '" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1')); if (isset($shb['id'])) { $st['hpAll'] = round($st['hpAll'] / 100 * 75); } } - if (stristr($u['login'], '(зверь ') == true || (stristr($u['login'], 'Каменный страж') && $u['ip'] == '0')) { + if (stristr($u['login'], '(зверь ') == true || (stristr($u['login'], 'Каменный страж') && $u['ip'] == '0')) { $st['this_animal'] = 1; } else { $st['this_animal'] = 0; @@ -10147,7 +10129,7 @@ LIMIT 1')); $rt = []; if ($i1 == 1) { $rt[0] = $st; - $rt[1] = $st2; //родные статы + $rt[1] = $st2; //родные статы } else { $rt = $st; } @@ -10185,7 +10167,7 @@ LIMIT 1')); return $msg_id; } - //получаем уровень + //получаем уровень public function testLevel() { global $c; @@ -10218,17 +10200,17 @@ LIMIT 1')); if ($this->info['exp'] >= $telvl[$this->info['upLevel']]) { $lvl = mysql_fetch_array(mysql_query('SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . $this->info['upLevel'] . '" LIMIT 1')); $lvln = mysql_fetch_array(mysql_query('SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . ($lvl['upLevel'] + 1) . '" LIMIT 1')); - //Кристал вечности + //Кристал вечности if ($this->info['exp'] > 12499 && $this->info['level'] <= 5 && $c['infinity5level'] == true) { $itm = mysql_fetch_array(mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "1204" AND `delete` = "0" AND `uid` = "' . $this->info['id'] . '" AND `inShop` = "0" AND `inTransfer` = "0" LIMIT 1')); if (!isset($itm['id']) && $this->info['host_reg'] != 'noinfinity5' && $this->info['twink'] == 0) { $this->info['exp'] = 12499; mysql_query('UPDATE `stats` SET `exp` = "12499" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - echo ''; + echo ''; } else { mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - $text = 'Предмет "Кристалл Вечности [6]" был успешно использован.'; + $text = 'Предмет "Кристалл Вечности [6]" был успешно использован.'; echo ''; //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1',".$this->info['city']."','".$this->info['room']."','','".$this->info['login']."','".$text."','".time()."','6','0')"); } @@ -10241,9 +10223,9 @@ LIMIT 1')); while ($i != 1) { if ($c['nolevel'] == true && $this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) { $tlus = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `real` = 1 AND `level` = "' . $this->info['level'] . '" LIMIT 1')); - //берем апп или уровень, $lvln + //берем апп или уровень, $lvln if ($tlus[0] < $this->info['level'] * 5) { - //Нельзя получать лвл/аппы РїРѕРєР° РЅРµ будет 100 персонажей текущего СѓСЂРѕРІРЅСЏ + //Нельзя получать лвл/аппы пока не будет 100 персонажей текущего уровня $this->info['exp'] = $lvl['exp'] - 1; mysql_query('UPDATE `stats` SET `exp` = "' . $this->info['exp'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); } @@ -10251,7 +10233,7 @@ LIMIT 1')); if ($this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) { if ($lvl['nextLevel'] > $this->info['level']) { - //повышаем выносливость + //повышаем выносливость $a4 = 1; if ($lvl['nextLevel'] == 9) { $a4 = 2; @@ -10266,12 +10248,12 @@ LIMIT 1')); $this->stats['s4'] += $a4; $sex1 = ''; if ($this->info['sex'] == 1) { - $sex1 = 'ла'; + $sex1 = 'ла'; } $ult = 1; - //Рефералы + //Рефералы if ($this->info['twink'] == 0 && (round($this->info['host_reg']) > 0 && ($this->info['dieline'] == 0 || $this->info['dieline'] < $lvl['exp']))) { $mtest = mysql_fetch_array(mysql_query('SELECT `id`,`uid`,`uid2`,`ip` FROM `mults` WHERE (`uid` = "' . $this->info['id'] . '" AND `uid2` = "' . ((int)$this->info['host_reg']) . '") OR (`uid2` = "' . $this->info['id'] . '" AND `uid` = "' . ((int)$this->info['host_reg']) . '") LIMIT 1')); $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1')); @@ -10305,23 +10287,23 @@ LIMIT 1')); $up = mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . mysql_real_escape_string($rlog['id']) . '" LIMIT 1'); if ($up) { - //Реферал 1-РіРѕ СѓСЂРѕРІРЅСЏ + //Реферал 1-го уровня $krtxt = ''; if ($kr > 0) { - $krtxt .= '' . $kr . ' РљР '; + $krtxt .= '' . $kr . ' КР'; if ($ekr > 0) { $krtxt .= ', '; } } if ($ekr > 0) { - $krtxt .= '' . $ekr . ' ЕКР'; + $krtxt .= '' . $ekr . ' ЕКР'; } - $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); $rlog['catch'] += $bn['add_bank']; mysql_query('UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'); // if ((int)$rlog['host_reg'] > 0) { - //Реферал 2-РіРѕ СѓСЂРѕРІРЅСЏ + //Реферал 2-го уровня $llogin = $rlog['login']; $ekr = round($bn['add_bank'] * 0.4, 2); $kr = round($bn['add_money'] * 0.4, 2); @@ -10329,20 +10311,20 @@ LIMIT 1')); if (isset($rlog['id'])) { $krtxt = ''; if ($kr > 0) { - $krtxt .= '' . $kr . ' РљР '; + $krtxt .= '' . $kr . ' КР'; if ($ekr > 0) { $krtxt .= ', '; } } if ($ekr > 0) { - $krtxt .= '' . $ekr . ' ЕКР'; + $krtxt .= '' . $ekr . ' ЕКР'; } - $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' (2-РіРѕ СѓСЂРѕРІРЅСЏ РѕС‚ "' . $llogin . '" ) достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' (2-го уровня от "' . $llogin . '" ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); $rlog['catch'] += $bn['add_bank']; mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'); // if ((int)$rlog['host_reg'] > 0) { - //Реферал 3-РіРѕ СѓСЂРѕРІРЅСЏ + //Реферал 3-го уровня $llogin2 = $rlog['login']; $ekr = round($bn['add_bank'] * 0.2, 2); $kr = round($bn['add_money'] * 0.2, 2); @@ -10350,15 +10332,15 @@ LIMIT 1')); if (isset($rlog['id'])) { $krtxt = ''; if ($kr > 0) { - $krtxt .= '' . $kr . ' РљР '; + $krtxt .= '' . $kr . ' КР'; if ($ekr > 0) { $krtxt .= ', '; } } if ($ekr > 0) { - $krtxt .= '' . $ekr . ' ЕКР'; + $krtxt .= '' . $ekr . ' ЕКР'; } - $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' (3-РіРѕ СѓСЂРѕРІРЅСЏ РѕС‚ "' . $llogin2 . '" (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' (3-го уровня от "' . $llogin2 . '" (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, -1, 6, 0, 0, 0, 1); $rlog['catch'] += $bn['add_bank']; mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'); // @@ -10369,14 +10351,14 @@ LIMIT 1')); } } else { - $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь СЃ Администрации проекта) РќР° Ваш банковский счет в„–' . $bnk . ' зачисленно ' . $ekr . ' РєСЂ.', -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.', -1, 6, 0, 0, 0, 1); } } // mysql_query("UPDATE `users` SET `referals` = `referals` + 5 WHERE `id` = '" . mysql_real_escape_string($rlog['id']) . "' LIMIT 1"); // } elseif (isset($rlog['id'])) { - $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $lvl['nextLevel'] . '! (Персонаж РЅРµ активирован, либо Сѓ вас совпадают IP! Разрешено РЅРµ более 1 такого реферала!)', -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)', -1, 6, 0, 0, 0, 1); } } } @@ -10407,19 +10389,19 @@ LIMIT 1')); } if ($ult == 1) { if ($this->info['level'] == 4 || $this->info['level'] == 8) { - //Убрать задержки РЅР° пещеры + //Убрать задержки на пещеры mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->info['id'] . '" AND `vars` LIKE "psh%"'); - $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], 'Обязательно используйте свитки Рё эликсиры РІ своем инвентаре!!!!!!!!!!!!!!!.', -1, 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], 'Обязательно используйте свитки и эликсиры в своем инвентаре!!!!!!!!!!!!!!!.', -1, 6, 0, 0, 0, 1); } // - $this->send('', $this->info['room'], $this->info['city'], '', '', '' . $this->info['login'] . ' достиг' . $sex1 . ' СѓСЂРѕРІРЅСЏ ' . $this->info['level'] . '!', time(), 6, 0, 0, 0, 1, 2); // Наверно тут + $this->send('', $this->info['room'], $this->info['city'], '', '', '' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!', time(), 6, 0, 0, 0, 1, 2); // Наверно тут //} } //mysql_query('UNLOCK TABLES'); if ($rt > 0) { if ($this->info['level'] >= 11) { - //$this->info['stopexp'] = 1; //Блокировка опыта + //$this->info['stopexp'] = 1; //Блокировка опыта $this->info['stopexp'] = 0; } else { $this->info['stopexp'] = 0; @@ -10436,7 +10418,7 @@ LIMIT 1')); } /*------------*/ if ($this->info['animal'] > 0) { - //уровень зверя + //уровень зверя $a = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); if (isset($a['id']) && $a['level'] < 12) { $ea = [ @@ -10472,14 +10454,14 @@ LIMIT 1')); $iz = 0; while ($iz != -1) { if ($ea[$a['level'] + 1] <= $a['exp']) { - //поднимаем уровень + //поднимаем уровень $a['level']++; $a['max_exp'] = $mx[$a['level']]; } else { if ($iz > 0) { $a['stats'] = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`exp`,`level`,`stats`,`bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); $a['stats'] = $a['stats']['stats']; - $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], '' . $a['name'] . ' достиг ' . $a['level'] . ' СѓСЂРѕРІРЅСЏ!', time(), 6, 0, 0, 0, 1); + $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], '' . $a['name'] . ' достиг ' . $a['level'] . ' уровня!', time(), 6, 0, 0, 0, 1); mysql_query('UPDATE `users_animal` SET `stats` = "' . $a['stats'] . '",`level`="' . $a['level'] . '",`max_exp`="' . $a['max_exp'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'); } $iz = -2; @@ -10500,92 +10482,78 @@ LIMIT 1')); return $v; } + /** + * Эта функция сломана! Формулы hp и mp в любых условиях выдают числа около 1000 за раз, в результате + * любое восстановление - практически моментальное. 12.07.2022 Инс. + * @param $uid + * @param $st + * @param $i1 + * @return array|int[] + */ public function regen($uid, $st, $i1) { if ($uid != $this->info['id']) { - $u = mysql_fetch_array(mysql_query('SELECT `u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`battle`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string($uid) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1')); + $where = is_numeric($uid)? "`u`.`id` = $uid" : "`u`.`login` = $uid"; + $u = mysql_fetch_array(mysql_query('SELECT `u`.`battle`, `st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE ' . $where)); if (!isset($st['hpAll'])) { $st = $this->getStats($uid, $i1); } } else { $u = $this->info; - if (isset($this->stats['hpAll'])) { - $st = $this->stats; - } else { - $st = $this->getStats($uid, $i1); - } + $st = isset($this->stats['hpAll']) ? $this->stats : $this->getStats($uid, $i1); } - $btl = 0; - if ($u['battle'] == 0 || (isset($btl['id']) && $btl['time_start'] > $this->info['timereg'])) { - $sth = $u['minHP']; //Стандартное время восстановления РІ минутах HP - $stm = $u['minMP']; //Стандартное время восстановления РІ минутах MP - $sh = 0; //Скорость регенерации РќР  РІ 1 сек. - $sm = 0; //Скорость регенерации MР  РІ 1 сек. - /*---Двужильный(Особенность)---*/ - if (@$st['os9'] > 0) { - if (@$st['os9'] == 5) { - @$st['os9'] = 6; - } - $sth = floor($u['minHP'] - ($u['minHP'] / 100) * ($st['os9'] * 5)); - } - /*---Двужильный(Особенность)---*/ - /*---Здравомыслящий(Особенность)---*/ - if (@$st['os10'] > 0) { - $stm = floor($u['minMP'] - ($u['minMP'] / 100) * ($st['os10'] * 5)); - } - /*---Здравомыслящий(Особенность)---*/ - if ($u['battle'] > 0) { - $this->info['timereg'] = $btl['time_start']; - } - - //Тестеры первой волны - //тесты боев - $st['speedhp'] += 150; - $st['speedmp'] += 150; - - //hp - $sh = ($st['hpAll'] / (60 * $sth)); - if (!isset($st['speedhp'])) { - $st['speedhp'] = 0; - } - if ((0.0001 + $st['speedhp'] + $st['levels']['hpRegen']) < 0.00001) { - $sh += ($sh / 100) * 0.00001; - } else { - $sh += ($sh / 100) * (0.0001 + $st['speedhp'] + $st['levels']['hpRegen']); - } - $st['hpNow'] += $sh * (time() - $u['regHP']); - if ($st['hpNow'] < 0) { - $st['hpNow'] = 0; - } elseif ($st['hpNow'] > $st['hpAll']) { - $st['hpNow'] = $st['hpAll']; - } - //mp - $sm = ($st['mpAll'] / (60 * $stm)); - if (!isset($st['speedmp'])) { - $st['speedmp'] = 0; - } - $sm += ($sm / 100) * (1 + $st['speedmp'] + $st['levels']['mpRegen']); - $st['mpNow'] += $sm * (time() - $u['regMP']); - if ($st['mpNow'] < 0) { - $st['mpNow'] = 0; - } elseif ($st['mpNow'] > $st['mpAll']) { - $st['mpNow'] = $st['mpAll']; - } - //Заносим новые данные РІ базу - $upd = mysql_query('UPDATE `stats` SET `regHP`="' . time() . '",`regMP`="' . time() . '",`hpNow`="' . $st['hpNow'] . '",`mpNow`="' . $st['mpNow'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'); - if (!$upd) { - return [0 => 0, 1 => 0]; - } else { - if ($this->info['id'] == $u['id']) { - $this->stats['regHP'] = time(); - $this->stats['regMP'] = time(); - $this->stats['hpNow'] = $st['hpNow']; - $this->stats['mpNow'] = $st['mpNow']; - } - return [0 => $sh, 1 => $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']]; - } + if (!empty($u['battle'])) { + return [0, 0]; } + + $sth = $u['minHP']; //Стандартное время восстановления в минутах HP + $stm = $u['minMP']; //Стандартное время восстановления в минутах MP + $st['speedhp'] = $st['speedhp'] ?: 0; + $st['speedmp'] = $st['speedmp'] ?: 0; + #$sh = 0; //Скорость регенерации НР в 1 сек. + #$sm = 0; //Скорость регенерации MР в 1 сек. + + //Тестеры первой волны + //тесты боев + # А не эта ли херня делала очень быструю регенерацию, которую считают нормой? + $st['speedhp'] += 150; + $st['speedmp'] += 150; + + //hp + $sh = ($st['hpAll'] / (60 * $sth)); + $sh += ($sh / 100) * (1 + $st['speedhp'] + $st['levels']['hpRegen']); + $st['hpNow'] += $sh * (time() - $u['regHP']); + $st['hpNow'] = $st['hpNow'] > 0 ? min($st['hpNow'], $st['hpAll']) : 0; + + // После сведение получилось такое. Что ты такое? + //$sh = $st['hpAll'] * (101 + $st['speedhp'] + $st['levels']['hpRegen']) / (6000 * $u['minHP']) + + //mp + $sm = ($st['mpAll'] / (60 * $stm)); + $sm += ($sm / 100) * (1 + $st['speedmp'] + $st['levels']['mpRegen']); + $st['mpNow'] += $sm * (time() - $u['regMP']); + $st['mpNow'] = $st['mpNow'] > 0 ? min($st['mpNow'], $st['mpAll']) : 0; + + + //Заносим новые данные в базу + + if ($u['hpNow'] < $st['hpAll'] || $u['mpNow'] < $st['mpAll']) { + Db::sql('update stats set + regHP = unix_timestamp(), + regMP = unix_timestamp(), + hpNow = ?, + mpNow = ? + where id = ?', [$st['hpNow'], $st['mpNow'], $u['id']]); + } + + if ($this->info['id'] == $u['id']) { + $this->stats['regHP'] = time(); + $this->stats['regMP'] = time(); + $this->stats['hpNow'] = $st['hpNow']; + $this->stats['mpNow'] = $st['mpNow']; + } + return [$sh, $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']]; } public function set_cl_item($id, $user, $cl) @@ -10599,37 +10567,37 @@ LIMIT 1')); $po['toclan1'] = $po['toclan1'][0]; } if (isset($po['sudba']) && $po['sudba'] != '0') { - $r = 'Предмет связан СЃ вами СЃСѓРґСЊР±РѕР№
    '; + $r = 'Предмет связан с вами судьбой
    '; } elseif (isset($po['toclan']) && $po['toclan1'] != $user['clan']) { - $r = 'Предмет и так пренадлежит клану...
    '; + $r = 'Предмет и так пренадлежит клану...
    '; } elseif ($user['inTurnir'] > 0 || $user['inTurnirnew'] > 0) { - $r = 'Во время участия в турнире запрещено использовать клановое хранилище.
    '; + $r = 'Во время участия в турнире запрещено использовать клановое хранилище.
    '; } else { if ((isset($po['sudba']) && $po['sudba'] != '0') || isset($po['icos']) || isset($po['frompisher']) || isset($po['fromlaba']) || ($item_['gift'] != '' && $item_['gift'] != 0)) { - $r = 'РќРµ удалось'; + $r = 'Не удалось'; } elseif (!isset($po['toclan'])) { $po['toclan'] = $user['clan'] . '#' . $user['id']; $item_['data'] = $this->impStats($po); if (mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '", `data` = "' . $item_['data'] . '" WHERE `id` = "' . $id . '" LIMIT 1')) { - $r = 'Р’С‹ успешно пожертвовали предмет "' . $item_['name'] . '" клану
    '; + $r = 'Вы успешно пожертвовали предмет "' . $item_['name'] . '" клану
    '; $col = $this->itemsX(((int)$id)); - $this->addDelo(2, $user['id'], '"System.transfer.MONEY": Предмет "' . $item_['name'] . '" (#id : "' . $id . '") (x' . $col . ') был пожертвован клану "' . $res['name'] . '" (' . $res['id'] . ').', time(), $user['city'], 'System.transfer.clan', 0, 0); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "4", "' . $user['login'] . '", "' . $item_['name'] . ' (x' . $col . ') РРґ : [' . $id . ']", "' . $user['id'] . '")'); + $this->addDelo(2, $user['id'], '"System.transfer.MONEY": Предмет "' . $item_['name'] . '" (#id : "' . $id . '") (x' . $col . ') был пожертвован клану "' . $res['name'] . '" (' . $res['id'] . ').', time(), $user['city'], 'System.transfer.clan', 0, 0); + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "4", "' . $user['login'] . '", "' . $item_['name'] . ' (x' . $col . ') Ид : [' . $id . ']", "' . $user['id'] . '")'); } else { - $r = 'РќРµ удалось...
    '; + $r = 'Не удалось...
    '; } } else { if (mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $id . '" LIMIT 1')) { $col = $this->itemsX(((int)$id)); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "3", "' . $user['login'] . '", "' . $item_['name'] . '" (x' . $col . ') РРґ : [' . $id . '], "' . $user['id'] . '")'); - $r = 'Р’С‹ успешно вернули предмет "' . $item_['name'] . '" РІ хранилище клана
    '; + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "3", "' . $user['login'] . '", "' . $item_['name'] . '" (x' . $col . ') Ид : [' . $id . '], "' . $user['id'] . '")'); + $r = 'Вы успешно вернули предмет "' . $item_['name'] . '" в хранилище клана
    '; } else { - $r = 'Не удалось...
    '; + $r = 'Не удалось...
    '; } } } } else { - $r = 'Предмет не найден.
    '; + $r = 'Предмет не найден.
    '; } return $r; } @@ -10641,7 +10609,7 @@ LIMIT 1')); $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1')); $user_itm = mysql_fetch_array(mysql_query('SELECT `id`,`bot`,`clone` FROM `stats` WHERE `id` = "' . $itm_['uid'] . '" LIMIT 1')); if ($user_itm['bot'] > 0 || $user_itm['clone'] > 0 || !isset($user_itm['id'])) { - $r = 'Вы не можете изьять данный предмет, он не принадлежит клану
    '; + $r = 'Вы не можете изьять данный предмет, он не принадлежит клану
    '; } elseif (isset($itm_['id'])) { if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) { if ($itm_['inOdet'] != 0) { @@ -10649,15 +10617,15 @@ LIMIT 1')); } else { $o = ''; } - $r = 'Вы успешно изъяли предмет "' . $itm_['name'] . '"
    '; + $r = 'Вы успешно изъяли предмет "' . $itm_['name'] . '"
    '; $col = $this->itemsX(((int)$id)); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') РРґ : [' . $id . '] | РЈ персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'); + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] | У персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'); } else { - $r = 'Р’Рѕ время участия РІ турнире запрещено использовать клановое хранилище.
    '; + $r = 'Во время участия в турнире запрещено использовать клановое хранилище.
    '; } } else { - $r = 'Предмет не найден.
    '; + $r = 'Предмет не найден.
    '; } return $r; } @@ -10674,14 +10642,14 @@ LIMIT 1')); } if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) { $col = $this->itemsX(((int)$id)); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') РРґ : [' . $id . '] РҐРѕР·СЏРёРЅ : [' . $cls . ']", "' . $user['id'] . '")'); + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] Хозяин : [' . $cls . ']", "' . $user['id'] . '")'); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'); - $r = 'Р’С‹ успешно взяли предмет "' . $itm_['name'] . '" РёР· хранилища
    '; + $r = 'Вы успешно взяли предмет "' . $itm_['name'] . '" из хранилища
    '; } else { - $r = 'Во время участия в турнире запрещено использовать клановое хранилище.
    '; + $r = 'Во время участия в турнире запрещено использовать клановое хранилище.
    '; } } else { - $r = 'Предмет не найден.
    ' . $id; + $r = 'Предмет не найден.
    ' . $id; } return $r; } @@ -10706,12 +10674,12 @@ LIMIT 1')); $col = $this->itemsX(((int)$pl['id'])); $it_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') РРґ : [' . $pl['id'] . ']", "' . $user['id'] . '")'); + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'); } elseif ($cls != $user['id'] && $pl['uid'] == $user['id']) { $col = $this->itemsX(((int)$pl['id'])); $it_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')); mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'); - mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') РРґ : [' . $pl['id'] . ']", "' . $user['id'] . '")'); + mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'); } } } @@ -10738,5 +10706,3 @@ LIMIT 1')); } } - -$u = user::start(); diff --git a/_incl_data/class/UserRegister.php b/_incl_data/class/UserRegister.php new file mode 100644 index 00000000..56b8eda8 --- /dev/null +++ b/_incl_data/class/UserRegister.php @@ -0,0 +1,28 @@ + 0 and `delete` = 0 +union all select data from eff_users where uid = ? and `delete` = 0'; + $iData = $db::getColumn($q, [$userId, $userId]); + $params = []; + $params2 = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $iData . '}'), true); + foreach ($iData as $datum) { + foreach (explode('|', $datum) as $inner) { + list($a, $b) = explode('=', $inner); + if (strpos($a, 'add') !== false || strpos($a, 'sv') !== false || $showAll) { + if (isset($params[$a])) { + $params[$a] += $b; + } else { + $params[$a] = $b; + } + } + } + } + return $params; + } +} \ No newline at end of file diff --git a/_incl_data/class/__battle.php b/_incl_data/class/__battle.php deleted file mode 100644 index ea503568..00000000 --- a/_incl_data/class/__battle.php +++ /dev/null @@ -1,9306 +0,0 @@ -users[$this->uids[$u1]]['login']); - $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type]; //защита цели - $v_p = 0 + round(($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4); //подавление защиты от магии - $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type]; //мощность мага - // - $r = ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); '; - - return $r; - } - - public function typeBattle($x) - { - $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок']; - if ($x < 50000) { - //Обычный бой - } elseif ($x >= 50000 && $x < 100000) { - $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; - } elseif ($x < 500000) { - $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; - } elseif ($x < 1000000) { - $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; - } elseif ($x < 2500000) { - $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; - } elseif ($x >= 5000000) { - $r = [150, 150, 'Судный День', 'Судный День']; - } - return $r; - } - - public $mncolor = [1 => '006699', 2 => '006699', 3 => '006699', 4 => '006699', 5 => '006699', 6 => '006699', 7 => '006699']; //не крит - public $mcolor = [1 => 'A00000', 2 => '008080', 3 => '0000FF', 4 => 'A52A2A', 5 => '006699', 6 => '006699', 7 => '006699']; //не крит - public $mname = ['огонь' => 1, 'воздух' => 2, 'вода' => 3, 'земля' => 4, 'свет' => 5, 'тьма' => 6, 'серая' => 7]; - public $prm = [ - /* - act: 1 - когда персонаж получает повреждение - 2 - когда персонаж наносит удар - type_of: 1 - уворот - 2 - крит - 3 - атака - 4 - защита - 5 - прочее - */ - 1 => ['name' => 'Прикрыться', 'act' => 1, 'type_of' => 5], - 2 => ['name' => 'Вломить', 'act' => 2, 'type_of' => 3], - 4 => ['name' => 'Сильный удар', 'act' => 2, 'type_of' => 3], - 7 => ['name' => 'Активная защита', 'act' => 1, 'type_of' => 4], - - - 290 => ['name' => 'Вытягивание души', 'act' => 1, 'type_of' => 4], - - //Излом хаоса - //291 => array( 'name' => 'Грация Боя', 'act' => 2, 'type_of' => 4 ), - - //Канализация - 294 => ['name' => 'Зловонная Вода', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 295 => ['name' => 'Проткнуть', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 296 => ['name' => 'Гнилая Кровь', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 297 => ['name' => 'Собраться', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 298 => ['name' => 'Приказ Слабости', 'act' => 2, 'type_of' => 3], - // - - 141 => ['name' => 'Призрачная защита', 'act' => 2, 'type_of' => 4], - 147 => ['name' => 'Призрачный кинжал', 'act' => 2, 'type_of' => 4], - 148 => ['name' => 'Призрачный топор', 'act' => 2, 'type_of' => 4], - 149 => ['name' => 'Призрачный удар', 'act' => 2, 'type_of' => 4], - 150 => ['name' => 'Призрачное лезвие', 'act' => 2, 'type_of' => 4], - - - 142 => ['name' => 'Призрачный огонь', 'act' => 2, 'type_of' => 4], - 144 => ['name' => 'Призрачный воздух', 'act' => 2, 'type_of' => 4], - 146 => ['name' => 'Призрачная земля', 'act' => 2, 'type_of' => 4], - 145 => ['name' => 'Призрачная вода', 'act' => 2, 'type_of' => 4], - - 8 => ['name' => 'Танец ветра', 'act' => 1, 'type_of' => 1], - 9 => ['name' => 'Дикая удача', 'act' => 2, 'type_of' => 3], - 10 => ['name' => 'Предвидение', 'act' => 1, 'type_of' => 1], - 11 => ['name' => 'Удачный удар', 'act' => 2, 'type_of' => 3], - - 45 => ['name' => 'Полная защита', 'act' => 1, 'type_of' => 4], - - 47 => ['name' => 'Слепая удача', 'act' => 2, 'type_of' => 2], - 48 => ['name' => 'Танец лезвий', 'act' => 1, 'type_of' => 1], - 49 => ['name' => 'Второе дыхание', 'act' => 1, 'type_of' => 1], - 138 => ['name' => 'Сокрушающий удар', 'act' => 2, 'type_of' => 3], - 140 => ['name' => 'Абсолютная защита', 'act' => 1, 'type_of' => 4], - 193 => ['name' => 'Усиленные удары', 'act' => 2, 'type_of' => 3], - //204 => array( 'name' => 'Обречённость', 'act' => 2 , 'type_of' => 5 ), - 204 => ['name' => 'Обречённость', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 211 => ['name' => 'Агрессивная защита', 'act' => 1, 'type_of' => 4], - 213 => ['name' => 'Коварный Уход', 'act' => 1, 'type_of' => 4], - 215 => ['name' => 'Скрытая ловкость', 'act' => 1, 'type_of' => 1], - 216 => ['name' => 'Скрытая сила', 'act' => 2, 'type_of' => 2], - 217 => ['name' => 'Разгадать тактику', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 219 => ['name' => 'Точный удар', 'act' => 2, 'type_of' => 3], - 220 => ['name' => 'Ставка на опережение', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 222 => ['name' => 'Последний удар', 'act' => 2, 'type_of' => 3], - 225 => ['name' => 'Магическая защита', 'act' => 1, 'type_of' => 4], - 226 => ['name' => 'Возмездие', 'act' => 1, 'type_of' => 4], - 231 => ['name' => 'Глухая защита', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 234 => ['name' => 'Осторожность', 'act' => 2, 'type_of' => 4], - 235 => ['name' => 'Шокирующий удар', 'act' => 2, 'type_of' => 3], - 342 => ['name' => 'Круговая Защита', 'act' => 0, 'type_of' => 0], - 343 => ['name' => 'Натиск', 'act' => 0, 'type_of' => 0], - - 237 => ['name' => 'Разведка боем', 'act' => 2, 'type_of' => 3 /*, 'moment' => 3*/], - - 239 => ['name' => 'Поступь смерти', 'act' => 2, 'type_of' => 3], - 240 => ['name' => 'Хлебнуть крови', 'act' => 2, 'type_of' => 5] - - //Оледенение - , 21 => ['name' => 'Оледенение [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 73 => ['name' => 'Оледенение [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 74 => ['name' => 'Оледенение [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 75 => ['name' => 'Оледенение [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 76 => ['name' => 'Оледенение [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 77 => ['name' => 'Оледенение [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 78 => ['name' => 'Оледенение [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 79 => ['name' => 'Оледенение [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Отравление - , 22 => ['name' => 'Отравление [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 80 => ['name' => 'Отравление [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 81 => ['name' => 'Отравление [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 82 => ['name' => 'Отравление [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 83 => ['name' => 'Отравление [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 84 => ['name' => 'Отравление [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Регенерация - , 36 => ['name' => 'Регенерация [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 85 => ['name' => 'Регенерация [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 86 => ['name' => 'Регенерация [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 87 => ['name' => 'Регенерация [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 88 => ['name' => 'Регенерация [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 89 => ['name' => 'Регенерация [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 90 => ['name' => 'Регенерация [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Ядовитое облако - , 23 => ['name' => 'Ядовитое Облако [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 70 => ['name' => 'Ядовитое Облако [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 71 => ['name' => 'Ядовитое Облако [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 72 => ['name' => 'Ядовитое Облако [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Иней - , 269 => ['name' => 'Иней [8]', 'act' => 2, 'type_of' => 9] - , 276 => ['name' => 'Иней [9]', 'act' => 2, 'type_of' => 9] - , 277 => ['name' => 'Иней [10]', 'act' => 2, 'type_of' => 9] - - //Духи Льда - , 270 => ['name' => 'Духи Льда', 'act' => 2, 'type_of' => 5, 'type_sec' => 5] - - //Хватка Льда - , 280 => ['name' => 'Хватка Льда', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Жертва Воде - , 281 => ['name' => 'Жертва Воде', 'act' => 2, 'type_of' => 5] - - //Ледяное спасение - , 282 => ['name' => 'Ледяное Спасение', 'act' => 2, 'type_of' => 5] - - // - // - - //Медитация - , 24 => ['name' => 'Медитация', 'act' => 2, 'type_of' => 0, 'moment' => 3] - - //Магический барьер - , 210 => ['name' => 'Магический Барьер [4]', 'act' => 2, 'type_of' => 8] - , 209 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8] - , 208 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8] - , 207 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8] - , 206 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8] - , 284 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8] - - //Силовое поле - , 175 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8] - , 176 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8] - , 177 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8] - , 178 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8] - , 179 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8] - - // - // - - //Метеорит - , 42 => ['name' => 'Метеорит [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 121 => ['name' => 'Метеорит [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 122 => ['name' => 'Метеорит [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 123 => ['name' => 'Метеорит [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 124 => ['name' => 'Метеорит [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 125 => ['name' => 'Метеорит [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Каменный Щит - , 249 => ['name' => 'Каменный Щит', 'act' => 2, 'type_of' => 4] - - //Песчанный щит - , 248 => ['name' => 'Песчаный Щит', 'act' => 2, 'type_of' => 4] - - //Заземление - , 251 => ['name' => 'Заземление: Плюс', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 252 => ['name' => 'Заземление: Минус', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - // - - //Туманный образ - , 273 => ['name' => 'Туманный Образ [10]', 'act' => 1, 'type_of' => 4] - , 286 => ['name' => 'Туманный Образ [9]', 'act' => 1, 'type_of' => 4] - , 287 => ['name' => 'Туманный Образ [8]', 'act' => 1, 'type_of' => 4] - , 288 => ['name' => 'Туманный Образ [7]', 'act' => 1, 'type_of' => 4] - - // - , 255 => ['name' => 'Воздушный Щит', 'act' => 2, 'type_of' => 8] - - // - // - - //Пещерные приемы - , 337 => ['name' => 'Выпить Душу', 'act' => 2, 'type_of' => 5] - - //Пожирающее Пламя - , 33 => ['name' => 'Пожирающее Пламя [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 56 => ['name' => 'Пожирающее Пламя [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 57 => ['name' => 'Пожирающее Пламя [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 58 => ['name' => 'Пожирающее Пламя [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 59 => ['name' => 'Пожирающее Пламя [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 60 => ['name' => 'Пожирающее Пламя [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - //Огненный Щит - , 245 => ['name' => 'Огненный Щит', 'act' => 2, 'type_of' => 9] - //Эффекты - , 327 => ['name' => 'Живая Вода', 'act' => 2, 'type_of' => 0, 'moment' => 3] - , 328 => ['name' => 'Сушеный Мухомор', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 329 => ['name' => 'Мешочек Пыли', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 330 => ['name' => 'Отвар когтей ПГ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 331 => ['name' => 'Отвар Василиска', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 332 => ['name' => 'Точильный Камень', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 333 => ['name' => 'Волшебный Эликсир', 'act' => 2, 'type_of' => 0, 'moment' => 3] - , 334 => ['name' => 'Цепь Защитника', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 335 => ['name' => 'Эликсир Безумного Критовика', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - //1 сентября, квест - , 299 => ['name' => 'Ядовитые язвы', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 300 => ['name' => 'Элементарный заряд', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 301 => ['name' => 'Темное ранение', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 302 => ['name' => 'Подлечиться', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 303 => ['name' => 'Шкура поглощения', 'act' => 2, 'type_of' => 4] - , 304 => ['name' => 'Особенное проклятье!', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , 305 => ['name' => 'Кровожадность', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - ]; - - //Сохраняем лог в архик - public function saveLogs($id, $type) - { - if ($type == 'all') { - $type = ''; - mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID) . ''); - } else { - mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID - 5) . ''); - } - mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ' . $type . ''); - mysql_query('DELETE FROM `battle_stat` WHERE `battle` < "' . ($this->info['id'] - 100) . '" '); - mysql_query('DELETE FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" '); - //mysql_query('OPTIMIZE TABLE `battle_logs`'); - //mysql_query('OPTIMIZE TABLE `battle_stat`'); - //mysql_query('OPTIMIZE TABLE `battle_actions`'); - } - - public function hphe($uid, $hp, $false_t7 = false) - { - global $u; - if (!isset($this->stats[$this->uids[$uid]])) { - echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!'; - } else { - $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']); - $hpall = $this->stats[$this->uids[$uid]]['hpAll']; - if ($hp > 0) { - //Хиляем - if ($hpnow + $hp > $hpall) { - $hpli = $hpnow + $hp - $hpall; - $hp -= $hpli; - } - if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) { - $hp = 0; - } else { - $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']); - } - //Отнимаем тактику - if ($false_t7 == false) { - if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) { - $hp = 0; - $this->users[$this->uids[$uid]]['tactic7'] = 0; - $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; - } else { - $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2); - if ($gdhh == 0) { - $gdhh = 0.01; - } - - $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100); - - $this->users[$this->uids[$uid]]['tactic7'] = round(($this->users[$this->uids[$uid]]['tactic7'] - $gdhh), 2); - if ($this->users[$this->uids[$uid]]['tactic7'] < 0) { - $this->users[$this->uids[$uid]]['tactic7'] = 0; - } - $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; - if ($gdhd < 100) { - $hp = floor($hp / 100 * $gdhd); - } - } - } - } elseif ($hp < 0) { - //Отнимаемф - if ($hpnow + $hp < 0) { - $hpli = $hpnow + $hp; - $hp += -($hpli); - } - } - - if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) { - $hp = 0; - } - - $this->stats[$this->uids[$uid]]['last_hp'] = -$hp; - mysql_query('UPDATE `stats` SET - `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", - `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '" - WHERE `id` = "' . $uid . '" LIMIT 1'); - - } - - return floor($hp); - } - - public function deleffm($pid, $uid, $id) - { - if ($id > 0) { - if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . mysql_real_escape_string($id) . '" AND `v1` = "priem" AND `v2` != "0" LIMIT 1')) { - echo '[*Ошибка удаления прием[' . $id . ',' . $pid . ',' . $uid . ']]'; - } - } else { - if (!mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `v1` = "priem" AND `v2` = "' . $pid . '"')) { - - } - } - //echo '['.$id.','.$pid.','.$uid.']'; - } - - - public $e, //Ошибка (текст) - $cached = false, //Кэширование данных - $expCoef = 0, # % опыта в бою - $aBexp = 0, //Добавочный опыт в боях - $mainStatus = 1, //Отображаем главное окно (1 - можно бить, 2 - ожидаем ход противника, 3 - Проиграли. Ожидаем завершения поединка) - $info = [], //Информация о поединке - $users = [], //Информация о пользователях в этом бою - $stats = [], //Информация о статах пользователей в этом бою - $uids = [], //Список пользователей и их id в stats или users пример id пользователя = 555 , то $uids[555] выдаст его порядковый номер в массиве users \ stats - $atacks = [], //Список ударов в этом бою (действующих) - $ga = [], //Список uid кто нанес удар и по кому $ga[ {id кто ударил} ][ {id кого ударил} ] - $ag = [], //Список uid кто нанес удар и по кому $ga[ {id кого ударили} ][ {id кто ударил} ] - $na = 1, //возможность использовать удар - $np = 1, //возможность использовать приемы - $nm = 1, //возможность использовать заклятия - $hodID = 0, - $stnZbVs = 0, - $bots = [], // ID ботов - $iBots = [], // i бота - $stnZb = [], - $uAtc = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0], //Если игрок нанес удар - $lg_itm = [0 => ['грудью', 'ребром руки', 'лбом', 'кулаком', 'ногой', 'левой ногой', 'правой ногой', 'коленом'], 1 => ['ножом', 'тыльной стороной лезвия ножа', 'рукоятью ножа', 'лезвием ножа'], 2 => ['сучковатой палкой', 'поленом', 'тяжелой дубиной', 'дубиной', 'рукоятью молота'], 3 => ['секирой', 'топором', 'лезвием секиры', 'алебардой', 'тяжелым держаком', 'длинной секирой'], 4 => ['ножнами', 'гардой', 'мечом', 'лезвием меча', 'рукоятью меча', 'тупым лезвием', 'острой стороной меча', 'огромным мечом'], 5 => ['сучковатой палкой', 'посохом', 'тяжелой тростью', 'корявым посохом', 'основанием посоха'], 22 => ['костылем']], // Чем лупили - $lg_zon = [1 => ['в нос', 'в глаз', 'в челюсть', 'по переносице', 'в кадык', 'по затылку', 'в правый глаз', 'в левый глаз', 'в скулу'], 2 => ['в грудь', 'в корпус', 'в солнечное сплетение', 'в сердце', 'в область лопаток'], 3 => ['в бок', 'по желудку', 'по левой руке', 'по правой руке'], 4 => ['по <вырезано цензурой>', 'в пах', 'в промежность', 'по левой ягодице', 'по правой ягодице'], 5 => ['по ногам', 'в область правой пятки', 'в область левой пятки', 'по коленной чашечке', 'по икрам']]; // Куда лупили - public $is = [], $items = []; - - //Очистка кэша для ... - public $uclearc = [], $ucleari = []; - - public function clear_cache($uid) - { - if ($uid > 0 && !isset($this->uclearc[$uid])) { - $this->uclearc[$uid] = true; - $this->ucleari[] = $uid; - } - } - - public function clear_cache_start() - { - $i = 0; - while ($i < count($this->ucleari)) { - mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($this->ucleari[$i]) . '"'); - $i++; - } - } - - //Проверка урон приемов над защитными - public function testYronPriemAttack($pid, $u1, $u2, $hp) - { - - //Игрок 1 бьет по Игроку 2 при помощи приема № pid на hp ед. здоровья - - /* - Полная защита - */ - //Получаем приемы и смотрим когда какой действует - $eff = $this->stats[$this->uids[$u2]]['effects']; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - // id прием $eff[$j]['v2'] - if ($eff[$j]['v2'] == 140 || $eff[$j]['v2'] == 211 || $eff[$j]['v2'] == 45) { //|| $eff[$j]['v2'] == 45 - //Приемы от которых урон = 1 , то есть выдаем 0 - $hp['y'] = -1; - $hp['r'] = 1; - $hp['k'] = 2; - $hp['m_y'] = 1; - $hp['m_k'] = 2; - } - } - $j++; - } - unset($eff); - - return $hp; - } - - //Расчет маг.крита - public function magKrit($l2, $t) - { - $r = 0; - $r = $l2 * 2 - 7; - if ($r > $t) { - //магический промах (серый удар, в 2 раза меньше) 6% - //250 ед. защиты от магии дает 1% шанса увернуться от магии - //$r = -1; , промах -- - $r = 0; - } else { - //каждая владелка дает 3% шанс крита - $r = ceil($t * 0.75); - if ($r > 30) { - $r = 30; - } - if (rand(0, 10000) < $r * 100) { - //крит удар - $r = 1; - } else { - $r = 0; - } - } - return $r; - } - - - //Обновление НР - public function hpRef() - { - - } - - //Расчет опыта - public function testExp($y, $s1, $s2, $id1, $id2) - { - global $u, $c; - - - //ТУТ таблица умножения оыта - $oplevel = [ // Максимум для каждого уровня. - 0 => 1, - 1 => 1, - 2 => 1, - 3 => 1, - 4 => 2, - 5 => 2, - 6 => 2, - 7 => 2, - 8 => 3, - 9 => 4, - 10 => 5, - 11 => 6, - 12 => 7, - 13 => 50, - 14 => 75 - ]; - - if ($y < 0) { - $y = 0; - } - if ($s2['hpNow'] < 0) { - //echo '[f]'; - $y = 0; - } - if ($s2['hpNow'] < $y) { - //echo '[d]'; - $y = $s2['hpNow']; - } - if ($y < 0) { /*echo '[r]';*/ - $y = 0; - } - - $addExp = 0 + ($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]); - if ($s2['hpAll'] - $y <= 0) { - //echo '[a]'; - $addExp = 100; - } - - if ($addExp < 0) { - $addExp = 0; - } - if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') { - if ($doexp < 0) { - $doexp = 0; - } - - if ($this->info['razdel'] != 5 && $c['exp_limit_many'] == true) { - $texp = mysql_fetch_array(mysql_query('SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = "' . $id1 . '" AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = "' . $id2 . '" AND `b`.`team` != `a`.`team` AND `b`.`time` > "' . (time() - 86400) . '" ) LIMIT 1')); - $texp = $texp[0]; - // - if ($texp > 5) { - $addExp = $addExp * 0.00; - } elseif ($texp > 4) { - $addExp = $addExp * 0.50; - } elseif ($texp > 3) { - $addExp = $addExp * 0.75; - } elseif ($texp > 2) { - $addExp = $addExp * 1.00; - } elseif ($texp > 1) { - $addExp = $addExp * 1.00; - } else { - $addExp = $addExp * 1.00; - } - } - // - if ($this->users[$this->uids[$s2['id']]]['bot'] > 0) { - //$addExp = round($addExp/5); - } - unset($doexp); - } else { - $addExp = 0; - } - - /* - if($s1['level'] > $s2['level']){ - $minProc = 100 - 33*( $s1['level']-$s2['level'] ); - if($minProc < 1) { - $minProc = 1; - } - $addExp = round($addExp/100*$minProc); - } - */ - - if ($this->users[$this->uids[$s2['id']]]['bot_id'] == 0 && $this->stats[$this->uids[$s2['id']]]['itmslvl'] == 0) { - //$addExp = 0; - } - - if ($this->info['typeBattle'] == 9) { - //Нападение - //за 8 и ниже не дают опыт - /*if( $this->users[$this->uids[$s1['id']]]['level'] > $this->users[$this->uids[$s2['id']]]['level'] ) { - if( $this->users[$this->uids[$s2['id']]]['level'] <= 8 ) { - $addExp = 0; - } - }*/ - } - - return $addExp; - } - - //Добавляем опыт \ нанесенный урон - public function takeExp($id, $y, $id1, $id2, $mgregen = false, $nobattle_uron = false) - { - global $u; - if (isset($this->users[$this->uids[$id]])) { - $s1 = $this->stats[$this->uids[$id1]]; - $s2 = $this->stats[$this->uids[$id2]]; - if ($id1 != $id2) { - $e = $this->testExp($y, $s1, $s2, $id1, $id2); - } else { - $e = 0; - } - - if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1) { - $dun_limitForLevel = [ // Максимум для каждого уровня. - 4 => 750, - 5 => 1500, - 6 => 3500, - 7 => 8000, - 8 => 25000, - 9 => 50000, - 10 => 75000, - 11 => 125000, - 12 => 250000, - 13 => 500000, - 14 => 750000 - ]; - $dun_expFactor = [ // Максимум для каждого уровня. - 4 => 5, - 5 => 5, - 6 => 5, - 7 => 5, - 8 => 5, - 9 => 3, - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 14 => 1 - ]; - - if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) { - $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']]; - } - if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит - $dun_exp = []; // Текущий лимит опыта игрока в подземельях. - $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$this->uids[$id1]]['id'] . '" LIMIT 1')); - $rep = explode(',', $rep['dungeonexp']); - foreach ($rep as $key => $val) { - $val = explode('=', $val); - if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) $dun_exp[(int)$val[0]] = (int)$val[1]; // текущий лимит опыта в подземке - } - unset($rep); - - if (!isset($dun_exp[$this->info['dungeon']])) $dun_exp[$this->info['dungeon']] = 0; - if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // Если лимит не задан, опыт не даем. - $e = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ) { // Если лимит уже достигнут, опыт не даем. - $e = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']] - ) { // Если текущая репутация не достигла лимита. - if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { - // Если опыта набрано достаточно, для достижения лимита. - $e = abs($e - abs($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']]))); - $dun_exp[$this->info['dungeon']] += $e; - } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) { - // Если опыта недостаточно, для достижения лимита. - $e = $e; - $dun_exp[$this->info['dungeon']] += $e; - } else { - $e = 0; - } - } else { // В любой непонятной ситуцаии. - $e = 0; - } - } else $e = $e; // Опыт в пещерах. - if ($this->info['dungeon'] == 102 && (int)$this->users[$this->uids[$id1]]['bot_id'] == 0) { - $e = floor($e * 0.002); - } - } - - $this->users[$this->uids[$id1]]['battle_exp'] += floor($e);//round($e,5); - //echo '[['.$id1.']+'.$e.']'; - // - if ($mgregen == false && $nobattle_uron == false) { - $this->users[$this->uids[$id1]]['battle_yron'] += floor($y); - if ($this->stats[$this->uids[$id1]]['notactic'] != 1) { - if ($s2['hpAll'] <= 1000) { - if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), 10); - } else { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), 10) / 3; - } - } else { - if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10); - } else { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10) / 3; - } - } - } - } - - $upd = mysql_query('UPDATE `stats` SET `last_hp` = "' . $this->users[$this->uids[$id1]]['last_hp'] . '",`tactic6` = "' . $this->users[$this->uids[$id1]]['tactic6'] . '",`battle_yron` = "' . $this->users[$this->uids[$id1]]['battle_yron'] . '",`battle_exp` = "' . $this->users[$this->uids[$id1]]['battle_exp'] . '" WHERE `id` = "' . ((int)$id1) . '" LIMIT 1'); - if (!$upd) { - echo '[не удача при использовании приема]'; - } else { - $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; - $this->clear_cache($id1); - $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - if ($id1 == $u->info['id']) { - $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; - $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron']; - $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic']; - $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic']; - } - } - unset($s1, $s2); - } - } - - //Добавляем нанесенный урон - public function takeYronNow($uid, $y) - { - global $u; - $this->users[$this->uids[$uid]]['battle_yron'] += floor($y); - $this->stats[$this->uids[$uid]]['battle_yron'] += floor($y); - if ($uid == $u->info['id']) { - $u->info['battle_yron'] += floor($y); - $u->stats['battle_yron'] += floor($y); - } - mysql_query('UPDATE `stats` SET `battle_yron` = `battle_yron` + "' . mysql_real_escape_string(floor($y)) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); - } - - //JS информация о игроке - public function myInfo($id, $t) - { - global $c, $u; - if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) { - if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) { - //Всегда обновляем - $this->users[$this->uids[$id]] = mysql_fetch_array(mysql_query('SELECT - - `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1')); - $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true); - $this->stats[$this->uids[$id]]['items'] = $this->stats[$this->uids[$id]]['items']; - $this->stats[$this->uids[$id]]['effects'] = $this->stats[$this->uids[$id]]['effects']; - /* - $ur = $this->users[$this->uids[$id]]; - $st = $this->stats[$this->uids[$id]]; - $itm = $this->stats[$this->uids[$id]]['items']; - $eff = $this->stats[$this->uids[$id]]['effects']; - */ - } - - //ssecho '['.$id.' -> '.$this->users[$this->uids[$id]]['last_hp'].']'; - - $ur = $this->users[$this->uids[$id]]; - $st = $this->stats[$this->uids[$id]]; - $itm = $this->stats[$this->uids[$id]]['items']; - $eff = $this->stats[$this->uids[$id]]['effects']; - $ef = ''; - $i = 0; - //effs_hide.gif - if ($u->info['seff'] < 1) { - //$ef .= '
    '; - $ef .= '
    Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
    '; - - while ($i != -1) { - $nseef = 0; - if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) { - if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) { - $nseef = 1; - if ($eff[$i]['v1'] == 'priem') { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - } - if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) { - $nseef = 0; - } - } - } - - if (isset($eff[$i]) && $eff[$i] != 'delete') { - if ($nseef == 0) { - - $ei = '' . $eff[$i]['name'] . ''; - if ($eff[$i]['x'] > 1) { - //$ei .= ' [x'.$eff[$i]['x'].'] '; - $ei .= ' x' . $eff[$i]['x'] . ' '; - } - if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) { - $ei .= ' (Эликсир)'; - } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) { - $ei .= ' (Заклятие)'; - } elseif ($eff[$i]['type1'] == 14) { - $ei .= ' (Прием)'; - } elseif ($eff[$i]['type1'] == 15) { - $ei .= ' (Изучение)'; - } elseif ($eff[$i]['type1'] == 17) { - $ei .= ' (Проклятие)'; - } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) { - $ei .= ' (Травма)'; - } elseif ($eff[$i]['type1'] == 20) { - $ei .= ' (Пристрастие)'; - } elseif ($eff[$i]['type1'] == 22) { - $ei .= ' (Ожидание)'; - } else { - $ei .= ' (Эффект)'; - } - $ei .= '
    '; - - $out = ''; - $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']); - if ($eff[$i]['timeAce'] == 0) { - $time_still += $eff[$i]['timeUse']; - } - $time_still -= time(); - if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) { - if ($eff[$i]['type1'] != 13) { - $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; - } - } else { - if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) { - $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; - //$ei .= 'Зарядов: '.$out.'
    '; - } elseif ($eff[$i]['hod'] >= 0) { - $ei .= 'Зарядов: ' . $eff[$i]['hod'] . ''; - } - } - - if ($eff[$i]['user_use'] != '') { - if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') { - $ei .= '
    Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . ''; - } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') { - $ei .= '
    Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . ''; - } - } - - //Действие эффекта - $tr = ''; - $ti = $u->items['add']; - $x = 0; - $ed = $u->lookStats($eff[$i]['data']); - while ($x < count($ti)) { - $n = $ti[$x]; - if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') { - $z = ''; - if ($ed['add_' . $n] > 0) { - $z = '+'; - } - $tr .= '
    ' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n]; - } - $x++; - } - - if ($ed['add_mib1'] != 0) { - if ($ed['add_mab1'] != 0) { - $tr .= '
    Броня головы: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . ''; - } else { - $m1l = $ed['add_mib1']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
    Броня головы: ' . $m1l . ''; - } - } - if ($ed['add_mib2'] != 0) { - if ($ed['add_mab2'] != 0) { - $tr .= '
    Броня корпуса: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . ''; - } else { - $m1l = $ed['add_mib2']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
    Броня корпуса: ' . $m1l . ''; - } - } - if ($ed['add_mib3'] != 0) { - if ($ed['add_mab3'] != 0) { - $tr .= '
    Броня пояса: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . ''; - } else { - $m1l = $ed['add_mib3']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
    Броня пояса: ' . $m1l . ''; - } - } - if ($ed['add_mib4'] != 0) { - if ($ed['add_mab4'] != 0) { - $tr .= '
    Броня ног: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . ''; - } else { - $m1l = $ed['add_mib4']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
    Броня ног: ' . $m1l . ''; - } - } - - $efix = 0; - if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) { - $efix = $ed['add_pog2']; - } - if (isset($ed['add_pog'])) { - $tr .= '
    Магический барьер способен поглотить еще ' . $ed['add_pog'] . ' ед. урона'; - } - if (isset($ed['add_pog2'])) { - $tr .= '
    Магический барьер способен поглотить еще ' . $ed['add_pog2'] . ' ед. урона (' . $ed['add_pog2p'] . '%)'; - } - - if ($tr != '') { - $ei .= $tr; - } - if ($eff[$i]['info'] != '') { - $ei .= '
    Информация:
    ' . $eff[$i]['info']; - } - - //$ef .= ''; - $ef .= '
    '; - unset($efix); - } - } elseif ($eff[$i] != 'delete') { - $i = -2; - } - $i++; - } - } else { - $ef .= '
    Развернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
    '; - } - if ($st['itmslvl'] == 0 && $ur['bot_id'] == 0) { - //$ef .= '
    Легкое вооружение (Эффект)
    Осталось: Бесконечно\">
    '; - } - - $ca = ''; - if ($ur['clan'] > 0) { - $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $ur['clan'] . '" LIMIT 1')); - if (isset($cl['id'])) { - $ca = ''; - } - } - if ($ur['align'] > 0) { - $ca = '' . $ca; - } - if ($ur['login2'] == '') { - $ur['login2'] = $ur['login']; - } - if (floor($st['hpNow']) > $st['hpAll']) { - $st['hpNow'] = $st['hpAll']; - } - if (floor($st['mpNow']) > $st['mpAll']) { - $st['mpNow'] = $st['mpAll']; - } - $stsua = '' . $ur['login2'] . ''; - $stsua .= '
    Сила: ' . $st['s1']; - $stsua .= '
    Ловкость: ' . $st['s2']; - $stsua .= '
    Интуиция: ' . $st['s3']; - $stsua .= '
    Выносливость: ' . $st['s4']; - if ($st['s5'] != 0) { - $stsua .= '
    Интелект: ' . $st['s5']; - } - if ($st['s6'] != 0) { - $stsua .= '
    Мудрость: ' . $st['s6']; - } - if ($st['s7'] != 0) { - $stsua .= '
    Духовность: ' . $st['s7']; - } - if ($u->info['admin'] > 0) { - if (isset($ur['align']) && $ur['align'] == 9) { - $align = $ur['align']; - } else { - $align = $ur['align']; - } - } - $tp_img = [ - 1 => 4, - 2 => 5, - 14 => 6, - 3 => 7, - 5 => 8, - 7 => 9, - 17 => 10, - 16 => 11, - 13 => 12, - 10 => 13, - 9 => 14, - 8 => 15, - 11 => 17, //кольцо 2 - 12 => 18 //кольцо 3 - ]; - $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor($st['hpNow']) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor($st['mpAll']) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();'; - $i = 0; - while ($i < count($itm)) { - // - if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) { - $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]]; - } - //генерируем предметы - $ttl = '' . $itm[$i]['name'] . ''; - $td = $u->lookStats($itm[$i]['data']); - $lvar = ''; - if ($td['add_hpAll'] > 0) { - if ($td['add_hpAll'] > 0) { - $td['add_hpAll'] = '+' . $td['add_hpAll']; - } - $lvar .= '
    Уровень жизни: ' . $td['add_hpAll'] . ''; - } - if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) { - $lvar .= '
    Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']) . ''; - } - if ($td['add_mab1'] > 0) { - if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab1'] < 0) { - $m1l = ''; - } - $lvar .= '
    Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; - } else { - $lvar .= '
    Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; - } - } - if ($td['add_mab2'] > 0) { - if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab2'] < 0) { - $m1l = ''; - } - $lvar .= '
    Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; - } else { - $lvar .= '
    Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; - } - } - if ($td['add_mab3'] > 0) { - if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab3'] < 0) { - $m1l = ''; - } - $lvar .= '
    Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; - } else { - $lvar .= '
    Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; - } - } - if ($td['add_mab4'] > 0) { - if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab4'] < 0) { - $m1l = ''; - } - $lvar .= '
    Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; - } else { - $lvar .= '
    Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; - } - } - if ($itm[$i]['iznosMAX'] > 0) { - if ($itm[$i]['iznosMAXi'] == 999999999) { - $lvar .= '
    Долговечность: неразрушимо'; - } else { - $lvar .= '
    Долговечность: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']); - } - } - $ttl .= $lvar; - $ccv = ''; - - if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') { - if ($itm[$i]['magic_inc'] == '') { - $itm[$i]['magic_inc'] = $itm[$i]['magic_inci']; - } - $mgi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $itm[$i]['magic_inc'] . '" AND `type1` = "12345" LIMIT 1')); - if (isset($mgi['id2'])) { - $mgilog = ''; - $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);'; - } - } - - $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");'; - $i++; - } - - return $info; - } else { - return false; - } - } - - //Проверка на выживших - public function testUsersLive() - { - $r = false; - $tl = 0; - $i = 0; - $j = 0; - while ($i < count($this->uids)) { - if ($this->stats[$i]['id'] > 0) { - if (floor($this->stats[$i]['hpNow']) < 1) { - $this->stats[$i]['hpNow'] = 0; - } - $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); - if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { - $tml[$this->users[$i]['team']] = 1; - $tmv[$j] = $this->users[$i]['team']; - $tl++; - } - } - $i++; - } - if ($tl > 1) { - $r = true; - } - return $r; - } - - //Мини лог - public function miniLogAdd($user, $text) - { - $txt = $text; - $vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time() . '||time2=' . time() . '||s1=' . $user['sex'] . '||t1=' . $user['team'] . '||login1=' . $user['login'] . '||'; - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => ($this->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $mas1['text'] = $txt; - $this->add_log($mas1); - } - - //Проверяем завершение боя - public function testFinish() - { - global $u; - // - mysql_query('START TRANSACTION;'); - // - $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` = -1 LIMIT 1 FOR UPDATE')); - //mysql_query('UPDATE `battle` SET `testfinish` = "'.$u->info['id'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - // - mysql_query('COMMIT;'); - // - if ($this->info['team_win'] == -1 && isset($test['id'])) { - - $hp = []; - $tml = []; - $tmv = []; - $tl = 0; - $i = 0; - $j = 0; - while ($i < count($this->uids)) { - if ($this->stats[$i]['id'] > 0) { - if (floor($this->stats[$i]['hpNow']) < 1) { - $this->stats[$i]['hpNow'] = 0; - } - $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); - if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { - $tml[$this->users[$i]['team']] = 1; - $tmv[$j] = $this->users[$i]['team']; - $tl++; - } - } - $i++; - } - - if ($tl <= 1) { - //Доп.проверка - $tmHpNow = []; - $tmNow = []; - $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`u`.`battle`,`s`.`team`,`s`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - while ($pl = mysql_fetch_array($sp)) { - if (!isset($tmHpNow[$pl['team']])) { - $tmHpNow[$pl['team']] = 0; - $tmNow[] = $pl['team']; - } - $hpTm = floor($pl['hpNow']); - if ($hpTm < 0) { - $hpTm = 0; - } - if ($hpTm > 0) { - $tmHpNow[$pl['team']] += $pl['hpNow']; - } - } - $gdj = 0; - $i = 0; - while ($i < count($tmNow)) { - if (isset($tmNow[$i])) { - $j = $tmNow[$i]; - if ($tmHpNow[$j] > 0) { - $gdj++; - } - } - $i++; - } - if ($gdj > 1) { - $tl = $gdj; - echo 'Поединок может завершиться не корректно... (Сообщите Администрации об этом)'; - } - } - - if ($tl <= 1) { - //завершаем поединок, кто-то один победил, либо ничья - - $i = 0; - $tmwin = 0; - while ($i < count($tmv)) { - if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { - $tmwin = $tmv[$i]; - } - $i++; - } - - if ($this->info['izlom'] == 0) { - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - //данные о игроках в бою - unset($this->users, $this->stats, $this->uids, $this->bots, $this->iBots); - $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC'); - $ir = 0; - $bi = 0; - $this->users = null; - $this->stats = null; - $this->uids = null; - $this->bots = null; - $this->iBots = null; - while ($pl = mysql_fetch_array($trl)) { - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$ir] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - //записываем статы - $this->stats[$ir] = $u->getStats($pl, 0, 0, false, false, true); - $ir++; - } - } - } elseif (!isset($this->uids[$u->info['id']])) { - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - //данные о игроках в бою - $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $this->info['id'] . '" LIMIT 1'); - $pl = mysql_fetch_array($trl); - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[count($this->users)] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[count($this->bots)] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - } - //записываем статы - $this->stats[count($this->stats)] = $u->getStats($pl, 0, 0, false, false, true); - } - } - - - if ($this->info['izlom'] > 0 && $tmwin == 1) { - // выкидываем ботов из боя - $i = 0; - $dlt = ''; - $dlt2 = ''; - $sp = mysql_query('SELECT `users`.`id`,`stats`.`bot`,`stats`.`team` FROM `users`,`stats` WHERE `users`.`battle` = "' . $this->info['id'] . '" AND `stats`.`id` = `users`.`id` LIMIT 250'); - while ($pl = mysql_fetch_array($sp)) { - if ($pl['bot'] == 1 && $pl['team'] != $u->info['team']) { - $dlt .= ' `id`="' . $pl['id'] . '" OR'; - $dlt2 .= ' `uid`="' . $pl['id'] . '" OR'; - $i++; - } - - } - - if ($i > 0) { - $dlt = trim($dlt, 'OR'); - $dlt2 = trim($dlt2, 'OR'); - mysql_query('DELETE FROM `users` WHERE ' . $dlt . ' LIMIT ' . $i); - mysql_query('DELETE FROM `stats` WHERE ' . $dlt . ' LIMIT ' . $i); - mysql_query('DELETE FROM `items_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); - mysql_query('DELETE FROM `eff_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); - } - - unset($i, $dlt, $dlt2); - - $j = 0; - $k = 0; - $obr = 0; - - //Это излом, добавляем еще ботов - if ($this->get_chanse(20) == true) { - //Уникальные монстры - if ($this->info['izlomLvl'] == 8) { - $bots = ['Валентайский Охотник', 'Шипокрыл Хаоса', 'Шипокрыл', 'Лик Хаоса', 'Фанатик Хаоса']; - //$bots = array( 'Валентайский Охотник' ); - } - $logins_bot = []; - // - echo '
    Приближается нечто...
    '; - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, round($this->info['izlomRoundSee'])); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0 - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - $u->addAction(time(), 'win_bot_' . $id['id'], '', $this->users[$i]['id']); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - - } - } else { - //Обычные монстры - if ($this->info['izlomLvl'] == 8) { - $bots = ['Литейщик', 'Проклятие Глубин', 'Пустынник Маньяк', 'Пустынник Убийца', 'Рабочий Мглы', 'Смотритель Мглы', 'Сторож Мглы']; - } - $logins_bot = []; - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, ($this->info['izlomRoundSee'] * 2)); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0 - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0 - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - // - if (rand(0, 100) < 70) { - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0 - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - } - //Каждые 10 вол = +1 монстр - $irb = floor($this->info['izlomRoundSee'] / 10); - while ($irb > 0) { - // - if (rand(0, 100) < 20) { - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0 - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - } - $irb--; - } - } - // - unset($logins_bot); - - if ($j == 0) { - //конец излома - $this->finishBattle($tml, $tmv, null, $tl); - $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); - } else { - $this->info['izlomRound'] = $iz['round']; - mysql_query('UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; - $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; - $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; - $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + 1), - 'vars' => $vLog, - 'type' => 1 - ]; - if ($u->info['sex'] == 1) { - $mas['text'] = '' . date('H:i') . '' . $u->info['login'] . ' воспользовалась приемом "Передышка".'; - } else { - $mas['text'] = '' . date('H:i') . '' . $u->info['login'] . ' воспользовался приемом "Передышка".'; - } - if ($u->stats['hpNow'] < $u->stats['hpAll']) { - $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); - if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { - $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); - } - $mas['text'] .= ' +' . $hpSks . ''; - } else { - $hpSks = 0; - $mas['text'] .= ' --'; - } - $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; - $this->add_log($mas); - - mysql_query('UPDATE `stats` SET `hpNow` = "' . ($u->info['hpNow'] + ($u->stats['hpAll'] * ((rand(15, 25)) / 100))) . '",`mpNow` = "' . ($u->info['mpNow'] + ($u->stats['mpAll'] * 0.25)) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - } - } else { - //завершаем бой - $this->finishBattle($tml, $tmv, null, $tl); - if ($this->info['izlom'] > 0) { - $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); - } - } - if (isset($fin1)) { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '","Касание Хаоса","nofastfinisheff=1","' . time() . '")'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "','Вы создали предмет "Образец"x" . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) . "','" . time() . "','6','0')"); - $i01 = 1; - while ($i01 <= (($this->info['izlomObr'] - $this->info['izlomObrNow'])) * 7) { - $u->addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); - $i01++; - } - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")'); - unset($fin1); - } - } - } else { - mysql_query('START TRANSACTION;'); - $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`, `testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1 FOR UPDATE')); - mysql_query('COMMIT;'); - if (isset($test['id'])) { - $this->finishBattle(null, null, 10, $tl); - } - } - // - //mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - } - - //завершение поединка - public function finishBattle($t, $v, $nl, $tl) - { - global $magic, $u, $q, $c; - mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE'); - $frtu = false; - $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`,`testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1;')); - if ($test['testfinish'] != -1) { //$frtu == false - $trtt = mysql_query('UPDATE `battle` SET `testfinish` = "-1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - $relbf = $this->info['team_win']; - if ($nl != 10) { - $i = 0; - $dnr = 0; - if ($this->info['team_win'] == -1) { - $this->info['team_win'] = 0; - while ($i < count($v)) { - if ($v[$i] >= 1 && $t[$v[$i]] > 0) { - $this->info['team_win'] = $v[$i]; - } - $i++; - } - } - } - - - //данные о игроках в бою - $t = mysql_query('SELECT `u`.`stopexp`,`u`.`twink`,`u`.`city`,`u`.`room`,`u`.`no_ip`,`u`.`pass`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - $i = 0; - $bi = 0; - while ($pl = mysql_fetch_array($t)) { - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$i] = $pl; - $this->uids[$pl['id']] = $i; - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - //записываем статы - $this->stats[$i] = $u->getStats($pl, 0, 0, false, false, true); - $i++; - } - unset($pl, $t); - - if ($this->info['time_over'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `time_over` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - if ($this->info['inTurnir'] == 0 || $this->info['type'] == 500) { - mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `battle_stat` SET `team_win` = "' . $this->info['team_win'] . '" WHERE `battle_id` = "' . $this->info['id'] . '"'); - //Заносим данные о завершении боя - $i = 0; - $vl = ''; - $vtvl = ''; - $relu = 0; - while ($i < count($this->users)) { - /*if( $this->user[$i]['clon'] == 0 && $this->user[$i]['bot'] == 0 ) { - $relu++; - }*/ - $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; - if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) { - $vtvl .= '' . $this->users[$i]['login'] . ', '; - } - $i++; - } - - $this->info['players_c'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` NOT LIKE "%(зверь%" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->info['players_c'] = $this->info['players_c'][0]; - - mysql_query('UPDATE `battle` SET `players_c` = "' . $this->info['players_c'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - - if ($vtvl != '') { - $vtvl = rtrim($vtvl, ', '); - $vtvl = str_replace('"', '\\\\\"', $vtvl); - $this->hodID++; - $vLog = 'time1=' . time(); - $mass = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => 'test', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $vtvl = 'Бой закончен, победа за ' . $vtvl . '.'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } else { - $this->info['players_cc'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` > 0 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); - $this->info['players_cc'] = $this->info['players_cc'][0]; - $this->info['players_cc2'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` >= 1 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); - $this->info['players_cc2'] = $this->info['players_cc2'][0]; - $inf_test = ', users: ' . $this->info['players_cc'] . ' and ' . $this->info['players_cc2'] . ''; - $this->hodID++; - $vLog = 'time1=' . time(); - $mass = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => 'test', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $vtvl = 'Бой закончен, ничья.'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - $this->saveLogs($this->info['id'], 'all'); - //$this->hodID++; - - if ($this->info['type'] == 99) { - //$this->hodID++; - $vLog = 'time1=' . time(); - $mass = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => 'test', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $vtvl = 'И победители стали калечить проигравших...'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - $i = 0; - $vtvl = ''; - $tr_nm = [ - 1 => 'легкую', - 2 => 'среднюю', - 3 => 'тяжелую', - 4 => 'неизлечимую' - ]; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->info['team_win']) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { - if ($this->info['smert'] == 1) { - $tr_tp = 4; - } else { - $tr_tp = rand(1, 3); - } - if (isset($tr_pl['id'])) { - $tr_tp = rand(($tr_pl['v1'] + 1), 3); - } - if ($this->users[$i]['sex'] == 1) { - $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение: ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; - } else { - $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение: ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; - } - $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); - - } - } - $i++; - } - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - if ($vl != '') { - $vl = rtrim($vl, ','); - mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ' . $vl . ''); - } - - mysql_query('INSERT INTO `battle_end` (`battle_id`,`city`,`time`,`team_win`) VALUES ("' . $this->info['id'] . '","' . $this->info['city'] . '","' . $this->info['time_start'] . '","' . $this->info['team_win'] . '")'); - } - - - $vLog = 'time1=' . time(); - $mass = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => 'test', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - //$vtvl = ''; - //$ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.$mass['time'].'","'.$mass['battle'].'","'.$mass['id_hod'].'","'.$vtvl.'","'.$mass['vars'].'","'.$mass['zona1'].'","'.$mass['zonb1'].'","'.$mass['zona2'].'","'.$mass['zonb2'].'","'.$mass['type'].'")'); - $i = 0; - $vtvl = ''; - $tr_nm = [ - 1 => 'легкую', - 2 => 'среднюю', - 3 => 'тяжелую', - 4 => 'неизлечимую' - ]; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->info['team_win'] && $this->info['team_win'] > 0) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 292 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" LIMIT 1')); - - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - - if (isset($tr_pl['id'])) { - if (rand(0, 100) < $tr_pl['data']) { - $tr_tp = rand(1, 3); - if (isset($tr_pl['id'])) { - $tr_tp = rand(($tr_pl['v1'] + 1), 3); - } - if ($this->users[$i]['sex'] == 1) { - $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; - } else { - $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; - } - $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); - } - } - } - $i++; - } - if ($vtvl != '') { - if ($this->info['type'] != 99) { - $vtvl2 = 'И победители стали калечить проигравших...'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - //Турнир БС - if ($this->info['inTurnir'] > 0 && $this->info['dungeon'] != 15 && $u->info['room'] != 413) { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->info['inTurnir'] . '" LIMIT 1')); - $i = 0; - $j = 0; - while ($i < count($this->users)) { - if ($this->stats[$i]['hpNow'] < 1 && $this->users[$i]['clone'] == 0 && $this->stats[$i]['clone'] == 0) { - //Удаляем из БС - //echo '['.$this->users[$i]['login'].']'; - //Добавляем в лог БС - if ($this->users[$i]['sex'] == 0) { - $text .= '{u1} повержен и выбывает из турнира'; - } else { - $text .= '{u1} повержена и выбывает из турнира'; - } - //Выкидываем предметы с персонажа - $spik = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` ="0"'); - while ($plik = mysql_fetch_array($spik)) { - /* - БС-1 - mysql_query('INSERT INTO `bs_items` (`x`,`y`,`bid`,`count`,`item_id`) VALUES ( - "'.$this->users[$i]['x'].'","'.$this->users[$i]['y'].'","'.$bs['id'].'","'.$bs['count'].'","'.$plik['item_id'].'" - )'); - */ - mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $plik['item_id'] . '","' . (time() - 600) . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '" - )'); - } - unset($spik, $plik); - // - $usrreal = ''; - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $this->users[$i]['login'] . '" AND `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (!isset($usr_real['id'])) { - $usr_real = $this->users[$i]; - } - if (isset($usr_real['id'])) { - $usrreal = ''; - if ($usr_real['align'] > 0) { - $usrreal .= ''; - } - if ($usr_real['clan'] > 0) { - $usrreal .= ''; - } - $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; - } else { - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", - "' . round($bs['money'] * 0.85, 2) . '","' . $i . '" - )'); - // - //Удаление клона - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - //Обновление персонажа - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `login` = "' . $this->users[$i]['login'] . '" OR `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - //Обновляем заявку - mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `inBot` = "' . $this->users[$i]['id'] . '" AND `off` = "0" LIMIT 1'); - unset($text, $usrreal, $usr_real); - if ($this->users[$i]['pass'] != 'bstowerbot') { - $bs['users']--; - $bs['users_finish']++; - } else { - $bs['arhiv']--; - } - $j++; - } - $i++; - } - if ($j > 0) { - mysql_query('UPDATE `bs_turnirs` SET `arhiv` = "' . $bs['arhiv'] . '",`users` = "' . $bs['users'] . '",`users_finish` = "' . $bs['users_finish'] . '" WHERE `id` = "' . $bs['id'] . '" LIMIT 1'); - } - - unset($bs, $j); - } - - //Награда за события - if ($this->info['type'] == 500 && isset($tststrt['id'])) { - - //Предметы которые выпадают в центр - - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['no_ip'] == 'trupojor') { - $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (isset($mon['id'])) { - if ($this->info['team_win'] == 0) { - //Ничья - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', $mon['nich_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - } elseif ($this->info['team_win'] != $this->users[$i]['team']) { - //Выиграли - $j = 0; - $usrwin = ''; - while ($j < count($this->users)) { - if ($this->users[$j]['no_ip'] != 'trupojor' && $this->users[$j]['bot'] == 0) { - if ($this->stats[$j]['hpNow'] > 0) { - $usrwin .= ', '; - if ($this->users[$j]['align'] > 0) { - $usrwin .= 'users[$j]['align'] . '.gif >'; - } - if ($this->users[$j]['clan'] > 0) { - $usrwin .= 'users[$j]['clan'] . '.gif >'; - } - $usrwin .= '' . $this->users[$j]['login'] . ' [' . $this->users[$j]['level'] . ']users[$j]['id'] . ' >'; - } - } - $j++; - } - if ($usrwin != '') { - $usrwin = ltrim($usrwin, ', '); - } else { - $usrwin = 'Команда героев'; - } - - - mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - - $truptimelast = time() + rand(1800, 3600); - - - mysql_query('UPDATE `stats` SET `res_x` = "' . $truptimelast . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', str_replace('{u}', $usrwin, $mon['win_text']))) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - unset($usrwin); - } else { - //Проиграли - if ($mon['win_back'] == 1) { - mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', $mon['lose_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - } - } - } - $i++; - } - } - } - - // выкидываем ботов из боя - $i = 0; - $botsi = 0; - if (isset($tststrt['id'])) { - while ($i < count($this->users)) { - //Тут выкидываем юзеров из Призавого хаота - if ($this->info['type'] == 33) { - $plde = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (isset($plde['mail']) && $plde['mail'] == "haot@new-combats.com") { - - - $pld = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - - if (isset($pld['id'])) { - - if ($this->users[$i]['battle_yron'] >= 500) { - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $pld['battle_text'] .= ' За Героическое Сражение вы получаете Реликвия Ангела (x5). '; - mysql_query('UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); - - - if ($this->users[$i]['team'] == $this->info['team_win']) { - if (rand(1, 100) <= 5) { - $u->addItem(10020, $pld['id'], ''); - $pld['battle_text'] .= ' и Жетон Успеха. '; - } - - } - } else { - $pld['battle_text'] .= ' Вы ничего не получили. Нужно набить больше 500 урона урона .'; - } - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $pld['city'] . "','" . $pld['room'] . "','','" . $pld['login'] . "','" . $pld['battle_text'] . "','-1','6','0')"); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - } - - unset ($plde, $pld); - } - - if ($this->users[$i]['bot'] == 1) { - $botsi++; - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } elseif ($this->users[$i]['bot'] == 2) { - $this->users[$i]['battle'] = 0; - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - //mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`timeGo` = "'.time().'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } elseif ($this->users[$i]['bot'] > 0) { - $this->users[$i]['battle'] = 0; - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } - if ($this->users[$i]['clone'] > 0 && $this->users[$i]['bot'] > 0 && isset($this->users[$this->uids[$this->users[$i]['clone']]]['id']) && $this->users[$this->uids[$this->users[$i]['clone']]]['team'] != $this->users[$i]['team']) { - //Добавляем что клон побежден - if ($this->users[$this->uids[$this->users[$i]['clone']]]['team'] == $this->info['team_win']) { - $u->addAction(time(), 'win_bot_clone', '', $this->users[$i]['clone']); - } elseif ($this->info['team_win'] == 0) { - $u->addAction(time(), 'nich_bot_clone', '', $this->users[$i]['clone']); - } else { - $u->addAction(time(), 'lose_bot_clone', '', $this->users[$i]['clone']); - } - } elseif ($this->users[$i]['bot'] > 0 && $this->users[$i]['bot_id'] > 0) { - //Добавляем что бота победили - $j = 0; - while ($j < count($this->users)) { - if ($this->users[$j]['bot'] == 0 && $this->users[$j]['team'] != $this->users[$i]['team']) { - if ($this->users[$j]['team'] == $this->info['team_win']) { // if($this->users[$j]['team']==$this->info['team_win']){ - $u->addAction(time(), 'win_bot_' . $this->users[$i]['bot_id'], '', $this->users[$j]['id']); - // - mysql_query('UPDATE `dialog_act` SET `now` = `now` + 1 WHERE `uid` = "' . $this->users[$j]['id'] . '" AND - ( `btl_bot` LIKE "' . $this->users[$i]['bot_id'] . '!%" OR `btl_bot` LIKE "%!' . $this->users[$i]['bot_id'] . '!%" ) - AND `val` != 1 - LIMIT 1'); - // - } elseif ($this->info['team_win'] == 0) { - $u->addAction(time(), 'nich_bot_' . $this->users[$i]['bot_id'], '', $this->users[$j]['id']); - } else { - $u->addAction(time(), 'lose_bot_' . $this->users[$i]['bot_id'], '', $this->users[$j]['id']); - } - } - $j++; - } - } - $i++; - - } - } - - $botss = []; - if (true == true) { - if ($nl != 10) { - //Из бота падают предметы - if ($this->info['dungeon'] > 0) { - if ($this->info['team_win'] == $u->info['team'] && $this->info['dungeon'] == 102) { - $j1 = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->info['dn_id'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1')); - if (isset($j1['id'])) { - mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $j1['id'] . '" LIMIT 1'); - //Выпадает шмотка - mysql_query('INSERT INTO `laba_obj` (`use`,`lib`,`time`,`type`,`x`,`y`,`vars`) VALUES ( - "0","' . $j1['lib'] . '","' . time() . '","6","' . $j1['x'] . '","' . $j1['y'] . '","' . (0 + $botsi) . '" - )'); - } - } elseif ($this->info['team_win'] == $u->info['team']) { - //выйграли люди, выкидываем предметы из мобов - $j1 = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->info['y'] . '" LIMIT 100'); - while ($tbot = mysql_fetch_array($j1)) { - $j2 = 0; - while ($j2 < $tbot['colvo']) { - if (isset($tbot['id2'])) { - $tbot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $tbot['id_bot'] . '" LIMIT 1')); - $itms = explode('|', $tbot2['p_items']); - $tii = 0; - $testdrop = 0; - while ($tii < count($itms) && $testdrop == 0) { - $itmz = explode('=', $itms[$tii]); - if ($itmz[0] > 0) { - if (isset($itmz[2]) && $itmz[2] != '') { // $itmz[2] == quest888 - $questDrop = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%' . $itmz[2] . '%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); - } - if (isset($questDrop['id'])) { // Если квест есть, предмет имеет шанс выпасть - } elseif (isset($itmz[2]) && $itmz[2] != '') $itmz[1] = 0; // Если предмет квестовый, а квеста у игрока нет, то предмет выпадет с вероятностью 0 - unset($questDrop); - - //Добавляем этот предмет в зону Х и У - if ($itmz[1] * 100000 >= rand(1, 10000000)) { - $tou = 0; //какому юзеру предназначено - /* выделяем случайного юзера из команды */ - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz[0] . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - if (!isset($questDrop['id'])) { - $testdrop = 1; //ТУТ drop-drop //quest - } - } - } - $tii++; - } - } - $j2++; - } - // - //Квест 1-15 сентября, - if (date('m') == 9 && date('d') < 15) { - if ($this->get_chanse(99) == true) { - //Не выпало - } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 101) { - $tou = 0; //какому юзеру предназначено - /* выделяем случайного юзера из команды */ - $itmz = [ - rand(4745, 4751), 100 - ]; - // - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz[0] . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - } - } - // - //Странички саныча, - - if (rand(1, 100) <= 99) { - //Не выпало - } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 3 || - $this->info['dungeon'] == 101 || $this->info['dungeon'] == 16 || - $this->info['dungeon'] == 9 || $this->info['dungeon'] == 10 || - $this->info['dungeon'] == 13 || $this->info['dungeon'] == 106) { - $tou = 0; //какому юзеру предназначено - // выделяем случайного юзера из команды - $itmz = rand(3143, 3192); - // - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - } - } - # mysql_query('UPDATE `dungeon_bots` SET `delete` = "'.time().'" WHERE `dn` = "'.$this->info['dn_id'].'" AND `for_dn` = "0" AND `x` = "'.$this->info['x'].'" AND `y`= "'.$this->info['y'].'" AND `delete` = "0" '); - mysql_query('UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" '); - - } else { - //выкидываем всех игроков в клетку RESTART - $dnr = 1; - if ($this->info['dungeon'] != 102) { - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `y`= "' . $this->info['y'] . '"'); - } - } - } - } - - $gm = []; - $gms = []; - $bm = []; - $bms = []; - - //завершаем поединок - $i = $this->uids[$u->info['id']]; - - if ($this->info['team_win'] >= 0) { - - if ($this->stats[$i]['pbe'] > 0) { - //Бонус покупателя - $this->expCoef += $this->stats[$i]['pbe']; - } - - if ($this->info['razdel'] == 5) { - if ($c['m'] >= 6 && $c['m'] <= 8) { - //Летний период - $this->expCoef += 5; - } elseif ($c['w'] == 0 || $c['w'] == 6) { - //Выходные дни - $this->expCoef += 5; - } - } - - $this->stats[$i]['exp'] += $this->expCoef; - - $this->stats[$i]['exp'] += $this->aBexp * $c['exp']; - - if ($this->stats[$i]['os4'] > 0) { - $this->stats[$i]['exp'] += $this->stats[$i]['os4']; - } - - /*if($this->stats[$i]['silver']>0) { - $this->stats[$i]['exp'] += 5*$this->stats[$i]['silver']; - if($this->stats[$i]['bonusexp'] > 1) { // Для покупки опыта (получает максимум) - $this->stats[$i]['exp'] += 1000*$this->stats[$i]['bonusexp']; - } - //if($this->stats[$i]['speeden']>20) { // Для восстановления энергии (получает максимум) - //$this->stats[$i]['enNow'] += $this->stats[$i]['speeden']; - - //$upd2 = mysql_query('UPDATE `stats` SET `enNow` = "'.$this->users[$i]['enNow'].'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - //} - }*/ - - $act01 = 0; - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] + ($this->users[$i]['battle_exp'] / 100 * (1 + $this->info['addExp'] + $this->stats[$i]['exp']))); - - if ($this->info['type'] == 564) { - //Бой с копией - $this->users[$i]['battle_exp'] = 0; - } - - if ($this->info['dungeon'] == 104) { - $this->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->uids) - 1); - } elseif ($this->info['dungeon'] > 0 && $this->users[$i]['dnow'] != 0 && $this->info['dungeon'] != 1 && $this->users[$i]['team'] == $this->info['team_win']) { - $dun_limitForLevel = [4 => 750, 5 => 1500, 6 => 3500, 7 => 8000, 8 => 25000, 9 => 50000, 10 => 75000, 11 => 100000, 12 => 100000, 13 => 100000, 14 => 100000]; - // Максимум для каждого уровня. - - if ($this->users[$i]['battle_exp'] > 0) { - $dun_exp = []; // Текущий лимит опыта игрока в подземельях. - $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - $rep = explode(',', $rep['dungeonexp']); - foreach ($rep as $key => $val) { - $val = explode('=', $val); // текущий лимит опыта в подземке - if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) $dun_exp[(int)$val[0]] = (int)$val[1]; - } - unset($rep); - } - - if (!isset($dun_exp[$this->info['dungeon']])) $dun_exp[$this->info['dungeon']] = 0; - - if (!isset($dun_limitForLevel[(int)$this->users[$i]['level']])) { // Если лимит не задан, опыт не даем. - $this->users[$i]['battle_exp'] = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$i]['level']] - ) { // Если лимит уже достигнут, опыт не даем. - $this->users[$i]['battle_exp'] = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_limitForLevel[(int)$this->users[$i]['level']] > $dun_exp[$this->info['dungeon']] - ) { // Если текущая репутация не достигла лимита. - if (($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->users[$i]['level']]) { - // Если опыта набрано достаточно, для достижения лимита. - $this->users[$i]['battle_exp'] = abs($this->users[$i]['battle_exp'] - abs($dun_limitForLevel[(int)$this->users[$i]['level']] - ($this->users[$i]['battle_exp'] + $dun_exp[$this->info['dungeon']]))); - $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; - } elseif ($dun_limitForLevel[(int)$this->users[$i]['level']] > ($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp'])) { - // Если опыта недостаточно, для достижения лимита. - $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']; - $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; - } else { - $this->users[$i]['battle_exp'] = 0; - } - } else { // В любой непонятной ситуцаии. - $this->users[$i]['battle_exp'] = 0; - } - - - if ($this->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->info['dungeon']]) && $dun_exp[$this->info['dungeon']] > 0) { - $dunexp = []; - foreach ($dun_exp as $key => $val) { - $dunexp[$key] = $key . '=' . $val; // текущий лимит опыта в подземке - } - $dun_exp = implode(",", $dunexp); - mysql_query('UPDATE `rep` SET `dungeonexp` = "' . $dun_exp . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - unset($dunexp, $dun_exp); - } - unset($dun_limitForLevel); - } - - $sinf = ''; - if ($c['exp_mega'] == true) { - $this->users[$i]['battle_exp'] += floor($this->users[$i]['battle_exp'] / 100 * $c['exp_mega_val'][$this->users[$i]['level']]); - } - - /*if( $this->users[$i]['level'] < 8 ) { - $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*10; - }elseif( $this->users[$i]['level'] < 9 ) { - //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*2; - }*/ - - if ($this->info['team_win'] == 0 && $this->info['type'] != 564) { - //ничья - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","10")'); - } - //$sinf .= ' ничья '; - if ($this->users[$i]['level'] <= 1) { - $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] * 0.50); - } else { - //$this->users[$i]['battle_exp'] = 0; - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); - } - $this->users[$i]['nich'] += 1; - // - mysql_query('UPDATE `users` SET `swin` = 0, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - } elseif ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['type'] != 564) { - //выйграл - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","30")'); - } - //$sinf .= ' выиграли '; - $gm[$i] = $this->info['money']; - - $gms[$i] = $this->info['money3']; - - $this->users[$i]['win'] += 1; - $act01 = 1; - // - mysql_query('UPDATE `users` SET `swin` = `swin` + 1, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - } elseif ($this->info['type'] != 564) { - //проиграл - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","10")'); - } - //$sinf .= ' проиграли '; - if ($this->users[$i]['level'] <= 1) { - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.33); - } else { - //$this->users[$i]['battle_exp'] = 0; - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); - } - $bm[$i] = $this->info['money']; - - $bms[$i] = $this->info['money3']; - - $this->users[$i]['lose'] += 1; - //Добавляем эффект ослабления - /*if($this->users[$i]['level']>=4 && $this->info['dungeon'] == 0 && $this->stats[$i]['silver'] < 2){ - $noOsl = 0; - $nn = 0; - while($nnstats[$i]['effects'])){ - if($this->stats[$i]['effects'][$nn]['id_eff']==5){ - $noOsl = 1; - } - $nn++; - } - if($noOsl==0){ - if($this->users[$i]['id'] != 3874647) { - $magic->oslablenie($this->users[$i]['id']); - } - - } - }*/ - // - mysql_query('UPDATE `users` SET `swin` = 0, `slose` = `slose` + 1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - $act01 = 2; - } - if ($this->users[$i]['level'] < 4) { - //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*3; - } - //$sinf .= ' '.$this->info['id'].'-'.$this->info['team_win'].'-'.$relbf.'-'.$this->users[$i]['team'].'-'.$tl .' '; - // - //Рассчитываем кол-во выигрышных сумм и кто сколько получил (для екр.) - if ($this->info['money3'] > 0 && isset($gms[$i]) && $this->info['type'] != 564) { - $mn = [ - 'l' => 0, //сколько проигравших игроков - 'w' => 0, //сколько выигрывших игроков - 'm' => 0 //сумма выигрыша (общая) - ]; - if ($act01 == 1) { - $mn['l'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` != "' . $this->users[$i]['team'] . '" LIMIT 1')); - $mn['l'] = $mn['l'][0]; - $mn['w'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` = "' . $this->users[$i]['team'] . '" LIMIT 1')); - $mn['w'] = $mn['w'][0]; - $mn['m'] = round(($mn['l'] * $this->info['money3']) / 100 * 87, 2); - $gms[$i] = round(($mn['m'] / $mn['w']), 2); - } - } - // - //заносим данные в БД - //Поломка предметов - if ($act01 == 1) { - //победа - if ($this->users[$i]['dnow'] == 0) { - if ($this->users[$i]['hpNow'] < 1) { - $lom = 0.05; - } - } - } elseif ($act01 == 2) { - //поражение - $lom = 0.55; - } else { - //ничья - $lom = 0.05; - } - //$lom = round($lom*2.75,2); - $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)]; - if ($this->info['type'] == 564) { - $lom = 0; - } - if ($this->stats[$i]['silver'] >= 4) { - $lom = 0; - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW`+' . $lom . ' WHERE `inOdet` < "18" AND `inOdet` > "0" AND `uid` = "' . $this->users[$i]['id'] . '" AND `inOdet`!="0" AND `inOdet`!=' . $nlom[0] . ' AND `inOdet`!=' . $nlom[1] . ' AND `inOdet`!=' . $nlom[2] . ' AND `inOdet`!=' . $nlom[3] . ' LIMIT 18'); - - $prc = ''; - if ($this->users[$i]['align'] == 2) { - $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] / 2); - } - if ($this->users[$i]['animal'] > 0) { - $ulan = $u->testAction('`uid` = "' . $this->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->info['id'] . '" LIMIT 1', 1); - if (isset($ulan['id']) && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['level'] > $ulan['vals']) { - $a004 = mysql_fetch_array(mysql_query('SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - //33% от опыта переходит зверю, но не более максимума - $aexp = (round($this->users[$i]['battle_exp'] / 100 * 33)); - if ($aexp > $a004['max_exp']) { - $aexp = $a004['max_exp']; - } - unset($ulan); - // - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat` - ) VALUES ( - '1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "' - ,'Ваш питомец "" . $a004['name'] . "" получил опыт: " . $aexp . "','-1','6','0')"); - // - $upd = mysql_query('UPDATE `users_animal` SET `exp` = `exp` + ' . $aexp . ' WHERE `id` = "' . $this->users[$i]['animal'] . '" AND `level` < ' . $this->users[$i]['level'] . ' LIMIT 1'); - if ($upd) { - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 100 * 67); - $this->info['addExp'] -= 33.333; - } - } - } - - $prsusers = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" LIMIT 1')); - unset($prsusers); - $btlstatus = $this->typeBattle($prsusers[0]); - if ($this->info['smert'] == 1) { - $btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; - } - // - if ($this->stats[$i]['clanpos'] > 0) { - if ($this->stats[$i]['clanpos'] == 1) { - $this->info['addExp'] += 0; - } elseif ($this->stats[$i]['clanpos'] == 2) { - $this->info['addExp'] += 0; - } elseif ($this->stats[$i]['clanpos'] == 3) { - $this->info['addExp'] += 0; - } - } - - unset($r1); - //Статусная битва - if ($btlstatus[0] > 0) { - if ($this->info['type'] == 99) { - $this->info['addExp'] += $btlstatus[1]; - } else { - $this->info['addExp'] += $btlstatus[0]; - } - } - - if ($this->users[$i]['align'] == 2 || $this->users[$i]['haos'] > time()) { - $this->stats[$i]['exp'] = -($this->info['addExp'] + 50); - } - if ($this->info['addExp'] + $this->stats[$i]['exp'] != 0) { - $prc = ' (' . (100 + $this->info['addExp'] + $this->stats[$i]['exp']) . '%)'; - } - if ($this->info['money'] > 0) { - if (isset($gm[$i])) { - $prc .= ' Вы выйграли ' . $gm[$i] . ' кр. за этот бой.'; - $u->addDelo(4, $this->users[$i]['id'], '"System.battle": Персонаж выйграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money'] += $gm[$i]; - } elseif (isset($bm[$i])) { - $prc .= ' Вы заплатили ' . $bm[$i] . ' кр. за этот бой.'; - $u->addDelo(4, $this->users[$i]['id'], '"System.battle": Персонаж проиграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money'] -= $bm[$i]; - } - } - // - if ($c['money_haot'] == true && $this->users[$i]['exp'] <= 200000000) { - if ($act01 == 1 && $this->info['razdel'] == 5 && $this->users[$i]['level'] >= 8) { - - //Сколько нужно опыта набить - $trexp = [ - 8 => 1200, - 9 => 1800, - 10 => 4500, - 11 => 12000, - 12 => 20000, - 13 => 30000, - 14 => 30000, - 15 => 30000, - 16 => 30000, - 17 => 30000, - 18 => 30000, - 19 => 30000, - 20 => 30000, - 21 => 30000 - ]; - $trexp = $trexp[$this->users[$i]['level']]; - - //Какая цена фулла должна быть - $trmn = [ - 8 => 1000, - 9 => 3000, - 10 => 2500, - 11 => 3000, - 12 => 3000, - 13 => 3000, - 14 => 3000, - 15 => 3000, - 16 => 3000, - 17 => 3000, - 18 => 3000, - 19 => 3000, - 20 => 3000, - 21 => 3000 - ]; - $trmn = $trmn[$this->users[$i]['level']]; - - //Сколько екр дается - $admn = [ - 8 => 0.010, //0.05 - 9 => 0.065, //0.065 - 10 => 0.075, //0.075 - 11 => 0.085, //0.085 - 12 => 0.1, //0.1 - 13 => 0.1, - 14 => 0.1, - 15 => 0.1, - 16 => 0.1, - 17 => 0.1, - 18 => 0.1, - 19 => 0.1, - 20 => 0.1, - 21 => 0.1 - ]; - $admn = $admn[$this->users[$i]['level']]; - - if ($c['m'] >= 6 && $c['m'] <= 8) { - //Летний период - if ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { - //Выходные дни - $admn = $admn * 2; - } - - } elseif ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { - //Выходные дни - $admn = $admn * 2; - } - if ($this->users[$i]['battle_exp'] < $trexp) { - //недостаточно опыта набито за бой - $prc .= ', Награда 0 ЕКР за этот бой (Мало опыта набили).'; - //}elseif( $this->stats[$i]['prckr'] < $trmn ) { - //недостаточно стоимость кр вещей - //$prc .= ', Награда 0 ЕКР за этот бой (У вас дешевый комплект).'; - } elseif ($admn > 0) { - if ($this->info['type'] != 33) { - $prc .= ', Награда ' . $admn . ' ЕКР за этот бой.'; - } - $u->addDelo(4, $this->users[$i]['id'], '"System.battle": Персонаж получил ' . $admn . ' ЕКР (В бою №' . $this->info['id'] . ').', time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money2'] += $admn; - } - } - } - // - if ($this->info['money3'] > 0) { - if (isset($gms[$i])) { - $prc .= ' Вы выйграли ' . $gms[$i] . ' $. за этот бой.'; - $u->addDelo(4, $this->users[$i]['id'], '"System.battle": Персонаж выйграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money3'] += $gms[$i]; - mysql_query('UPDATE `users` SET `money3` = `money3` + "' . $gms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } elseif (isset($bms[$i])) { - $prc .= ' Вы заплатили ' . $bms[$i] . ' $. за этот бой.'; - $u->addDelo(4, $this->users[$i]['id'], '"System.battle": Персонаж проиграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money3'] -= $bms[$i]; - mysql_query('UPDATE `users` SET `money3` = `money3` - "' . $bms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - } - /*if($this->info['kingfight']==1 && $this->info['type'] != 564 ) { - //Призовой поединок - if($this->info['team_win'] == 0) { - - }elseif($this->users[$i]['team'] == $this->info['team_win']){ - $bnks = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$this->users[$i]['id'].'" ORDER BY `useNow` DESC LIMIT 1')); - if(isset($bnks['id'])) { - $bnks['msn'] = round($this->user[$i]['level']/50,2); - $bnks['msn'] = 0.15; - mysql_query('UPDATE `bank` SET `money2` = `money2` + "'.mysql_real_escape_string($bnks['msn']).'" WHERE `id` = "'.$bnks['id'].'" LIMIT 1'); - $prc .= ' Вы получили приз: '.$bnks['msn'].' екр., банк №'.$bnks['id'].''; - - } - unset($bnks); - } - }*/ - - /* - 7ур - 10800 - 8ур - 36000 - 9ур - 56000 - 10ур - 86000 - if($this->users[$i]['battle_exp'] > (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755) { - $this->users[$i]['battle_exp'] = (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755; - } - */ - - //$lime = array(8=>18000,9=>28000,10=>84000,11=>150000); - $lime = [ - 8 => 18000, - 9 => 28000, - 10 => 84000, - 11 => 100, - 12 => 100, - 13 => 100, - 14 => 100, - 15 => 100, - 16 => 100, - 17 => 100, - 18 => 100, - 19 => 100, - 20 => 100, - 21 => 100 - ]; - - if ($this->users[$i]['level'] < 8) { - $lime = 5400; - } else { - $lime = $lime[$this->users[$i]['level']]; - } - - if ($this->stats[$i]['silver'] >= 5) { - $lime += round($lime); - } - - /*if( $this->stats[$i]['silver'] > 0 ) { - $lime += floor($lime/100*(10*$this->stats[$i]['silver'])); - }*/ - - if ($this->users[$i]['stopexp'] == 1) { - $lime = 0; - $this->users[$i]['battle_exp'] = 0; - } - - if ($lime < $this->users[$i]['battle_exp'] && $c['limitedexp'] == true) { - $this->users[$i]['battle_exp'] = $lime; - } - // - /*if( $this->users[$i]['battle_exp'] > 100 && $this->info[$i]['level'] == 6 ) { - $this->users[$i]['battle_exp'] = 100; - }*/ - // - unset($lime); - - - //if(100+$this->info['addExp']+$this->stats[$i]['exp'] > 1000) { - //$prc .= ' (Великая Битва)'; - //} - - if ($btlstatus[0] > 0) { - if ($this->info['type'] == 99) { - $prc .= ' (' . $btlstatus[3] . ')'; - } else { - $prc .= ' (' . $btlstatus[2] . ')'; - } - } - - if ($this->info['dungeon'] == 1 && $this->users[$i]['team'] == $this->info['team_win']) { - //канализация лимит - $rep = mysql_fetch_array(mysql_query('SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if ($rep['dl' . $this->info['dungeon']] > 0) { - $this->users[$i]['battle_exp'] += 3 * count($this->users); - if ($rep['dl' . $this->info['dungeon']] > $this->users[$i]['battle_exp']) { - $rep['dl' . $this->info['dungeon']] -= $this->users[$i]['battle_exp']; - } else { - $this->users[$i]['battle_exp'] = $rep['dl' . $this->info['dungeon']]; - $rep['dl' . $this->info['dungeon']] = 0; - } - mysql_query('UPDATE `rep` SET `dl' . $this->info['dungeon'] . '` = "' . $rep['dl' . $this->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'); - } else { - $this->users[$i]['battle_exp'] = 0; - } - } - - if ($this->users[$i]['battle_exp'] < 1) { - $this->users[$i]['battle_exp'] = 0; - } - - if ($this->users[$i]['battle_exp'] < 1 && $this->users[$i]['twink'] == 0) { - if ($this->info['money'] == 0 && $this->info['money3'] == 0 && $this->info['kingfight'] == 0 && (!isset($admnb) || $admnb == 0)) { - $prc = ''; - } - } - - if ($this->user[$i]['host_reg'] == 'real_bot_user') { - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 3); - } - - if ($sinf != '') { - $sinf = ' ( ' . $sinf . ' )'; - } - - /*if( $this->users[$i]['level'] >= 8 ) { - if( $this->users[$i]['battle_exp'] > 1000 ) { - $this->users[$i]['battle_exp'] = 1000; - } - }*/ - //--------------Лимит 8-9-------------- - - - if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) { - $this->users[$i]['battle_exp'] = 23000; - }; - // if ($this->users[$i]['level']==9 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/3);}; - if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) { - $this->users[$i]['battle_exp'] = 31000; - }; - // if ($this->users[$i]['level']==10 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; - if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) { - $this->users[$i]['battle_exp'] = 52000; - }; - // if ($this->users[$i]['level']==11 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; - if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) { - $this->users[$i]['battle_exp'] = 75000; - }; - //------------------------------------- - - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] = 'Бой закончен. Всего вами нанесено урона: ' . floor($this->users[$i]['battle_yron']) . ' HP. Получено опыта: ' . (0 + $this->users[$i]['battle_exp']) . '' . $prc . '.' . $sinf; //stats - } - - /*Выпадение зубов в конце боя */ - if ($c['nolevel'] == true) { - $rex95 = substr($this->users[$i]['exp'], -1); - if ($this->users[$i]['money4'] < 1000 && $this->users[$i]['exp'] == 12499) { - $rex95 = 6; - $rex95 = 5; - } - } else { - $rex95 = 5; - } - - - //echo '['.$rex95.']'; - if ($c['zuby'] == true && $this->info['dungeon'] == 0 && ($this->info['clone'] == 0 || $this->users[$i]['level'] < 5) && $rex95 != 9 && $this->info['type'] != 564) { - if ($this->users[$i]['align'] != 2 && $this->users[$i]['level'] >= 0 && $this->users[$i]['level'] < 8 && $this->users[$i]['battle_exp'] > 0) { - $rzb = 0; - - if ($this->get_chanse(50) == true) { - $rzb += rand(1, 3); - } else { - if ($this->users[$i]['battle_exp'] > 15) { - $rzb += 1; - } - } - - $chzbs = 100; - - if ($this->stats[$i]['silver'] > 0) { - $chzbs = 150; - } - - if ($this->users[$i]['battle_exp'] > 9) { - if ($this->users[$i]['level'] > 1) { - //Нормальный зуб - if ($this->get_chanse(25 / 100 * $chzbs) == true) { - $rzb += 10; - } - } elseif ($this->users[$i]['level'] == 1) { - if ($this->get_chanse(30 / 100 * $chzbs) == true) { - $rzb += 10; - } - } - - if ($this->users[$i]['level'] > 3) { - if ($this->get_chanse(5 / 100 * $chzbs) == true) { - $rzb += 100; - } - } - } - - if ($this->users[$i]['team'] == $this->info['team_win']) { - //выиграли - if ($this->users[$i]['level'] < 8) { - $rzb += 1; - } - } elseif ($this->users[$i]['team'] == 0) { - //ничья - if ($this->get_chanse(25 / 100 * $chzbs) == true && $this->users[$i]['battle_exp'] > 2) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } else { - //проиграли - if ($this->users[$i]['level'] >= 1) { - $rzb = 0; - } else { - if ($this->users[$i]['battle_exp'] < 3) { - $rzb = 0; - } elseif ($this->user[$i]['lose'] > $this->user[$i]['win']) { - if ($this->get_chanse(5 / 100 * $chzbs) == true) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } elseif ($this->get_chanse(10 / 100 * $chzbs) == true) { - $rzb = rand(0, 1); - } - } - $rzb = 0; - } - - if ($rex95 == 6 /*|| $this->users[$i]['exp'] == 12499 */) { - if ($this->users[$i]['battle_exp'] > 10) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } - - if ($rzb > 0 && rand(0, 1000) <= 500) { - $rzb = rand(1, 3); - } - if ($rzb > 0) { - if ($this->stats[$i]['silver'] >= 5) { - $rzb = $rzb * 2; - } - mysql_query('UPDATE `users` SET `money4` = `money4` + "' . $rzb . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - $this->users[$i]['battle_text'] .= ' Вы получили ' . $u->zuby($rzb, 1) . ' за этот бой.'; - } - } - } - - if ($this->info['priz'] > 0) { - //Призовой хаот - /* - [4754] - 2-3 лвл = 1 жетон - 4-5 лвл = 1 жетона - 6-7 лвл = 2 жетонов - 8-9 лвл = 3 жетонов - В случаи победы (х3) - - */ - - if ($this->info['type'] == 33)//ТУТ приз хаот дроп - { - - - } else { - - $tmon = [ - 2 => 1, - 3 => 1, - 4 => 1, - 5 => 1, - 6 => 1, - 7 => 2, - 8 => 3, - 9 => 3, - 10 => 5, - 11 => 5 - ]; - $tmon = $tmon[$this->users[$i]['level']]; - // - $tmonc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "' . $this->users[$i]['id'] . '" ) AND `priz` > 0 AND `time_start` > "' . strtotime(date('d.m.Y')) . '"')); - $tmonc = $tmonc[0]; - // - if ($this->users[$i]['team'] == $this->info['team_win']) { - //При выигрыше увеличиваем - if ($tmonc < 1) { - $tmonc = 1; - } elseif ($tmonc > 96) { - $tmonc = 96; - } - $tmon = ($tmon * $tmonc); - } - // - $tmoni = 1; - while ($tmoni <= floor($tmon / 2)) { - $u->addItem(4754, $this->users[$i]['id'], ''); // - $tmoni++; - } - // - $this->users[$i]['battle_text'] .= ' За призовой хаот вы получаете Призовой Жетон (x' . floor($tmon / 2) . '). (Чем больше призовых хаотов вы примите за сутки, тем больше будет выдаваться жетонов при победе! Призовых хаотов посещено сегодня ' . ($tmonc) . '/96 )'; - // - unset($tmon, $tmoni); - } - } - //Снижение времени Право на подвиг Титул за победу в хаоте - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['team'] == $this->info['team_win']) { - //ТУТ2 - $u->repexp_add($this->users[$i]['id'], 2); //Репутация за поб в хаоте +2 - $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - if (isset($check['id'])) { - $urcheck = 10000; - if ($this->users[$i]['level'] == 8) { - $urcheck = 3000; - } elseif ($this->users[$i]['level'] == 9) { - $urcheck = 7000; - } elseif ($this->users[$i]['level'] == 10) { - $urcheck = 12000; - } elseif ($this->users[$i]['level'] >= 11) { - $urcheck = 18000; - } - - if ($this->users[$i]['battle_yron'] >= $urcheck) { - //UPDATE `eff_users` SET `timeUse` = '1555700000' WHERE `eff_users`.`id` = 31912807; - mysql_query('UPDATE `eff_users` SET `timeUse` = `timeUse` - 300 WHERE `id_eff`=478 AND `delete` = 0 AND `uid` =' . $this->users[$i]['id'] . ' LIMIT 1'); - $this->users[$i]['battle_text'] .= ' За победу в хаоте и нанесение урона в ' . $urcheck . ' и более вы получаете -5 мин. к праву на подвиг!'; - } - - } - mysql_query('UPDATE `users_achiv` SET `vx`= `vx`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); // - - } - //Награда за клан вар - if ($this->info['dungeon'] == 0 && $this->info['type'] == 250 && $this->users[$i]['team'] == $this->info['team_win']) { - mysql_query('UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - if (date('w') == 0 || date('w') == 6 || date('w') == 4) { - $u->repexp_add($this->users[$i]['id'], 25); //Клановые войны(победа) 25 - } - } - //Награда за клан вар - if ($this->info['dungeon'] == 0 && $this->info['type'] == 99 && $this->users[$i]['team'] == $this->info['team_win']) { - if (date('w') == 0 || date('w') == 6 || date('w') == 5) { - $u->repexp_add($this->users[$i]['id'], 10); //Кровавые войны(победа) 10 - } - } - - //Новая выдача на трупожора - if ($this->info['dungeon'] == 0 && $this->info['type'] == 500 && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['no_ip'] != 'trupojor' && $this->users[$i]['bot'] == 0) { - if ($this->users[$i]['level'] > 9) { - $mid = 903093; - } else { - $mid = 89489; - } - $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $mid . '" LIMIT 1')); - - if ($this->users[$i]['battle_yron'] >= 2000) { - $ritem = rand(1, 100); - if ($ritem <= 20) { - $mon['win_itm'] = '4459@1'; - } elseif ($ritem <= 40) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 60) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 80) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - - } elseif ($this->users[$i]['battle_yron'] >= 1500) { - $ritem = rand(1, 100); - if ($ritem <= 20) { - $mon['win_itm'] = '4459@1'; - } elseif ($ritem <= 40) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 60) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 80) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - - } elseif ($this->users[$i]['battle_yron'] >= 1000) { - $ritem = rand(1, 100); - if ($ritem <= 25) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 50) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 75) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - - } else { - $mon['win_itm'] = '4392@1'; - $timewait = 0; - } - if ($this->users[$i]['battle_yron'] > 0) { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '","Право на подвиг","pravonapodvig=1","' . time() . '")'); - } - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")'); - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'); - $ritem = rand(1, 1000); - if ($ritem == 555) { - $mon['win_itm'] = $mon['win_itm'] . ',5022@1'; - } - // - $this->addGlobalItems($mid, $this->users[$i]['id'], $mon['win_itm'], $mon['win_eff'], $mon['win_ico'], 1, $mon['win_money1'], $mon['win_money2']); //$mon['win_exp'] - - } - - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $u->info['battle_yron'] >= 2000) //$u->info['battle_yron'] - { - - - //Реликвия Ангела ang_g - if ($this->users[$i]['team'] == $this->info['team_win']) { - //При выигрыше увеличиваем - $tmoni = 2; - } else { - $tmoni = 1; - } - - // - $tmon = $tmoni; - $effblago = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `delete` = 0 AND `id_eff`= 414 LIMIT 1')); - if (isset ($effblago['id'])) { - $limitg = 50; - } else { - $limitg = 25; - } - while ($tmoni >= 1) { - - if ($u->info['ang_g'] < $limitg) { - $u->addItem(4754, $this->users[$i]['id'], ''); - mysql_query('UPDATE `users` SET `ang_g`=`ang_g`+1 WHERE `id` =' . $this->users[$i]['id'] . ''); - } else { - $tmon--; - } - $tmoni--; - - } - - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] .= ' За хаот вы получаете Реликвия Ангела (' . $tmon . '). Всего [' . ($u->info['ang_g'] + $tmon) . '/' . $limitg . '] в день. '; - } - unset($tmon, $tmoni, $effblago, $limitg); - } - - - if ($this->info['razdel'] == 5 || $this->info['razdel'] == 4) { - if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) { - //Хэллоуин 4504 - $this->users[$i]['battle_text'] .= ' Вы получаете Тыква (x1).'; - $u->addItem(4504, $this->users[$i]['id'], '|sudba=1'); - } - } - - - //Добавляем воинственность - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['exp'] >= 1500 /*($this->users[$i]['exp'] < 12499 || $this->users[$i]['exp'] > 12500)*/ - ) { - if ($this->users[$i]['battle_exp'] > 100 * $this->users[$i]['level']) { - $rzbvo = $this->users[$i]['battle_exp'] * 6 / 1000; - - if ($this->users[$i]['level'] == 8) { - if ($rzbvo >= 100) { - $rzbvo = 100; - } - } - if ($this->users[$i]['level'] == 9) { - if ($rzbvo >= 150) { - $rzbvo = 150; - } - } - if ($this->users[$i]['level'] == 10) { - if ($rzbvo >= 200) { - $rzbvo = 200; - } - } - if ($this->users[$i]['level'] == 11) { - if ($rzbvo >= 250) { - $rzbvo = 250; - } - } - if ($this->users[$i]['level'] == 12) { - if ($rzbvo >= 250) { - $rzbvo = 250; - } - } - - - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] .= ' Вы получили ' . $rzbvo . ' воинственности за этот бой.'; - } - mysql_query('UPDATE `rep` SET `rep3` = `rep3` + "' . $rzbvo . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")'); - } - } - - if ($this->stats[$i]['hpNow'] >= 1) { - $this->stats[$i]['test_heal'] = mysql_fetch_array(mysql_query('SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->stats[$i]['test_heal'] = $this->stats[$i]['test_heal'][0]; - $this->stats[$i]['test_start'] = mysql_fetch_array(mysql_query('SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->stats[$i]['test_start'] = $this->stats[$i]['test_start']['hpStart']; - // - $this->stats[$i]['hpNow'] = ($this->stats[$i]['test_start'] - $this->stats[$i]['test_heal']); - if ($this->stats[$i]['hpNow'] < 1) { - $this->stats[$i]['hpNow'] = 1; - } - } else { - $this->stats[$i]['hpNow'] = 0; - } - unset($this->stats[$i]['test_heal']); - - $this->users[$i]['last_b'] = $this->info['id']; //stats - $this->users[$i]['last_a'] = $act01; - $this->users[$i]['battle'] = -1; //users - $this->users[$i]['battle_yron'] = 0; //stats - $this->users[$i]['exp'] += $this->users[$i]['battle_exp']; //users - - if ($this->users[$i]['clan'] > 0) { - $cpr = 1; - if ($this->info['typeBattle'] == 9) { - $cpr = 25; - } elseif ($this->info['typeBattle'] == 50) { - $cpr = 65; - } - if ($this->stats[$i]['silver'] >= 5) { - $cpr = floor($cpr / 100 * 150); - } - mysql_query('UPDATE `clan` SET `exp` = `exp` + "' . round($this->users[$i]['battle_exp'] / 100 * $cpr) . '" WHERE `id` = "' . $this->users[$i]['clan'] . '" LIMIT 1'); - } - - $this->users[$i]['battle_exp'] = 0; //stats - - if ($this->users[$i]['team'] == $this->info['team_win']) { - mysql_query('UPDATE `rep` SET `n_capitalcity` = `n_capitalcity` + ' . $this->users[$i]['bn_capitalcity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_demonscity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_suncity'] . ' WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - - //репутация - $this->users[$i]['bn_demonscity'] = 0; - $this->users[$i]['bn_capitalcity'] = 0; - $this->users[$i]['bn_suncity'] = 0; - //завершение эффектов с финишем - $spe = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `file_finish` != "" AND `v1` = "priem" LIMIT 30'); - while ($ple = mysql_fetch_array($spe)) { - if (file_exists('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php')) { - require('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php'); - } - } - //обновляем данные - mysql_query('DELETE FROM `eff_users` WHERE `v1` = "priem" AND `uid` = "' . $this->users[$i]['id'] . '" LIMIT 50'); - if ($dnr == 1) { - if ($this->users[$i]['room'] == 370) { - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "dielaba" LIMIT 1')); - $dies = $dies[0]; - mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","dielaba","" - )'); - } else { - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "die" LIMIT 1')); - $dies = $dies[0]; - mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","die","" - )'); - } - if ($dies < 2 || $this->info['dungeon'] == 15) { - // - $tshbn = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 AND `item_id` = "4910" LIMIT 1')); - if (isset($tshbn['id'])) { - //выбрасываем шайбу - mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $tshbn['id'] . '" LIMIT 1'); - // - mysql_query('INSERT INTO `dungeon_obj` ( - `name`,`dn`,`x`,`y`,`img`,`delete`,`action`,`for_dn`, - `type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date` - ) VALUES ( - "Шайба","' . $this->info['dn_id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","shaiba.png","0","fileact:15/shaiba","0", - "0","120","220","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}" - )'); - // - } - //телепортируем в рестарт (координата 0х0) - $this->users[$i]['x'] = $this->users[$i]['res_x']; - $this->users[$i]['y'] = $this->users[$i]['res_y']; - $this->users[$i]['s'] = $this->users[$i]['res_s']; - $r_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `room` WHERE `id` = "' . (int)$this->users[$i]['room'] . '" LIMIT 1')); - if ($this->users[$i]['room'] == 370) { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в начале лабиринта'; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в начале лабиринта'; - } - } else { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в комнате "' . $r_n['name'] . '"'; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в комнате "' . $r_n['name'] . '"'; - } - } - } elseif ($this->info['dungeon'] == 102) { - $nld = ''; - $lab = mysql_fetch_array(mysql_query('SELECT `id`,`users` FROM `laba_now` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if ($lab['users'] < 2) { - //Удаляем подземелье - mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); - } else { - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - //удаляем все предметы которые пропадают после выхода из пещеры - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")'); - if ($this->users[$i]['login'] != '') { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; - } - } - } else { - $tinf = mysql_fetch_array(mysql_query('SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1')); - $nld = ''; - if ($tinf['uid'] == $this->users[$i]['id']) { - $tinf = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($tinf['id'])) { - $tinf = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $tinf['id'] . '" LIMIT 1')); - $nld .= ', новым лидером становится "' . $tinf['login'] . '"'; - mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1'); - } - } - $rooms = [ - 374 => 372, //ПТП (Кэпитал сити) - 189 => 188, //Водосток (Кэпитал сити) - 392 => 393, //Шахты (Кэпитал сити) - - 398 => 397, //Шахты (Ангелс сити) - 243 => 395, //Водосток (Ангелс сити) - 360 => 242, //Бездна (Ангелс сити) - - 19 => 293 //Катакомбы - ]; - // $n_rm = $rooms[$this->users[$i]['room']]; - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "321" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - //удаляем все предметы которые пропадают после выхода из пещеры - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['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 ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; - } - } - if ($rtxt != '') { - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - } - } - - mysql_query('UPDATE `users` SET `login2` = "" WHERE `battle` = "' . $this->info['id'] . '"'); - $upd = mysql_query('UPDATE `users` SET `login2` = "", `money` = "' . $this->users[$i]['money'] . '", `money2` = "' . $this->users[$i]['money2'] . '",`win` = "' . $this->users[$i]['win'] . '",`lose` = "' . $this->users[$i]['lose'] . '",`nich` = "' . $this->users[$i]['nich'] . '",`battle` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - - if ($u->info['id'] == $this->users[$i]['id']) { - $u->info['battle_text'] = $this->users[$i]['battle_text']; - } - - $upd2 = mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - if ($this->info['turnir'] == 0) { - //пишем в чат - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "','" . $this->users[$i]['battle_text'] . "','-1','6','0')"); - } else { - mysql_query('UPDATE `turnirs` SET `winner` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['turnir'] . '" LIMIT 1'); - } - //завершаем сам бой - $upd3 = mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - - // Жрать хочет - if ($this->users[$i]['animal'] > 0) { - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if (isset($a['id'])) { - if ($a['eda'] < 1) { - $u->send('', $this->users[$i]['room'], $this->users[$i]['city'], '', $this->users[$i]['login'], '' . $a['name'] . ' нуждается в еде...', time(), 6, 0, 0, 0, 1); - } - } - } - mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - //mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'"'); - $this->saveLogs($this->info['id'], 'all'); - if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) { - echo ''; - } - - } - } - //unlink($lock_file); - mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } else { - sleep(2); - mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } - mysql_query('UNLOCK TABLES'); - } - - //Выдаем предметы - //$this->addGlobalItems($this->user[$i]['id'],$this->user[$j]['id'],$mon['win_itm'],$mon['win_eff'],$mon['win_ico'],$mon['win_exp'],$mon['win_money'],$mon['win_money2']); - public $ainm = []; - - public function addGlobalItems($bid, $uid, $itm, $eff, $ico, $exp, $cr, $ecr) - { - global $u; - // - //Выпадение дропа на ЦП - if ($bid == 1008) { - //Старый Новый Год - $jit = 0; - $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); - $iit = floor($iit[0] / 20); - $iit = rand(1, $iit); - while ($jit < $iit) { - if (rand(0, 100) < 50) { - $svtk = [ - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1461, 1462, 1463, - 4037, 4038, 4039, 4040, - 911, 1172, 1173, 2142, 2141, 2143, 2870, 2144, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000 - ]; - $svtk = $svtk[rand(0, count($svtk) - 1)]; - if ($svtk == 1000) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - $jit++; - } - unset($svtk); - } elseif ($bid == 1007) { - //Хэллоуин, Тыквоголовый CAPITAL CITY - $jit = 0; - $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); - $iit = floor($iit[0] / 20); - $iit = rand(1, $iit); - while ($jit < $iit) { - if (rand(0, 100) < 50) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4504", - "", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - $jit++; - } - } elseif ($bid == 1006) { - //Трупожор CAPITAL CITY - if (rand(0, 100) < 10) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4451", - "srok=86400", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - } elseif ($bid == 1000) { - //Трупожор CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4460", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1001) { - //Трупожор CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4461", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1002) { - //Трупожор CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4462", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1003) { - //Трупожор CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4463", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1004) { - //Трупожор CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4459", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } - // - if ($exp >= 0) { - $this->users[$this->uids[$uid]]['battle_exp'] += round($exp * $this->users[$this->uids[$uid]]['battle_yron'] / $this->stats[$this->uids[$bid]]['hpAll']); - mysql_query('UPDATE `stats` SET `battle_exp` = "' . mysql_real_escape_string($this->users[$this->uids[$uid]]['battle_exp']) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); - } - // - if ($cr != '' && $cr > 0) { - if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { - mysql_query('UPDATE `users` SET `money` = (`money` + ' . mysql_real_escape_string($cr) . ') WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили кредиты: " . mysql_real_escape_string($cr) . " кр.','-1','6','0')"); - } - } - // - if ($ecr != '' && $ecr > 0) { - if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { - - $this->users[$this->uids[$uid]]['money2'] += $ecr; - //$sleptime=rand(1,20); - //usleep($sleptime*100000); - $resulttp = mysql_query('UPDATE `users` SET `money2` = (`money2` + ' . mysql_real_escape_string($ecr) . ') WHERE `id` = "' . $this->users[$this->uids[$uid]]['id'] . '" LIMIT 1'); - if (!$resulttp) { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Трупожор был пуст!!!','-1','6','0')"); - $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], '"System.battle": (В бою трупожор), ПУСТ!!! ', time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); - } else { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили Евро-кредиты: " . mysql_real_escape_string($ecr) . " екр.','-1','6','0')"); - $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], '"System.battle": Персонаж получил ' . $ecr . ' ЕКР (В бою трупожор), сейчас: ' . $this->users[$this->uids[$uid]]['money2'] . ' ЕКР', time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); - } - } - } - // - if ($ico != '') { - /* - 0(тип, 1 - значок, 2 - подвиг)@ - 1(время в минутах)@ - 2(название картинки)@ - 3(название)@ - 4(требует остаться в живых 0 или 1, либо игрок умер -1)@ - 5(требует набить с ботам урона в % Например 0.001)@ - 6(действия например: add_s1=5|add_hpAll=50)@ - 7(Требует другой значок, название картинки)@ - 8(плюсует значок 0 или 1)@ - 9(удаляем прошлый значок 0 or 1) - */ - $i = 0; - $txt = ''; - $ico = explode('#', $ico); - while ($i < count($ico)) { - $ico_e = explode('@', $ico[$i]); - if (isset($ico_e[3])) { - // - $add = 1; - if ($ico_e[4] == 1 && floor($this->stats[$this->uids[$uid]]['hpNow']) < 1) { - $add = 0; - } - if ($add == 1) { - $ins = false; - if ($ico_e[8] == 0) { - $ins = true; - if ($ico_e[9] == 1) { - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); - } - } else { - $old_ico = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0) AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '" LIMIT 1')); - if (!isset($old_ico['id'])) { - $ins = true; - } else { - if ($old_ico['id'] > 0) { - $txt .= ', "' . $ico_e[3] . ' (Обновление)"'; - mysql_query('UPDATE `users_ico` SET `x` = `x` + 1,`endTime` = "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '" WHERE `id` = "' . $old_ico['id'] . '" LIMIT 1'); - } else { - $ins = true; - } - } - unset($old_ico); - } - if ($ins == true) { - if ($ico_e[9] == 1) { - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); - } - mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`type`,`bonus`) VALUES ( - "' . mysql_real_escape_string($uid) . '", - "' . time() . '", - "' . mysql_real_escape_string($ico_e[3]) . '", - "' . mysql_real_escape_string($ico_e[2]) . '", - "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '", - "' . mysql_real_escape_string($ico_e[0]) . '", - "' . mysql_real_escape_string($ico_e[6]) . '" - )'); - $txt .= ', "' . $ico_e[3] . '"'; - } - } - // - } - $i++; - } - if ($txt != '') { - $txt = ltrim($txt, ', '); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы совершили подвиг: " . mysql_real_escape_string($txt) . "','-1','6','0')"); - } - } - // - if ($itm != '') { - $i = 0; - $txt = ''; - $itm = explode(',', $itm); - while ($i < count($itm)) { - $itm_e = explode('@', $itm[$i]); - if ($itm_e[0] > 0) { - $j = 0; - while ($j < $itm_e[1]) { - $u->addItem($itm_e[0], $uid, '|' . $itm_e[2]); - $j++; - } - if (!isset($this->ainm[$itm_e[0]])) { - $this->ainm[$itm_e[0]] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($itm_e[0]) . '" LIMIT 1')); - } - if (isset($this->ainm[$itm_e[0]]['id'])) { - //Добавляем текст о добавлении предмета - $txt .= ', ' . $this->ainm[$itm_e[0]]['name'] . ''; - if ($itm_e[1] > 1) { - $txt .= ' (x' . $itm_e[1] . ')'; - } - } - } - $i++; - } - if ($txt != '') { - $txt = ltrim($txt, ', '); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили предметы: " . mysql_real_escape_string($txt) . "','-1','6','0')"); - } - } - // - } - - //Проводим удар - public function addNewAtack() - { - global $u; - if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) { - $us = $this->stats[$this->uids[$u->info['id']]]; - $i = 1; - $no = 0; - - while ($i <= $us['zona']) { - if ($this->uAtc['a'][$i] == 0) { - $no = 1; - } - $i++; - } - - - if ($this->uAtc['b'] == 0) { - $no = 1; - } - - - if ($no == 0) { - //наносим удар - if ($u->info['enemy'] > 0) { - - if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { - //наносим новый удар - $a = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; - $b = $this->uAtc['b']; - mysql_query('DELETE FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((`uid2` = "' . $u->info['id'] . '" AND `uid1` = "' . $u->info['enemy'] . '") OR (`uid1` = "' . $u->info['id'] . '" AND `uid2` = "' . $u->info['enemy'] . '")) LIMIT 2'); - $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $u->info['id'] . '","' . $u->info['enemy'] . '","' . $a . '","' . $b . '")'); - if (!$d) { - $this->e = 'Не удалось нанести удар по противнику...'; - } else { - $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); - } - } - } else { - //отвечаем на удар противника - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { - if (isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) { - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; - $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); - } - } - } - } else { - //ожидание хода противника (нет подходящего противника) - - } - } else { - $this->e = 'Выберите зоны удара и блока'; - } - } else { - $this->e = 'Для вас поединок закончен, ожидайте пока завершат другие...'; - } - } else { - //уже ударили противника, ожидание хода - - } - } - - //Запускаем магические предметы, если в них что-то встроено - public function magicItems($uid1, $uid2, $end) - { - global $u, $priem, $c, $code; - if (isset($this->stats[$this->uids[$uid1]])) { - $i = 0; - while ($i < count($this->stats[$this->uids[$uid1]]['items'])) { - $itm = $this->stats[$this->uids[$uid1]]['items'][$i]; - if (isset($itm['id'])) { - $e = $u->lookStats($itm['data']); - if (isset($e['bm_a1'])) { - if ($end > 0) { - if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php')) { - require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php'); - } - } else { - if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php')) { - require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php'); - } - } - } - } - $i++; - } - unset($itm); - } - } - - //Поглощение урона - public function testPog($uid, $yr) - { - //$yr = round($yr*1.25); - $yr2 = $yr; - if ($yr > 0) { - $testmana = false; - global $u, $priem; - $i = 0; - $ypg22 = 0; - while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { - $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt3['add_pog2mp'])) { - $priem->minMana($uid, round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])); - } - $j['y'] -= $yr2; // осталось для поглощения - if (isset($dt3['add_pog2p'])) { - $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); - //echo '[Поглощаем: '.($dt3['add_pog2p']).'% за '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP]'; - } - unset($dt3); - if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { - $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { - //удаляем прием - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); - $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], $this->users[$this->uids[$uid]], 4, $uid); - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; - } - unset($dt2); - $yr2 = -($j['y']); - $j['y'] = 0; - } - - $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); - if ($upd) { - - } - $i++; - } - - } - return $yr2; - - } - - public $rehodeff = []; - - //Поглощение урона - public $poglast = []; - - public function testPogB($uid, $yr, $pliid, $test = 0) - { - //$yr = round($yr*1.25); - $yr2 = $yr; - $checktuman = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . '" - AND (`v2` = 273 OR `v2` = 286 OR `v2` = 287 OR `v2` = 288) - AND `delete` =0 LIMIT 1')); //проверка на туманный образ - //if ( !isset($checktuman['id'])) - if ($yr > 0 && !isset($checktuman['id'])) { - $testmana = false; - global $u, $priem; - $i = 0; - $ypg22 = 0; - while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { - $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; - if ($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] == $pliid || $test == 1) { - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - // - $dt30 = 0; - $dt30 = floor($j['y'] / $yr2 * 100); - // - //echo '['.$j['y'].'|'.$dt3['add_pog2'].'|'.$yr2.' -> '.$dt30.'/'.$dt3['add_pog2p'].'] '; - // - if ($dt30 < $dt3['add_pog2p']) { - $dt3['add_pog2p'] = $dt30; - } - // - unset($dt30); - // - if (isset($dt3['add_pog2mp'])) { - if ((round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) > $this->stats[$this->uids[$uid]]['mpNow']) { - //не хватило маны, считаем сколько хватит % от поглощенного урона - $j['yhj'] = $this->stats[$this->uids[$uid]]['mpNow'] / (round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) * 100; - $j['yhj'] = floor($j['yhj']); //Сколько % мы можем поглотить - $dt3['add_pog2p'] = floor($dt3['add_pog2p'] / 100 * $j['yhj']); - //echo '[!]'; - } - if ($test == 1) { - $priem->minMana($uid, round(round($yr2 / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); - } - } - if (!isset($this->poglast[$uid])) { - $this->poglast[$uid] = 0; - } - $this->poglast[$uid] += $yr2; - if ($test == 1) { - //$j['y'] -= $this->poglast[$uid]; // осталось для поглощения - $j['y'] -= round($this->poglast[$uid] / 100 * $dt3['add_pog2p']); - $priem->minMana($uid, round(round($this->poglast[$uid] / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); - } - if (isset($dt3['add_pog2p'])) { - $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); - //echo '[Поглощаем: '.($dt3['add_pog2p']).'% ( '.$yr2/100*$dt3['add_pog2p'].' от '.$yr2.' ед. ) за '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP , остаток МР: '.$this->stats[$this->uids[$uid]]['mpNow'].']'; - } - //unset($dt3); - if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { - $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { - //удаляем прием - //Добавляем в лог - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); - $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], $this->users[$this->uids[$uid]], 4, $uid); - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; - } - unset($dt2); - //$yr2 += -($j['y']); - $j['y'] = 0; - } - $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; - if (isset($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'])) { - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - //echo '['.$j['id'].'!'.$this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['id'].']'; - $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); - } - if ($upd) { - //echo '['.$j['y'].'->'.$yr2.']'; - //echo $this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['data']; - } - if ($j['y'] - $this->poglast[$uid] + $yr2 < 0) { - //echo '['.$yr.']'; - $yr -= $yr + ($j['y'] - $this->poglast[$uid] + $yr2); - //echo '['.$this->poglast[$uid].','.$yr2.','.$j['y'].']'; - $yr2 = $yr; - $i = count($this->stats[$this->uids[$uid]]['set_pog2']) + 1; - } - } - $i++; - } - - } - unset($checktuman); - return $yr2; - - } - - - //Проверка как бьем - public function testHowRazmen($id) - { - $r = [ - 1 => 0, 2 => 0 - ]; - if (isset($this->atacks[$id])) { - if ($this->atacks[$id]['out1'] > 0 && $this->atacks[$id]['out2'] > 0) { - //игрок 1 пропустил ход - if ($this->atacks[$id]['out1'] == 100) { - //на магию - $r[1] = -2; - } else { - //время - $r[1] = -1; - } - //игрок 2 пропустил ход - if ($this->atacks[$id]['out2'] == 100) { - //на магию - $r[2] = -2; - } else { - //время - $r[2] = -1; - } - } elseif ($this->atacks[$id]['out1'] > 0) { - //игрок 1 пропустил ход - if ($this->atacks[$id]['out1'] == 100) { - //Пропустил ход на магию - $r[1] = -2; - } else { - //Пропустил ход по тайму - $r[1] = -1; - } - //игрок 2 бьет - $r[2] = 1; - } elseif ($this->atacks[$id]['out2'] > 0) { - //игрок 2 пропустил ход - if ($this->atacks[$id]['out2'] == 100) { - //Пропустил ход на магию - $r[2] = -2; - } else { - //Пропустил ход по тайму - $r[2] = -1; - } - //игрок 1 бьет - $r[1] = 1; - } else { - //размен игрок 1 бьет по игрок 2 , и игрок 2 бьет по игрок 1 - $r[1] = 1; - $r[2] = 1; - } - } - return $r; - } - - //Тестируем удары и т.д - public function newRazmen($id, $at = null) - { - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->atacks[$id]['out1'] == 0) { - $at[1] = $this->usersTestAtack($id, $uid1, $uid2); - } else { - $at[1] = [0]; - } - if ($this->atacks[$id]['out2'] == 0) { - $at[2] = $this->usersTestAtack($id, $uid2, $uid1); - } else { - $at[2] = [0]; - } - - return $at; - } - - //Игрок1 наносит удар Игрок2 - public function usersTestAtack($id, $uid1, $uid2) - { - $r = []; - $block = [ - 0, - 0, - 0, - 0, - 0, - 0 - ]; - - //Проверка блоков - $i = 1; - if ($uid1 == $this->atacks[$id]['uid1']) { - $a = 2; - $j = $this->atacks[$id]['b2']; - $atack = [ - 0, - $this->atacks[$id]['a1'][0], - $this->atacks[$id]['a1'][1], - $this->atacks[$id]['a1'][2], - $this->atacks[$id]['a1'][3], - $this->atacks[$id]['a1'][4] - ]; - } elseif ($uid2 == $this->atacks[$id]['uid1']) { - $a = 1; - $j = $this->atacks[$id]['b1']; - $atack = [ - 0, - $this->atacks[$id]['a2'][0], - $this->atacks[$id]['a2'][1], - $this->atacks[$id]['a2'][2], - $this->atacks[$id]['a2'][3], - $this->atacks[$id]['a2'][4] - ]; - } - if ($this->atacks[$id]['out' . $a] == 0) { - while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { - //echo '{'.$j.'}'; - $block[$j] = 1; - $j++; - if ($j > 5 || $j < 1) { - $j = 1; - } - $i++; - } - } - //Проверка ударов - $i = 1; - while ($i <= $this->stats[$this->uids[$uid1]]['zona']) { - if (!isset($atack[$i]) || $atack[$i] == 0) { - $atack[$i] = rand(1, 5); - } - if ($atack[$i] > 0) { - if ($block[$atack[$i]] == 1) { - //удар был заблокирован - // КУДА БИЛ , ТИП УДАРА - $r['atack'][] = [$atack[$i], 3, 0]; - } else { - //Удар прошел - // КУДА БИЛ , ТИП УДАРА - $r['atack'][] = [$atack[$i], 1, 0]; - } - } - $i++; - } - return $r; - } - - //Проверка зоны и блока - public function testRazmenblock1($id, $uid1, $uid2, $atack) - { - $r = false; - //Проверка блоков - $i = 1; - if ($uid1 == $this->atacks[$id]['uid1']) { - $j = $this->atacks[$id]['b2']; - } elseif ($uid2 == $this->atacks[$id]['uid1']) { - $j = $this->atacks[$id]['b1']; - } - if ($this->atacks[$id]['out2'] == 0) { - while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { - //echo '{'.$j.'}'; - $block[$j] = 1; - $j++; - if ($j > 5 || $j < 1) { - $j = 1; - } - $i++; - } - } - //Проверка ударов - if ($atack > 0) { - if ($block[$atack] == 1) { - //удар был заблокирован - // КУДА БИЛ , ТИП УДАРА - $r = true; - } else { - //Удар прошел - // КУДА БИЛ , ТИП УДАРА - $r = false; - } - } - return $r; - } - - //Первичный расчет мф. эффектов (пример) - public function firstRazmen($id, $at) - { - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Расчет уворота Цели от Атакующего - - - $i++; - } - - return $at; - } - - //Проверка ухода удара в игрока - public function yhod_user($uid1, $uid2, $type) - { - // 1 - кто бьет . 2 - в кого бьют . тип - //Удал летит прямо в противника - if ($this->import_user == 0) { - $r = $uid1; - $rand_user = false; - if ($type == 2) { - //Случайный персонаж из своей команды (в том числе игрок) - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type == 4) { - //Случайный персонаж, любой - $i = 0; - while ($i < count($this->users)) { - //if( $this->users[$i]['team'] == $this->users[$this->uids[$uid1]]['team'] ) { - $rand_user[] = $this->users[$i]['id']; - //} - $i++; - } - } elseif ($type == 5) { - //Случайный персонаж, любой (кроме игрока) - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team'] && $uid2 != $this->users[$i]['id']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type == 6) { - //Случайный персонаж из команды противника - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->users[$this->uids[$uid2]]['team']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type > 100) { - //Удар идет в конкретного игрока - if (!isset($this->users[$this->uids[$type]]) || $this->users[$this->uids[$type]]['id'] != $type) { - $r = $uid2; - } else { - $r = $type; - } - } - if ($rand_user != false && count($rand_user) > 0) { - $r = $rand_user[rand(0, (count($rand_user) - 1))]; - } - $this->import_user = $r; - } else { - $r = $this->import_user; - } - return $r; - } - - //Расчет уворота игроков - public function mf1Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - - global $u; - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Расчет уворота Цели (u2) от Атакующего (u1) - //print_r( $at[$i] ); - $j = 0; - $wp01 = 3; - $k01 = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // КУДА БИЛ , ТИП УДАРА - if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - //Левая рука - $wp01 = 3; - $k01 = 1; - } else { - //Правая рука - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp01 = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp01 = 3; - } else { - //нет оружия - - $wp01 = 3; - } - } - $k01 = 0; - } - $witm01 = 0; - $witm_type01 = 0; - if ($wp01 > 0) { - $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; - $witm_data01 = $u->lookStats($witm01['data']); - //$r['wt'] = $witm['type']; - } - // - if ($at[$a]['atack'][$j][2] == $v) { - //if( $wp01 > 0 && $witm01['type'] == 20 ) { - // $tyv = $this->mfs( 2 , array( 'mf' => $this->stats[$this->uids[$u2]]['m4']*1.25 , 'amf' => $this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5'] ) ); - //}else{ - $tyv = $this->mfs(2, ['u1' => $u1, 'u2' => $u2, 'mf' => $this->stats[$this->uids[$u2]]['m4'], 'amf' => (int)$this->stats[$this->uids[$u2]]['m15'], 'smf' => ($this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5']), 'asmf' => $this->stats[$this->uids[$u1]]['m21']], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']); - //} - if ($tyv == 1 && $this->atacks[$id]['out' . $b] == 0) { - //увернулся, гад :) - $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); - if (!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] <= 0) { - $at[$a]['atack'][$j][1] = 2; - } else { - $this->stats[$this->uids[$u1]]['nopryh']--; - $this->stats[$this->uids[$u1]]['nopryh_act']++; - } - } - } - $j++; - } - - $i++; - } - unset($witm01, $witm_type01, $wp01, $k01); - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - //Расчет крита игроков - public function mf2Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - - global $u; - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Расчет крита Атакующего (u1) по Цели (u2) - //print_r( $at[$i] ); - $j = 0; - $wp01 = 0; - $k01 = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j <= 8) { - // КУДА БИЛ , ТИП УДАРА - if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - //Левая рука - $wp01 = 3; - $k01 = 1; - } else { - //Правая рука - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp01 = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp01 = 3; - } else { - //нет оружия - $wp01 = 3; - } - } - $k01 = 0; - } - $witm01 = 0; - $witm_type01 = 0; - if ($wp01 > 0) { - $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; - $witm_data01 = $u->lookStats($witm01['data']); - //$r['wt'] = $witm['type']; - } - // - //if( $at[$a]['atack'][$j][2] == $v ) { - if ($this->mfs(1, ['u1' => $u1, 'u2' => $u2, 'mf' => $this->stats[$this->uids[$u1]]['m1'] + $witm_data01['sv_m1'], 'amf' => $this->stats[$this->uids[$u1]]['m14'], 'smf' => $this->stats[$this->uids[$u2]]['m2'], 'aamf1' => (int)$this->stats[$this->uids[$u2]]['enemy_am1']], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { - //кританул, гад :) - if ($at[$a]['atack'][$j][1] == 3) { - //в блок - $at[$a]['atack'][$j][1] = 4; //Тут тест - } elseif ($at[$a]['atack'][$j][1] != 2 && $at[$a]['atack'][$j][1] != 6 && $at[$a]['atack'][$j][1] != 7 && $at[$a]['atack'][$j][1] != 8) { - //обычный крит - $at[$a]['atack'][$j][1] = 5; - } else { - $at[$a]['atack'][$j][1] = 1; - } - } - //} - $j++; - } - - $i++; - } - unset($witm01, $witm_type01, $k01, $wp01); - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - //Расчет парирования игроков - public function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Расчет парирования Цели (u2) от Атакующего (u1) - //print_r( $at[$i] ); - $j = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // КУДА БИЛ , ТИП УДАРА - if ((!isset($this->stats[$this->uids[$u2]]['no_pr1']) || $this->stats[$this->uids[$u2]]['no_pr1'] == 0) && $at[$a]['atack'][$j][2] == $v) { - if ($this->mfs(3, ['u1' => $u1, 'u2' => $u2, '1' => $this->stats[$this->uids[$u2]]['m7'], '2' => $this->stats[$this->uids[$u1]]['m7']], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { - //Парировал, гад :) - $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); - if ((!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0) && $this->stats[$this->uids[$u1]]['nopryh_act'] < 1) { - $at[$a]['atack'][$j][1] = 6; - $this->stats[$this->uids[$u1]]['nopryh']--; - $this->stats[$this->uids[$u1]]['nopryh_act']++; - } - } - } - $j++; - } - - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - //Расчет блока щитом игроков - public function mf4Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) { - //Расчет блока щитом Цели (u2) от Атакующего (u1) - //print_r( $at[$i] ); - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - // КУДА БИЛ , ТИП УДАРА - if ($at[$a]['atack'][$j][2] == $v) { - if ($this->mfs(5, ($this->stats[$this->uids[$u2]]['m8'] / 2 + $this->stats[$this->uids[$u2]]['m18']), $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { - //блокировал щитом, гад :) - /*if( !isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0 ) {*/ - $at[$a]['atack'][$j][1] = 7; - // $this->stats[$this->uids[$u1]]['nopryh']--; - // $this->stats[$this->uids[$u1]]['nopryh_act']++; - // } - } - } - $j++; - } - } - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - //Расчет контрудара игроков - public function mf5Razmen($id, $at, $v, $rjd = 0) - { - global $u; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Расчет контрудара Цели (u2) по Атакующему (u1) - //print_r( $at[$i] ); - $j = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // КУДА БИЛ , ТИП УДАРА - if ($at[$a]['atack'][$j][2] == $v) { - if ($at[$a]['atack'][$j][1] == 2) { - if ($this->mfs(6, ['u1' => $u1, 'u2' => $u2, 'a' => $this->stats[$this->uids[$u2]]['m6'], 'b' => $this->stats[$this->uids[$u1]]['m6']], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { - //контрудар, гад :) - $at[$a]['atack'][$j][1] = 8; - $rnd_a = rand(1, 5); - $rjd = count($at[$b]['atack']); - if ($this->testRazmenblock1($id, $u2, $u1, $rnd_a) == false) { - $at[$b]['atack'][] = [$rnd_a, 1, 0, 1]; // 3 , 0 , 1 - //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 - } else { - $at[$b]['atack'][] = [$rnd_a, 3, 0, 1]; // 3 , 0 , 1 - //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 - } - $at = $this->contrRestart($id, $at, 1, $rjd); - } - } - } - $j++; - } - - $i++; - } - - return $at; - } - - //Просмотр (для админов) - public function seeRazmen($id, $at) - { - $r = ''; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at[$a]['atack'])) { - $r .= 'u1 пропустил свой ход'; - } else { - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - if ($at[$a]['atack'][$j][1] == 1) { - //u1 ударил обычным ударом u2 - $r .= 'u1 ударил обычным ударом u2'; - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 увернулся от u1 - $r .= 'u2 увернулся от u1'; - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 заблокировал удар u1 - $r .= 'u2 заблокировал удар u1'; - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 пробил блок u2 критом - $r .= 'u1 пробил блок u2 критом'; - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 ударил критическим ударом u2 - $r .= 'u1 ударил критическим ударом u2'; - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 парировал удар u1 - $r .= 'u2 парировал удар u1'; - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 блокировал щитом удар u1 - $r .= 'u2 блокировал щитом удар u1'; - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 увернулся от удара u1 и нанес по нему контрудар - $r .= 'u2 увернулся от удара u1 и нанес по нему контрудар'; - } - if ($at[$a]['atack'][$j][3] == 1) { - $r .= ' (контрудар)'; - } - if (isset($at[$a]['atack'][$j]['yron'])) { - $r .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - if ($at[$a]['atack'][$j]['yron']['w'] == 3) { - $r .= ' (правая рука)'; - } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { - $r .= ' (левая рука)'; - } - } - if (isset($at[$a]['atack'][$j]['yron']['hp'])) { - $r .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; - } - $r .= ',
    '; - $j++; - } - } - - $r = str_replace('u1', '' . $this->users[$this->uids[$u1]]['login'] . '', $r); - $r = str_replace('u2', '' . $this->users[$this->uids[$u2]]['login'] . '', $r); - - $r .= '|
    '; - $i++; - } - - return $r; - } - - //Выделение из лог текста - public function addlt($a, $id, $s, $rnd) - { - global $log_text; - if ($rnd == null) { - $rnd = rand(0, (count($log_text[$s][$id]) - 1)); - } - return '{' . $a . 'x' . $id . 'x' . $rnd . '}'; - } - - //Добавляем статистику - public function addNewStat($stat) - { - if (isset($stat[1])) { - mysql_query('INSERT INTO `battle_stat` - ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", - "' . $stat[1]['uid1'] . '", - "' . $stat[1]['uid2'] . '", - "' . $stat[1]['time'] . '", - "' . $stat[1]['type'] . '", - "' . $stat[1]['a'] . '", - "' . $stat[1]['b'] . '", - "' . $stat[1]['ma'] . '", - "' . $stat[1]['mb'] . '", - "' . $stat[1]['type_a'] . '", - "' . $stat[1]['type_b'] . '", - "' . $stat[1]['yrn'] . '", - "' . $stat[1]['yrn_krit'] . '", - "' . $stat[1]['tm1'] . '", - "' . $stat[1]['tm2'] . '" - )'); - } - if (isset($stat[2])) { - mysql_query('INSERT INTO `battle_stat` - ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", - "' . $stat[2]['uid1'] . '", - "' . $stat[2]['uid2'] . '", - "' . $stat[2]['time'] . '", - "' . $stat[2]['type'] . '", - "' . $stat[2]['a'] . '", - "' . $stat[2]['b'] . '", - "' . $stat[1]['ma'] . '", - "' . $stat[2]['mb'] . '", - "' . $stat[2]['type_a'] . '", - "' . $stat[2]['type_b'] . '", - "' . $stat[2]['yrn'] . '", - "' . $stat[2]['yrn_krit'] . '", - "' . $stat[2]['tm1'] . '", - "' . $stat[2]['tm2'] . '" - )'); - } - } - - public $prlog = []; - - //Добавляем статистику ударов - public function asr($u1, $u2, $type) - { - mysql_query('INSERT INTO `battle_static` ( - `uid1`,`uid2`,`hod`,`type`,`time`,`bid` - ) VALUES ( - "' . $u1 . '","' . $u2 . '","' . $this->hodID . '","' . $type . '","' . time() . '","' . $this->info['id'] . '" - )'); - } - - //Добавляем размены в лог - public function addlogRazmen($id, $at) - { - global $u; - - $r = ''; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $this->hodID++; - - $dies = [ - 1 => 0, - 2 => 0 - ]; - - //массив для статистики - $stat = [ - 1 => [ - 'uid1' => 0, - 'uid2' => 0, - 'time' => time(), - 'type' => 0, - 'a' => '00000', - 'b' => '0', - 'type_a' => '', - 'type_b' => '0', - 'yrn' => 0, - 'yrn_krit' => 0, - 'ma' => 0, - 'mb' => 0, - 'tm1' => 0, - 'tm2' => 0 - ], - 2 => [ - 'uid1' => 0, - 'uid2' => 0, - 'time' => time(), - 'type' => 0, - 'a' => '00000', - 'b' => '0', - 'type_a' => '', - 'type_b' => '0', - 'yrn' => 0, - 'yrn_krit' => 0, - 'ma' => 0, - 'mb' => 0, - 'tm1' => 0, - 'tm2' => 0 - ] - ]; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if ($this->stats[$this->uids[$u1]]['yhod'] > 0) { - //$u1 = $u2; - } elseif ($this->stats[$this->uids[$u2]]['yhod'] > 0) { - $u2 = $this->yhod_user($u1, $u2, $this->stats[$this->uids[$u2]]['yhod']); - } - - $s1 = $this->users[$this->uids[$u1]]['sex']; - $s2 = $this->users[$this->uids[$u2]]['sex']; - - $stat[$a]['uid1'] = $u1; - $stat[$a]['uid2'] = $u2; - $stat[$a]['ma'] = $this->stats[$this->uids[$u1]]['zona']; - $stat[$a]['mb'] = $this->stats[$this->uids[$u1]]['zonb']; - $stat[$a]['tm1'] = $this->users[$this->uids[$u1]]['team']; - $stat[$a]['tm2'] = $this->users[$this->uids[$u2]]['team']; - $stat[$a]['a'] = $this->atacks[$id]['a' . $a]; - $stat[$a]['b'] = $this->atacks[$id]['b' . $a]; - - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s' . $a . '=' . $s1 . '||s' . $b . '=' . $s2 . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'vars' => $vLog, - 'type' => 1 - ]; - - if (!isset($at[$a]['atack'])) { //ТУТ тест пропуска - if ($this->atacks[$id]['tpo' . $a] == 2) { - $mas['text'] .= '{u1} потратил свой ход на магию.'; - } else { - // - if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - mysql_query('INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES ( - "' . $this->info['id'] . '","' . $u1 . '","' . $u2 . '","' . time() . '","1" - )'); - } - // - if (isset($u1)) { - $mas['text'] .= '{u1} пропустил свой ход.'; - //Проверка сброс туманок - mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1'); - } - } - $mas['text'] = '{tm1} ' . $mas['text']; - $this->add_log($mas); - } else { - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - // - $mas['text'] = ''; - // - $wt = [ - 21 => 4, - 22 => 5, - 20 => 2, - 28 => 2, - 19 => 3, - 18 => 1, - 26 => 22 - ]; - $par = [ - 'zona' => '{zn2_' . $at[$a]['atack'][$j][0] . '} ', - 'kyda' => $this->lg_zon[$at[$a]['atack'][$j][0]][rand(0, (count($this->lg_zon[$at[$a]['atack'][$j][0]]) - 1))], - 'chem' => $this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]][rand(0, (count($this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]]) - 1))] - ]; - // - $this->atacks[$id]['uid_' . $u1 . '_t' . $at[$a]['atack'][$j][1]]++; - // - // - $this->asr($u1, $u2, $at[$a]['atack'][$j][1]); - // - if ($at[$a]['atack'][$j][1] == 1) { - //u1 ударил обычным ударом u2 - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, null) . ' ' . $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 увернулся от u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 заблокировал удар u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, 9, $s1, null) . ' {u2} ' . $this->addlt($b, 10, $s2, null) . ' ' . $this->addlt(1, 7, 0, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 пробил блок u2 критом - if (isset($at[$a]['atack'][$j]['yron']['t'])) { - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, $s1, null) . '' . $this->addlt($a, 5, $s1, null) . ', пробив блок, ' . $this->addlt($a, 6, $s1, null) . ' ' . $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 ударил критическим ударом u2 - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, null) . ' ' . $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 парировал удар u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, 9, $s1, null) . ' {u2} неожиданно парировал ' . $this->addlt(1, 7, 0, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 блокировал щитом удар u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, 9, $s1, null) . ' {u2}, воспользовавшись своим щитом, ' . $this->addlt($b, 10, $s2, null) . ' ' . $this->addlt(1, 7, 0, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 увернулся от удара u1 и нанес по нему контрудар - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . ' и нанес контрудар. '; - } - - $stat[$a]['type_a'] .= '' . $at[$a]['atack'][$j][1] . ''; - if ((!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && isset($at[$a]['atack'][$j]['yron']['travma']) && $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && floor($at[$a]['atack'][$j]['yron']['hp']) <= 0) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u2 . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { - //263 - if (isset($tr_pl['id'])) { - $at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3); - } - $tr_pl2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = "' . $u2 . '" AND `delete` = "0" AND `name` LIKE "%Защита от травм%" LIMIT 1')); - if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) { - $mas['text'] = rtrim($mas['text'], '. '); - $mas['text'] .= ', нанеся противнику '; - if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { - $mas['text'] .= 'Легкую'; - $this->addTravm($u2, 1, rand(3, 5)); - } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) { - $mas['text'] .= 'Среднюю'; - $this->addTravm($u2, 2, rand(3, 5)); - } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) { - $mas['text'] .= 'Тяжелую'; - $this->addTravm($u2, 3, rand(3, 5)); - } - $mas['text'] .= ' травму. '; - } - } - unset($tr_pl); - } - if ($at[$a]['atack'][$j]['yron']['pb'] == 1 && isset($at[$a]['atack'][$j]['yron']['hp'])) { - $mas['text'] = rtrim($mas['text'], '. '); - $mas['text'] .= ' пробив броню. '; - } - if ($at[$a]['atack'][$j][3] == 1) { - $mas['text'] .= '(контрудар) '; - } - if (isset($at[$a]['atack'][$j]['yron'])) { - if ($at[$a]['atack'][$j]['yron']['w'] == 3) { - $mas['textWP'] = '(правая рука)'; - } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { - $mas['textWP'] = '(левая рука)'; - } else { - $mas['textWP'] = '(непонятно чем)'; - } - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 || $at[$a]['atack'][$j][1] == 1) { - if ($at[$a]['atack'][$j]['yron']['y'] < 1) { - $at[$a]['atack'][$j]['yron']['r'] = '--'; - } - } - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { - $stat[$a]['yrn_krit'] += -$at[$a]['atack'][$j]['yron']['r']; - //$stat[$a]['yrn_krit'] += $at[$a]['atack'][$j]['yron']['k']; - $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - } else { - $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - } - $stat[$a]['yrn'] += -$at[$a]['atack'][$j]['yron']['r']; - } - if (isset($at[$a]['atack'][$j]['yron']['hp'])) { - if ($this->users[$this->uids[$u2]]['align'] == 9) { - $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hp'] / ($at[$a]['atack'][$j]['yron']['hpAll'] / 100); - $at[$a]['atack'][$j]['yron']['hpAll'] = '100%'; - } - $mas['text'] .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; - } - // - if ($mas['text'] != '') { - $mas['text'] = '{tm1} ' . $mas['text']; - } - if (count($at[$a]['atack'][$j]['yron']['plog']) > 0) { - $il = 0; - while ($il <= count($at[$a]['atack'][$j]['yron']['plog'])) { - if (isset($at[$a]['atack'][$j]['yron']['plog'][$il])) { - eval($at[$a]['atack'][$j]['yron']['plog'][$il]); - } - $il++; - } - } - $this->add_log($mas); - $j++; - } - } - $i++; - } - - //Добавляем статистику + записываем в баттл_юзерс НР игроков - $this->addNewStat($stat); - - //Вывод в лог смерти персонажа - if (floor($this->stats[$this->uids[$u1]]['hpNow']) < 1) { - $dies[1] = 1; - } - if (floor($this->stats[$this->uids[$u2]]['hpNow']) < 1) { - $dies[2] = 1; - } - if ($dies[1] > 0 || $dies[2] > 0) { - $s1 = $this->users[$this->uids[$u1]]['sex']; - $s2 = $this->users[$this->uids[$u2]]['sex']; - - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'vars' => $vLog, - 'type' => 1 - ]; - - $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; - $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; - - if ($this->info['typeBattle'] == 99) { - if ($btlstatus[0] == 0) { - //Кровавые бои обычные - $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; - if ($this->info['razdel'] == 5) { - //не хаот - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } else { - //хаот - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - } elseif ($btlstatus[0] == 25) { - //Кровавая битва - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 50) { - //Кровавая резня - $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 75) { - //Кровавая сеча - $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 100) { - //Кровавое побоище - $rtngwin = [6, 12, 24, 48, 98, 196, 392, 784, 1568]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 150) { - //Судный день - $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } - } else { - if ($btlstatus[0] == 0) { - //Обычный поединок - $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; - if ($this->info['razdel'] == 5) { - //не хаот - $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; - } else { - //хаот - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - } elseif ($btlstatus[0] == 25) { - //великая битва - $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 50) { - //величайшая битва - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 75) { - //историческая битва сеча - $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 100) { - //эпохальная битва - $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 150) { - //судный день - $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } - } - - if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) { - //Пещерные бои не считаются и Изломы тоже, ну и Турниры - $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) { - //Клановая война - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256]; - } - - - if ($dies[1] == 1) { - if ($this->info['dn_id'] > 0) { - //не дается репутация - } else { - if ($this->users[$this->uids[$u1]]['level'] >= 4) { - $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; - $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; - } - } - //Персонаж 1 погиб от рук персонаж 2 - $this->spaCheck($this->users[$this->uids[$u1]]['id']); - - } - if ($dies[2] == 1) { - if ($this->info['dn_id'] > 0) { - //не дается репутация - } else { - if ($this->users[$this->uids[$u1]]['level'] >= 4) { - $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; - $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; - } - } - //Персонаж 2 погиб от рук персонаж 1 - $this->spaCheck($this->stats[$this->uids[$u2]]['id']); - } - //Записываем рейтинг - // - if ($this->info['type'] != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - // - if ($this->users[$this->uids[$u2]]['bot'] == 0) { - mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( - "' . $u1 . '","' . time() . '","' . $rtng1 . '","' . $this->users[$this->uids[$u1]]['align'] . '","' . $this->users[$this->uids[$u1]]['clan'] . '")'); - } - unset($rtng); - if ($this->users[$this->uids[$u1]]['bot'] == 0) { - mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( - "' . $u2 . '","' . time() . '","' . $rtng2 . '","' . $this->users[$this->uids[$u2]]['align'] . '","' . $this->users[$this->uids[$u2]]['clan'] . '")'); - } - } - unset($rtng1, $rtng2); - } - - return true; - } - - //Добавляем в лог действия приема - public function priemAddLog($id, $a, $b, $u1, $u2, $prm, $text, $hodID, $tm1 = 0, $tm2 = 0) - { - if ($tm1 == 0) { - if (isset($this->atacks[$id])) { - $tm1 = $this->atacks[$id]['time']; - } else { - $tm1 = time(); - } - } - if ($tm2 == 0) { - if (isset($this->atacks[$id])) { - $tm2 = $this->atacks[$id]['time2']; - } else { - $tm2 = time(); - } - } - $vLog = 'prm=' . $prm . '||at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $tm1 . '||time2=' . $tm2 . '||s' . $a . '=' . $this->users[$this->uids[$u1]]['sex'] . '||s' . $b . '=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - $mas = [ - 'text' => $text, - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => $hodID, - 'vars' => $vLog, - 'type' => 1 - ]; - $this->add_log($mas); - } - - //Добавляем в лог действия приема (без атаки) - public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm) - { - $vLog = 'prm=' . $prm . '||time1=' . $tm . '||time2=' . $tm . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - $mas = [ - 'text' => $text, - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + $hodID), - 'vars' => $vLog, - 'type' => 1 - ]; - $this->add_log($mas); - } - - //Считаем контру - public function contrRestart($id, $at, $v, $rjd = 0) - { - //уворот - $at = $this->mf1Razmen($id, $at, $v, true, $rjd); - //парирование - $at = $this->mf3Razmen($id, $at, $v, true, $rjd); - //контрудар - //$at = $this->mf5Razmen($id,$at,$v,true,$rjd); - //блок щитом (если есть щит, конечно) - $at = $this->mf4Razmen($id, $at, $v, true, $rjd); - //Проверяем урон - //$at = $this->yronRazmen($id,$at); - //крит - $at = $this->mf2Razmen($id, $at, $v, true, $rjd); - $at = $this->yronRazmen($id, $at, true, $rjd); - - return $at; - } - - //Расчитываем статы для конкретной зоны атаки - public function yronGetrazmenStats($s, $z) - { - global $u; - /* - 1 - шлем - 2 - наручи - 3 - оружие (правая рука) - 4 - рубаха - 5 - броня - 6 - плащ - 7 - пояс - 8 - серьги - 9 - амулет - 10-12 - кольца - 13 - перчатки - 14 - оружие / щит (левая рука) - 16 - поножи - 17 - ботинки - */ - $zi = [ //Предметы влияющие на зоны - 1 => [1, 8, 9, 52], //голова - 2 => [4, 5, 6], //грудь - 3 => [2, 4, 5, 6, 13], //живот - 4 => [7, 16, 10, 11, 12], //пояс - 5 => [17] //ноги - ]; - // - $zi = $zi[$z]; - $i = 0; - // - while ($i < count($zi)) { - // - $t = $u->items['add']; - $ii = 0; - // - while ($ii < count($s['items'])) { - if (isset($s['items'][$ii]) && $s['items'][$ii]['inOdet'] == $zi[$i]) { - $po = $u->lookStats($s['items'][$ii]['data']); - // - $x = 0; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($po['sv_' . $n])) { - $s[$n] += $po['sv_' . $n]; - if ($n == 'za') { - $iii = 1; - while ($iii <= 4) { - $s['za' . $iii] += $po['sv_' . $n]; - $iii++; - } - } elseif ($n == 'zm') { - $iii = 1; - while ($iii <= 4) { - $s['zm' . $iii] += $po['sv_' . $n]; - $iii++; - } - } elseif ($n == 'zma') { - $iii = 1; - while ($iii <= 7) { - $s['zma' . $iii] += $po['sv_' . $n]; - $iii++; - } - } - } - $x++; - } - // - } - $ii++; - } - // - $i++; - } - // - return $s; - } - - //Расчитываем ед. урона - public function yronGetrazmen($uid1, $uid2, $wp, $zona) - { - global $u; - $r = [ - 'y' => 0, - 'r' => '--' - ]; - //Определяем тип урона - /* - Колющий - Рубящий - Режущий - Дробящий - */ - $witm = 0; - $witm_type = 0; - - if ($wp > 0) { - $witm = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp' . $wp . 'id']]; - $witm_data = $u->lookStats($witm['data']); - $witm_type = $this->weaponTx($witm); - } - if ($witm_type == 0 || $witm_type == 12) { - $witm_type2 = ''; - } else { - $witm_type2 = $witm_type; - } - $r['t'] = $witm_type2; - //Расчет брони - /* - голова - грудь - живот - пояс - ноги - */ - $bron = [ - 1 => [$this->stats[$this->uids[$uid2]]['mib1'], $this->stats[$this->uids[$uid2]]['mab1']], - 2 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], - 3 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], - 4 => [$this->stats[$this->uids[$uid2]]['mib3'], $this->stats[$this->uids[$uid2]]['mab3']], - 5 => [$this->stats[$this->uids[$uid2]]['mib4'], $this->stats[$this->uids[$uid2]]['mab4']] - ]; - // - //Увеличиваем параметры от текущего оружия которым бьем - //$witm_data - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_a' . $iii]) && $witm_data['sv_a' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_a' . $iii]; - } - if (isset($witm_data['sv_mg' . $iii]) && $witm_data['sv_mg' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mg' . $iii]; - } - $iii++; - } - $iii = 1; - while ($iii <= 4) { - if (isset($witm_data['sv_aall']) && $witm_data['sv_aall'] != 0) { - $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_aall']; - } - $iii++; - } - $iii = 1; - while ($iii <= 4) { - if (isset($witm_data['sv_mall']) && $witm_data['sv_mall'] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mall']; - } - $iii++; - } - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_m2all']) && $witm_data['sv_m2all'] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_m2all']; - } - $iii++; - } - - if (isset($witm_data['sv_m3']) && $witm_data['sv_m3'] != 0) { - $this->stats[$this->uids[$uid1]]['m3'] += $witm_data['sv_m3']; - } - - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_pa' . $iii]) && $witm_data['sv_pa' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['pa' . $iii] += $witm_data['sv_pa' . $iii] + $witm_data['sv_m10']; - } - if (isset($witm_data['sv_pm' . $iii]) && $witm_data['sv_pm' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_pm' . $iii] + $witm_data['sv_m11a']; - if ($iii < 5) { - $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_m11']; - } - } - $iii++; - } - // - //мощность + подавление мощности противником - $wAp = 0; - $w3p = 0; - $w14p = 0; - if ($witm_type == 12) { - //удар кулаком - $wAp += $this->stats[$this->uids[$uid1]]['m10']; - if ($this->users[$this->uids[$uid1]]['align'] == 7) { - $wAp += 15; - } - } elseif ($witm_type < 5) { - $wAp += $this->stats[$this->uids[$uid1]]['pa' . $witm_type . '']/* + $this->stats[$this->uids[$uid1]]['m10'] + $witm_data['sv_pa'.$witm_type.'']*/ - ; - $wAp -= $this->stats[$this->uids[$uid2]]['antpa' . $witm_type . '']; - } else { - $wAp += $this->stats[$this->uids[$uid1]]['m10'] + $this->stats[$this->uids[$uid1]]['pm' . ($witm_type - 4) . ''] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm' . ($witm_type - 4) . '']; - $wAp -= $this->stats[$this->uids[$uid2]]['antpm' . ($witm_type - 4) . '']; - } - // - - // - //Владение данным оружием - $vladenie = 0; - - //Пробой брони - $proboi = 0; - $witm_data['m9'] = $this->stats[$this->uids[$uid1]]['m9']; - if (rand(1, 100) < floor($witm_data['m9'] / 2)) { - $proboi = floor($witm_data['m9'] / 2); - $r['pb'] = 1; - } - - $y = $this->yrn( - $this->stats[$this->uids[$uid1]], - $this->stats[$this->uids[$uid2]], - $this->users[$this->uids[$uid1]], - $this->users[$this->uids[$uid2]], - $this->users[$this->uids[$uid1]]['level'], - $this->users[$this->uids[$uid2]]['level'], - // - $witm_type, - $this->stats[$this->uids[$uid1]]['minAtack'], //мин. урон (добавочный) - $this->stats[$this->uids[$uid1]]['maxAtack'], //макс. урон - $bron[$zona][0], //броня мин. - $bron[$zona][1], //броня макс - // - $vladenie, //владения - (($wAp /*+ $w3p + $w14p*/)), //мощность урона - (round($this->stats[$this->uids[$uid1]]['m3'])), //мощность крита - (($this->stats[$this->uids[$uid2]]['za' . $witm_type2]) - $this->stats[$this->uids[$uid1]]['pza']), //защита от урона - $this->stats[$this->uids[$uid1]]['ozash'], //подавление защиты - $proboi, //пробой брони - 0, //хз - ($witm_data['sv_yron_min'] + $this->stats[$this->uids[$uid1]]['yron_min']), - ($witm_data['sv_yron_max'] + $this->stats[$this->uids[$uid1]]['yron_max']), - $this->stats[$this->uids[$uid2]]['zaproc'], - $this->stats[$this->uids[$uid2]]['zmproc'], - (($this->stats[$this->uids[$uid2]]['zm' . ($witm_type2 - 4)]) - round($this->stats[$this->uids[$uid1]]['pzm'] * 0.8)), //защита от урона - $this->stats[$this->uids[$uid1]]['omzash'], //подавление защиты - $witm['type'], - $witm - ); - - $r['y'] = round(rand($y['min'] + $proboi, $y['max'] + round($proboi / 2))); - $r['k'] = round(rand($y['Kmin'] + round($proboi / 4), $y['Kmax'] + round($proboi / 8))); - - $r['m_y'] = $y['max']; - $r['m_k'] = $y['Kmax']; - - $r['bRND'] = $y['bRND']; - - $r['w_type'] = $witm_type; - - //Если второе оружие - урон ниже на 50% - $wp1 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp3id']]; - $wp2 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp14id']]; - - //тип от оружия - if ($witm['type'] == 18) { - $tp = 1; - } elseif ($witm['type'] == 19) { - $tp = 2; - } elseif ($witm['type'] == 20) { - $tp = 3; - } elseif ($witm['type'] == 21) { - $tp = 4; - } else { - //$tp = 0; - } - - if ($tp != $witm_type && $wp > 0) // ТУТ - { - $r['y'] = round($r['y'] / 3); - $r['r'] = round($r['r'] / 3); - $r['k'] = round($r['k'] / 3); - $r['m_k'] = round($r['m_k'] / 3); - $r['m_y'] = round($r['m_y'] / 3); - - } - - if (isset($this->stats[$this->uids[$uid2]]['zaproc'])) { - $r['y'] = round($r['y'] - $r['y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['r'] = round($r['r'] - $r['r'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['k'] = round($r['k'] - $r['k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['m_k'] = round($r['m_k'] - $r['m_k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['m_y'] = round($r['m_y'] - $r['m_y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - if ($r['k'] < 1) { - $r['k'] = 2; - } - - } - - if ($r['y'] < 1) { - $r['y'] = 1; - } - if ($r['r'] >= 0) { - $r['r'] = -1; - } - if ($r['k'] < 1) { - $r['k'] = 1; - } - if ($r['m_k'] < 1) { - $r['m_k'] = 1; - } - if ($r['m_y'] < 1) { - $r['m_y'] = 1; - } - //$this->a_restart_stats($uid1,1); - //$this->a_testing_stats($uid2,1); - return $r; - } - - //Считаем урон - public function yronRazmen($id, $at, $pat = false, $rjd = 0) - { - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $yhod = [1 => 1, 2 => 0]; - //$uid1 = $this->yhod_user($this->atacks[$id]['uid2'],$this->atacks[$id]['uid1'],$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $yhod = [1 => 0, 2 => 1]; - //$uid2 = $this->yhod_user($this->atacks[$id]['uid1'],$this->atacks[$id]['uid2'],$this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Считаем свойства от предметов - - - //Расчет удара (u2) по (u1) - //print_r( $at[$i] ); - $j = 0; - $k = 0; - $wp = 3; - if ($rjd > 0) { - $j = $rjd - 1; - } - //ТУТ - - //$checkhp1=$this->stats[$this->uids[$u2]]['hpNow']; - while ($j < count($at[$a]['atack']) && $j < 8) { - // КУДА БИЛ , ТИП УДАРА - if ($k == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - //Левая рука - $wp = 3; - $k = 1; - } else { - //Правая рука - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp = 3; - } else { - //нет оружия - $wp = 3; - } - } - $k = 0; - } - if ($wp > 0) { - $witm = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp . 'id']]; - $witm_type = $this->weaponTx($witm); - $at[$a]['atack'][$j]['wt'] = $witm['type']; - } - // - $at[$a]['atack'][$j]['yhod'] = $yhod[$a]; - // - if (!isset($at[$a]['atack'][$j]['yron']) && ( - $at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5) - ) { - $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], $yhod[$b]); - - if ($at[$a]['atack'][$j][1] == 4) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k'] / 2); - - } elseif ($at[$a]['atack'][$j][1] == 5) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; - - } - $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['yron']['w'] = $wp; - if ($at[$a]['atack'][$j]['yron']['y'] < 1) { - $at[$a]['atack'][$j]['yron']['r'] = '--'; - } else { - $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; - } - // - } else { - // - $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], $yhod[$b]); - if ($at[$a]['atack'][$j][1] == 4) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k'] / 2); - - } elseif ($at[$a]['atack'][$j][1] == 5) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; - - } - $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['block']['w'] = $wp; - if ($at[$a]['atack'][$j]['block']['y'] < 1) { - $at[$a]['atack'][$j]['block']['r'] = '--'; - } else { - $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; - } - } - $j++; - } - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - //Обновление здоровья - public function updateHealth($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Рассчет дополнительных тактик - if ($this->atacks[$id]['out' . $b] > 0) { - //Игрок ${'u'.$a} получает тактики, возможно - if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m6'] / 5), 20)) { - //выдаем тактику контрудара - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic3']++; - } - } - if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m8'] / 4), 20)) { - //выдаем тактику щита - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic4']++; - } - } - } - - //Расчет удара Цели (u2) по Атакующему (u1) - //print_r( $at[$i] ); - $j = 0; - $k = 0; - $wp = 3; - while ($j < count($at[$a]['atack']) && $j < 8) { - //Добавляем тактики - //$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] - if ($at[$a]['atack'][$j][1] == 1) { - //u1 ударил обычным ударом u2 - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic1']++; - } - //Двуручка - if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic1'] += 2; - } - } - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 увернулся от u1 - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 заблокировал удар u1 - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic4']++; - } - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 пробил блок u2 критом - if (!isset($at[$a]['atack'][$j]['notactic2'])) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2']++; - } - } - $this->users[$this->uids[$u2]]['tactic4']++; //тактика за пробив блок - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 ударил критическим ударом u2 - if (!isset($at[$a]['atack'][$j]['notactic2'])) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2'] += 2; - } - //Двуручка - if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2'] += 1; - } - } - } - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 парировал удар u1 - if (!isset($at[$a]['atack'][$j]['notactic5'])) { - if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic5']++; - } - } - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 блокировал щитом удар u1 //ТУТ ЩИТ - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic4']++; - } - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 увернулся от удара u1 и нанес по нему контрудар - if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic3']++; - } - } - // КУДА БИЛ , ТИП УДАРА - if (isset($at[$a]['atack'][$j]['yron']) && ( - $at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5)) { - // - - if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['y']) { - $at[$a]['atack'][$j]['yron']['y'] = $this->stats[$this->uids[$u2]]['hpNow']; - } - if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['k']) { - $at[$a]['atack'][$j]['yron']['k'] = $this->stats[$this->uids[$u2]]['hpNow']; - } - - if ($at[$a]['atack'][$j]['yron']['y'] < 0) { - $at[$a]['atack'][$j]['yron']['y'] = 1; - $at[$a]['atack'][$j]['yron']['r'] = -1; - $at[$a]['atack'][$j]['yron']['k'] = 1; - } - if ($this->stats[$this->uids[$u2]]['hpNow'] < 1) { - $at[$a]['atack'][$j]['yron']['y'] = 0; - $at[$a]['atack'][$j]['yron']['r'] = -1; - $at[$a]['atack'][$j]['yron']['k'] = 0; - } - - //Добавляем нанесенный урон и опыт - //$this->users[$this->uids[$u1]]['battle_yron'] += $at[$a]['atack'][$j]['yron']['y']; - $this->takeExp($u1, $at[$a]['atack'][$j]['yron']['y'], $u1, $u2); - //Отнимаем НР - $this->stats[$this->uids[$u2]]['hpNow'] -= $at[$a]['atack'][$j]['yron']['y']; - $this->users[$this->uids[$u2]]['last_hp'] = -$at[$a]['atack'][$j]['yron']['y']; - - //echo '['.$u1.' -> '.$u2.']'; - $at[$a]['atack'][$j]['yron']['hp'] = $this->stats[$this->uids[$u2]]['hpNow']; - if ($at[$a]['atack'][$j]['yron']['hp'] < 1) { - $at[$a]['atack'][$j]['yron']['hp'] = 0; - } - $at[$a]['atack'][$j]['yron']['hpAll'] = $this->stats[$this->uids[$u2]]['hpAll']; - if ($at[$a]['atack'][$j]['yron']['hp'] > $at[$a]['atack'][$j]['yron']['hpAll']) { - $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hpAll']; - } - // - //Травмирование - if (rand(0, 100) <= 50) { - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { - if (!isset($at[$a]['atack'][$j]['yron']['travma']) && rand(0, 1000) < 500 && $this->users[$this->uids[$u2]]['level'] > 1 && $this->stats[$this->uids[$u1]] > 1) { - $trvm_chns = floor(rand(0, 200) / 10); - if ($trvm_chns > 3 || $trvm_chns < 1) { - $trvm_chns = 0; - } - $at[$a]['atack'][$j]['yron']['travma'] = [$trvm_chns, 'Обыкновенная травма']; - unset($trvm_chns); - } - } - } - } - $j++; - } - - $i++; - } - - return $at; - } - - //Добавляем новую статистику игрока - public function addstatuser($id) - { - if ($id > 0) { - $uid = $id; - $id = $this->uids[$uid]; - mysql_query('INSERT INTO `battle_users` - ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` ) - VALUES - ( - "' . $this->info['id'] . '", - "' . $uid . '", - "' . time() . '","' . $this->users[$id]['login'] . '", - "' . $this->users[$id]['level'] . '", - "' . $this->users[$id]['align'] . '", - "' . $this->users[$id]['clan'] . '", - "' . $this->stats[$id]['hpAll'] . '", - "' . $this->stats[$id]['hp'] . '", - "' . $this->stats[$id]['hpNow'] . '", - "' . $this->users[$id]['team'] . '" - )'); - } - } - - //Проверяем приемы - public function priemsRazmen($id, $at) - { - if ($at == 'fast') { - $uid1 = $id[0]; - $uid2 = $id[1]; - } else { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - } - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - //Получаем приемы и смотрим когда какой действует - $eff = $this->stats[$this->uids[$u1]]['effects']; - $this->stats[$this->uids[$u1]]['u_priem'] = []; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - $this->stats[$this->uids[$u1]]['u_priem'][] = [$j, $eff[$j]['v2'], $this->prm[$eff[$j]['v2']]['act'], $eff[$j]['id'], $this->prm[$eff[$j]['v2']]['type_of'], $this->prm[$eff[$j]['v2']]['moment'], $this->prm[$eff[$j]['v2']]['moment_end'], $this->prm[$eff[$j]['v2']]['type_sec']]; - } - $j++; - } - - $i++; - } - // - } - - //Приемы которые используются моментально - public function priemsRazmenMoment($id, $at) - { - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - // - - //Приемы ухода от удара - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - //Приемы крита - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Приемы атаки - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - //Приемы защиты - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 4) { - if ($this->testPriemVarTrueZash($i, 1, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, $u1, $u2) == false) { - - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $i++; - } - // - return $at; - } - - //Приемы которые используются моментально (в конце хода) - public function priemsRazmenMomentEnd($id, $at) - { - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - // - - //Приемы ухода от удара - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - //Приемы крита - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Приемы атаки - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - } - $j++; - } - //Приемы защиты - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) { - if ($this->testPriemVarTrueZash($i, 2, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, $u1, $u2) == false) { - - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $i++; - } - // - return $at; - } - - - //Используем приемы - public function priemsTestRazmen($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - //ставка - - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 220 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 237 - || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 286 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 287 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 288 - || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 213) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - //Приемы ухода от удара - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - //Приемы крита - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - //Приемы атаки - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - - //Приемы защиты - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { - if ($this->testPriemVarTrueZash($i, 3, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, $u1, $u2) == false) { - - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - - /* - $j = 0; - while( $j <= count( $this->stats[$this->uids[$u2]]['u_priem'] ) ) { - if( $this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4 ) { - if(file_exists('../../_incl_data/class/priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php')) { - $pr_used_this = $u2; - require('priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php'); - if( isset($fx_priem) ) { - $at = $fx_priem($id,$at,$u2,$j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - */ - - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - - $i++; - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - $i++; - } - - return $at; - } - - //Повторная проверка приемов - public function priemsRestartRazmen($id, $at) - { - if (isset($at['p'])) { - // - //Проверка - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - /* - Если возникнут проблемы с приемами, придется переписать алгоритм, сейчас он выглядит так: - Цикл 1. Проверяем пользователя - Цикл 2 внутри Цикла 1. Проверяем приемы поторые пользователь использовал - Придется сделать: - Цикл 1. Проверяем пользователя - Цикл 2 внутри Цикла 1. Проверяем приемы уворота - Цикл 3. Проверяем пользователя - Цикл 4 внутри Цикла 3. Проверяем приемы крита - и т.д. - */ - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - //Приемы ухода от удара - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - //Приемы крита - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Приемы защиты - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { - if ($this->testPriemVarTrueZash($i, 4, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, $u1, $u2) == false) { - - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Приемы атаки - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - $i++; - } - // - $at = $at['p']; - unset($at['p']); - } - return $at; - } - - //Проверка действия приема - public function testPriemVarTrueZash($i, $id, $pid, $a, $b, $u1, $u2) - { - $r = true; - //echo '['.$pid.','.$i.','.$a.','.$b.']'; - $g = [ - 45 => ['221' => true] - ]; - if (isset($g[$pid])) { - //echo 1; - if ($g[$pid][$i . $a . $b] == true) { - $r = true; - } else { - // $r = false; - } - } - return $r; - } - - //Проверка урона приемов - public $um_priem = []; - - public function testYronPriem($uid1, $uid2, $priem, $yron, $profil, $stabil, $test = false, $inlog = 0) - { - /* - profil = { - -1 - урон оружием - -2 - урон магией - 0 - неизвестно - 1-4 - профильный оружия - 5-12 - профильный магия - } - stabil - урон не подвержен мощностям и т.д - */ - //Проверка - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - - //Проверяем приемы защиты игрока $u1 на урон игрока $u2 - //Получаем приемы и смотрим когда какой действует - if (!isset($this->stats[$this->uids[$u2]]['u_priem'])) { - $eff = $this->stats[$this->uids[$u2]]['effects']; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - $this->stats[$this->uids[$u2]]['u_priem'][] = [$j, $eff[$j]['v2'], $this->prm[$eff[$j]['v2']]['act'], $eff[$j]['id'], $this->prm[$eff[$j]['v2']]['type_of'], $this->prm[$eff[$j]['v2']]['moment']]; - } - $j++; - } - unset($eff); - } - //Приемы защиты - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - //if( $test == false ) { - // - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $yron = $fx_moment($u2, $u1, $j, $yron, $profil); - unset(${'fx_moment'}); - // - } - } - $j++; - } - - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - $j++; - } - - //Прочие приемы (влияет на урон от моментальных приемов) - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][7] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this_seven = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment_seven)) { - $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment_seven'}); - } - } - $j++; - } - - //Прочие приемы - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - $j++; - } - - if ($this->stats[$this->uids[$u2]]['zaproc'] > 0) { - $yron = round($yron - $yron * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - if ($yron < 1) { - $yron = 1; - } - } - - return $yron; - } - - //Опыт + набитый урон за удар приемом\магией - public function priemYronSave($u1, $u2, $yron, $type) - { - //$type 0 - урон , 1 - хил - - $this->testUserInfoBattle($u1); - $this->testUserInfoBattle($u2); - - if (isset($this->uids[$u1])) { - - if ($this->stats[$this->uids[$u2]]['hpAll'] <= 1000) { - $adt6 = round(0.1 * (floor($yron) / $this->stats[$this->uids[$u2]]['hpAll'] * 100), 10); - } else { - $adt6 = round(0.1 * (floor($yron) / 1000 * 100), 10); - } - - if ($yron > $this->stats[$this->uids[$u2]]['hpNow']) { - $yron = $this->stats[$this->uids[$u2]]['hpNow']; - } - - if ($yron > 0) { - $this->users[$this->uids[$u1]]['battle_yron'] += $yron; - $this->users[$this->uids[$u1]]['battle_exp'] += round(1 * $this->testExp($yron, $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2)); - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic6'] += $adt6; - $this->stats[$this->uids[$u1]]['tactic6'] += $adt6; - } else { - $this->users[$this->uids[$u1]]['tactic6'] += $adt6 / 3; - $this->stats[$this->uids[$u1]]['tactic6'] += $adt6 / 3; - } - } else { - $adt6 = 0; - } - // - $this->users[$this->uids[$u2]]['last_hp'] = -$yron; - // - mysql_query('UPDATE `stats` SET - `tactic6` = `tactic6` + "' . $adt6 . '", - `battle_yron` = `battle_yron` + "' . $yron . '", - `battle_exp` = `battle_exp` + "' . round($this->testExp($yron, $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2)) . '" - WHERE `id` = "' . $u1 . '" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET - `last_hp` = "' . $this->users[$this->uids[$u2]]['last_hp'] . '" - WHERE `id` = "' . $u2 . '" LIMIT 1'); - } - $this->addNewStat( - [ - 1 => [ - 'battle' => $this->info['id'], - 'uid1' => $this->users[$this->uids[$u1]]['id'], - 'uid2' => $this->users[$this->uids[$u2]]['id'], - 'time' => time(), - 'type' => 0, - 'a' => '10000', - 'b' => 0, - 'type_a' => 1, - 'type_b' => 0, - 'ma' => 1, - 'mb' => 1, - 'yrn' => $yron, - 'yrn_krit' => 0, - 'tm1' => $this->users[$this->uids[$u1]]['team'], - 'tm2' => $this->users[$this->uids[$u2]]['team'] - ] - ] - ); - - } - - //Наносим удар между игроками - public $restart_stats_data = []; - - public function a_restart_stats($uid1, $glob) - { - if ($uid1 > 0 && isset($this->restart_stats_data[$uid1])) { - $this->stats[$this->uids[$uid1]] = $this->restart_stats_data[$uid1]; - if ($glob == 1) { - unset($this->restart_stats_data[$uid1]); - } - } - } - - public function a_save_stats($uid1) - { - if ($uid1 > 0) { - $this->restart_stats_data[$uid1] = $this->stats[$this->uids[$uid1]]; - } - } - - public function a_testing_stats($uid1, $zona) - { - //$this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid1]] , $zona ); - if ($uid1 > 0) { - $this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats($this->stats[$this->uids[$uid1]], $zona); - } - } - - public $import_atack = []; - public $contr = []; - public $import_user = 0; - - public function startAtack($id) - { - global $c, $u, $log_text, $priem; - // - $this->prlog = []; - // - $this->inport_user = 0; - // - $vrm = [ - 'uid1' => $this->atacks[$id]['uid1'], - 'uid2' => $this->atacks[$id]['uid2'] - ]; - // - if (isset($this->atacks[$id]) && $this->atacks[$id]['lock'] == 0) { - - //Прием разгадать тактику - $i = 1; - $j = 2; - $k = 0; - $unpr = ''; - while ($i <= 2) { - $untac = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "217" AND `uid` = "' . $this->atacks[$id]['uid' . $i] . '" AND `delete` = 0 LIMIT 1')); - - $agrs = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "211" AND `uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `delete` = 0 LIMIT 1')); - - if (isset($untac['id']) && !isset($agrs['id'])) { - - // AND `a`.`v2` != 235 // AND `a`.`v2` != 273 AND `a`.`v2` != 286 AND `a`.`v2` != 287 AND `a`.`v2` != 288 - - $pvr['sp'] = mysql_query('SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" - - AND `a`.`v2` != 222 - - AND `a`.`v2` != 238 - - AND `a`.`v2` != 228 - AND `a`.`v2` != 229 - - AND `a`.`v2` != 139 - AND `a`.`v2` != 188 - AND `a`.`v2` != 226 - AND `a`.`v2` != 211 - AND `a`.`v2` != 49 - AND `a`.`v2` != 233 - AND `a`.`v2` != 227 - AND `a`.`v2` != 220 - AND `a`.`v2` != 191 - AND `a`.`v2` != 332 - AND `a`.`v2` != 333 - AND `a`.`v2` != 334 - AND `a`.`v2` != 335 - AND `a`.`v2` != 236 - - AND `a`.`v2` != 201 - - AND `a`.`v2` != 261 AND `a`.`v2` != 262 AND `a`.`v2` != 206 AND `a`.`v2` != 207 AND `a`.`v2` != 208 AND `a`.`v2` != 209 - AND `a`.`v2` != 210 AND `a`.`v2` != 284 - AND `a`.`v2` != 263 AND `a`.`v2` != 258 AND `a`.`v2` != 29 AND `a`.`v2` != 30 - AND `a`.`v2` != 31 AND `a`.`v2` != 32 AND `a`.`v2` != 256 AND `a`.`v2` != 249 - AND `a`.`v2` != 248 AND `a`.`v2` != 187 AND `a`.`v2` != 245 AND `a`.`v2` != 175 - AND `a`.`v2` != 176 AND `a`.`v2` != 177 AND `a`.`v2` != 178 AND `a`.`v2` != 179 - AND `a`.`v2` != 285 AND `a`.`v2` != 36 AND `a`.`v2` != 85 AND `a`.`v2` != 86 - AND `a`.`v2` != 87 AND `a`.`v2` != 88 AND `a`.`v2` != 89 AND `a`.`v2` != 90 - AND `a`.`v2` != 269 AND `a`.`v2` != 276 AND `a`.`v2` != 277 AND `a`.`v2` != 270 - AND `a`.`v2` != 174 - AND `a`.`v2` != 324 - - AND `a`.`v2` != 217 - - AND `name` NOT LIKE "%Иммунитет%" - - LIMIT 30'); - while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { - $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1')); - if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { - $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); - } - } - // - $k++; - } - $j--; - $i++; - } - - //Восстановление манны 1% за ход - if ($this->atacks[$id]['out1'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); - } - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; - } - // - if ($this->atacks[$id]['out2'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); - } - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; - } - - //Антистаты - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3']); - } - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3']); - } - - // - $last_yrn = [ - 1 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], - 2 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] - ]; - - //Расчет количества блоков и противников - $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - - //Запускаем магию предметов - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - - // Получаем приемы игроков - $this->priemsRazmen($id, $at); - $this->priemsRazmenMoment($id, $at); - $this->priemsRazmen($id, $at); - - $at = $this->newRazmen($id); - - // Тестируем какие еще могут быть варианты при ударе - // Уворот, парирование, крит, пробить блок, блок щитом - // Блок щитом (если есть щит, конечно) - $at = $this->mf2Razmen($id, $at, $v); //крит - $at = $this->mf3Razmen($id, $at, $v); //парирование - $at = $this->mf4Razmen($id, $at, $v); //блок щитом - - $at = $this->mf1Razmen($id, $at, $v); //уворот - $at = $this->mf5Razmen($id, $at, $v); //контрудар - - $at = $this->yronRazmen($id, $at); //расчет урона - - // Проверяем приемы - //['effects'][ - // Получаем приемы игроков - $at = $this->priemsTestRazmen($id, $at); - // Собираем размен (пересчитываем и расчитываем урон и т.д) - $at = $this->priemsRestartRazmen($id, $at); //Повторная проверка приемов (если требуется) - // - - //Минусуем поглощенный урон - if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); - } - if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); - } - - // Обновляем НР и добавляем тактики - $at = $this->updateHealth($id, $at); - - // Заносим в логи + записываем статистику боя - $this->addlogRazmen($id, $at); - - //Запускаем магию предметов - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - - //Возращаем зоны блока - $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - //обновляем задержки приемов - $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); - $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); - $zd1id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems']); - $zd2id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems']); - // - $prmos = []; - // - $i5 = 0; - - while ($i5 < 51) { - if (isset($zd1[$i5]) && $zd1[$i5] > 0) { - //Если приемы не требуют ход - $zd1[$i5] -= 1; - } else { - $zd1[$i5] = 0; - } - if (isset($zd2[$i5]) && $zd2[$i5] > 0) { - $zd2[$i5] -= 1; - } else { - $zd2[$i5] = 0; - } - $i5++; - } - unset($prmos); - - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; - } - - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } - - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); - if ($this->atacks[$id]['uid1'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd1); - } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd2); - } - // - //Проверяем тактики - $i = 1; - while ($i <= 6) { - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; - } - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; - } - $i++; - } - // - //Обновляем задержки предметов - mysql_query('UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100'); - - mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2'); - - //Обновляем задержки пирожков - mysql_query('UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - mysql_query('UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - - //Тактики - mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - - //Обновляем задержки пирожков - mysql_query('UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - - - //Обновляем данные в battle_users - mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - //Восстановление манны 25% от мудрости за ход - - $last_yrn = [ - 1 => $last_yrn[1], - 2 => $last_yrn[2], - 10 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], - 20 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] - ]; - - $last_yrn[100] = floor($last_yrn[10] - $last_yrn[1]); - $last_yrn[200] = floor($last_yrn[20] - $last_yrn[2]); - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $this->save_stats($this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'])); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $this->save_stats($this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'])); - } - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - // - $this->priemsRazmenMomentEnd($id, $at); - //Минусуем заряд приема \ эффекта - $j = 1; - $jn = 1; - while ($j <= 2) { - $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; - $i = 0; - while ($i < count($eff)) { - if (isset($eff[$i])) { - if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { - $eff[$i]['hod']--; - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { - //Отнимаем ману у того кто кастовал - $priem->minMana($eff[$i]['user_use'], round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - } - } - if (strripos($eff[$i]['data'], 'minprocmanahod') == true) { - $pvr = [ - 'x1' => 0, - 'x2' => 0, - 'd' => '', - 'i' => 0, - 'uid' => $eff[$i]['uid'], - 'color' => '', - 'color2' => '', - 'effx' => '', - 'x' => $eff[$i]['name'] - ]; - $pvr['d'] = explode('|', $eff[$i]['data']); - while ($pvr['i'] < count($pvr['d'])) { - if (isset($pvr['d'][$pvr['i']])) { - $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); - if ($pvr['d1'][0] == 'minprocmanahod') { - $pvr['d1'] = explode('x', $pvr['d1'][1]); - $pvr['x1'] = $pvr['d1'][0]; - $pvr['x2'] = $pvr['d1'][1]; - } - } - $pvr['i']++; - } - - $pvr['mp'] = round($this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand($pvr['x1'], $pvr['x2'])); - $pvr['mpSee'] = 0; - $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); - $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; - $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; - - //$pvr['mp'] = $btl->hphe( $u->info['id'] , $pvr['hp'] ); - - if ($pvr['mpTr'] > 0) { - //Требуется хилл - if ($pvr['mpTr'] < $pvr['mp']) { - $pvr['mp'] = $pvr['mpTr']; - } - $pvr['mpSee'] = '+' . $pvr['mp']; - $pvr['mpNow'] += $pvr['mp']; - } - if ($pvr['mpNow'] > $pvr['mpAll']) { - $pvr['mpNow'] = $pvr['mpAll']; - } elseif ($pvr['mpNow'] < 0) { - $pvr['mpNow'] = 0; - } - if ($pvr['mpSee'] == 0) { - $pvr['mpSee'] = '--'; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - $btl->users[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - mysql_query('UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] . '" WHERE `id` = "' . $pvr['uid'] . '" LIMIT 1'); - - $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex'], null); - $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' на ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (Мана)'; - $this->priemAddLog($id, 1, 2, $pvr['uid'], 0, - '' . $pvr['x'] . '', - $pvr['text2'], - ($this->hodID + 0) - ); - //echo '[Восстанавливаем '.round(rand($pvr['x1'],$pvr['x2'])).'% маны.]'; - unset($pvr); - } - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['hod'] > 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; - mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); - } else { - //удаляем прием - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, $this->atacks[$id]['uid' . $jn]); - } - } - } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); - } else { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - if (isset($eff[$i]['priem']['minmana']) && round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { - //Отнимаем ману у того кто кастовал - $priem->minMana($eff[$i]['user_use'], round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, $this->atacks[$id]['uid' . $jn]); - } - } - } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && $c['effz'] > 0) { - - $eff[$i]['hod']--; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['hod'] > 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; - mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); - } else { - //удаляем прием - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, $this->atacks[$id]['uid' . $jn]); - } - } - } - // - } - } - $i++; - } - $j++; - } - // - // - //Проверяем - if ($c['propsk_die'] > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - $cn1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1')); - $cn2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1')); - if ($cn1[0] > 3) { - // - $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; - $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid1'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - } - if ($cn2[0] > $c['propsk_die']) { - $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; - $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid2'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - } - } - // - //Обновляем текущего противника - if ($u->info['id'] == $this->atacks[$id]['uid1']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; - } - if ($u->info['id'] == $this->atacks[$id]['uid2']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } - //Удаляем размен из базы //ТУТ возможен лаг удаления - mysql_query('DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR - ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )'); - - - unset($old_s1, $old_s2); - unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->atacks[$id]); - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1'); - unset($old_s1, $old_s2); - // - } - } - - //Сохранение данные - public function save_stats($uid) - { - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$uid]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$uid]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$uid]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$uid]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$uid]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$uid]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$uid]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$uid]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$uid]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$uid]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$uid]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$uid]]['priems_z'] . '" - - WHERE `id` = "' . $uid . '" LIMIT 1'); - } - - //Отображение НР - public function hpSee($now, $all, $type = 1) - { - $r = '[' . $now . '/' . $all . ']'; - if ($all > 10000) { - $type = 2; - } - if ($type == 1) { - - } elseif ($type == 2) { - $p1 = floor($now / $all * 100); - $r = '[' . $p1 . '/100%]'; - } - return $r; - } - - //Быстрый лог - public function addFlog($t, $u1, $u2) - { - $vLog = ''; - if (isset($this->info[$this->uids[$u1]]['id'])) { - $vLog .= 'time1=' . time() . '||s1=' . $this->users[$this->uids[$u1]]['id']['sex'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login'] . '||'; - } - if (isset($this->info[$this->uids[$u2]]['id'])) { - $vLog .= 'time2=' . time() . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||login2=' . $this->users[$this->uids[$u2]]['login'] . ''; - } - $vLog = rtrim($vLog, '||'); - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $mas1['text'] = $t; - $this->add_log($mas1); - } - - //Выводим лог боя - public function lookLog() - { - global $c, $u, $log_text; - $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - if ($hodID['id_hod'] <= 1) { - $u->info['alog'] = 0; - } - if (isset($hodID['id']) && $this->info['team_win'] != -1) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - } - if (isset($hodID['id'])) { - $hodID = $hodID['id']; - } else { - $hodID = 0; - } - - $updt = 0; - if ($u->info['design'] == 1) { - $js = ''; - $pll = 0; - if ($_POST['idlog'] < 1) { - $_POST['idlog'] = 0; - } - $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - if (isset($sp) && $this->info['team_win'] != -1) { - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - } - $jin = 0; - $forYou2 = 0; - while ($pl = mysql_fetch_array($sp)) { - if ($jin == 0) { - $u->info['alog'] = $pl['id_hod']; - } - $jin++; - if ((true == false) && ($pl['type'] == 1 || $pl['type'] == 6)) { - - } else { - $rt = $pl['text']; - //$rt = str_replace('^^^^','=',$rt); - $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $pl['text'] = $rt; - } - unset($rt); - if ($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', '"', $pl['vars']) . '");' . $js; - - } - mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - $js .= 'id_log=' . $pll . ';'; - } else { - $js = ''; - $pll = 0; - if ($_POST['idlog'] < 1) { - $_POST['idlog'] = 0; - } - $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - if (isset($sp) && $this->info['team_win'] != -1) { - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - } - $jin = 0; - $forYou2 = 0; - while ($pl = mysql_fetch_array($sp)) { - if ($jin == 0) { - $u->info['alog'] = $pl['id_hod']; - } - $jin++; - $rt = $pl['text']; - //$rt = str_replace('^^^^','=',$rt); - $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $pl['text'] = $rt; - unset($rt); - if ($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', '"', $pl['vars']) . '");' . $js; - - - } - mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - $js .= 'id_log=' . $pll . ';'; - } - - - return $js; - } - -//Новый лог Мой Лог - public function lookmLog() - { - global $c, $u, $log_text; - $js = ''; - $pll = 0; - - if ($this->info['type'] != 9) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - if ($hodID['id_hod'] <= 1) { - $u->info['mlog'] = 0; - } - if (isset($hodID['id']) && $this->info['team_win'] != -1) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - } - if (isset($hodID['id'])) { - $hodID = $hodID['id']; - } else { - $hodID = 0; - } - $tmlog = mysql_fetch_array(mysql_query('SELECT `mlog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $spm = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); - - if (isset($spm) && $this->info['team_win'] != -1) { - $spm = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); - } - - $jin = 0; - $forYou2 = 0; - - while ($plm = mysql_fetch_array($spm)) { - if ($jin == 0) { - $u->info['mlog'] = $plm['id_hod']; - } - $jin++; - $rt = $plm['text']; - $plm['vars'] = str_replace('^^^^', 'rvnO', $plm['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $plm['time']) . '', $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $plm['time']) . '', $rt); - $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $plm['time']) . '', $rt); - $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $plm['time']) . '', $rt); - $plm['text'] = $rt; - unset($rt); - if ($pll < $plm['id']) { - $pll = $plm['id']; - } - $js = 'add_mlog(' . $plm['id'] . ',' . $forYou2 . ',"' . $plm['text'] . '",' . $plm['id_hod'] . ',0,0,"' . str_replace('"', '"', $plm['vars']) . '");' . $js; - - } - $js .= 'id_mlog=' . $pll . ';'; - mysql_query('UPDATE `stats` SET `mlog`="' . $u->info['mlog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - } - return $js; - } -//====================== - - //Добавляем в лог - public function add_log($mass) - { - if ($mass['time'] != '' && $mass['text'] != '') { - //mysql_query('LOCK TABLES battle_logs WRITE'); - - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $mass['text'] . '","' . $mass['vars'] . '","' . $mass['type'] . '")'); - - //$ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.$mass['time'].'","'.$mass['battle'].'","'.$mass['id_hod'].'","'.$mass['text'].'","'.$mass['vars'].'","'.$mass['zona1'].'","'.$mass['zonb1'].'","'.$mass['zona2'].'","'.$mass['zonb2'].'","'.$mass['type'].'")'); - - //mysql_query('UNLOCK TABLES'); - if (rand(2, 10) == 10) { - $this->get_comment(); - } - } - } - - ///Комментатор - public function get_comment() - { - $boycom = ['А танцуешь ты лучше.', 'А мы что, в прятки тут играем?', 'А вы разве пингвинов никогда не видели?', 'А, ведь когда-то, вы были красивыми… А теперь? Ну и рожи! Жуть!', 'А потом еще труп пинать будут.', 'А я вчера ночью за соседями подглядывал. Они точно так же кувыркались', 'А ведь вы живых людей дубасите...', 'А вот я вчера в зоопарке был...', 'А вы в стройбате не служили?', 'А вы видели, чтобы так на улице делали!?', 'А вы знали что ёжики размножаются в интернете?', 'А жить-то, как хочется:', 'А из-за чего вы собственно дерётесь?', 'А чего ржёте, вы ещё остальных не видели', 'А что произойдёт если ты испугаешся до полусмерти дважды?!', 'Больше так не делай. Ты же не садист?', 'Без комментариев...', 'Больно ведь!', 'Быстро ты за монитор спрятался!', 'Все хотят попасть в рай, но никто не хочет умирать!', 'Вчера с такой девчонкой познакомился.', 'Всего 5 минут знакомы, а дерутся, словно супруги с 20-ти летним стажем...', 'Все. Я так больше не могу.', 'В конце концов, кто-то победит?', 'Вы чего, с дерева упали?', 'Возятся как сонные мухи... давайте я вам лучше анекдот расскажу: ...', 'Вот видишь, как полезно чистить зубы на ночь?', 'Вот вы все руками махаете, а за вами уже очередь', 'Вот попадёте вы в плен и вас там будут долго бить. Но вы ничего не расскажете... и не потому, что вы такой стойкий, просто вы ничего не знаете', 'Вы бы лучше пошли потренировались!', 'Вы все еще разминаетесь? Позовите, когда кости в муку друг другу разминать будете.', 'Вы же бойцы! Имейте совесть!', 'Гаси недоумка!', 'Да, если бы я смог это остановить, то получил бы нобелевскую премию `За мир` ', 'Да куда они бьют?!', 'Давайте быстрее! За вами уже очередь образовалась.', 'Давайте обойдемся сегодня таймаутом. А? А то мне уже кошмары скоро будут сниться.', 'Дерутся как девчонки!', 'Дети, посмотрите налево... Ой!.. Нет, туда лучше не смотреть.', 'Если так будет продолжаться, то скоро мы заснем!', 'Если бы у меня было кресло-качалка, я бы в нём качался...', 'Если вы что-то сказать хотите, то лучше молчите :)', 'Жестокость не порок.', 'Жизнь вне нашего клуба - это пустая трата кислорода!!!', 'Жми! Дави! Кусай! Царапай!', 'За такие бои надо в хаос отправлять!', 'Знаете откуда в комиссионном магазине столько вещей? Это я после ваших гулянок собираю и сдаю туда. Иногда вместе с частями тела, застрявшими в них.', 'Здесь люди так близки друг к другу. Просто иначе ударить нельзя.', 'И пролитая кровь еще пульсирует...', 'Инвалидов развелось...', 'Какой бой!!!', 'Кто!? Кто здесь?!', 'Кто вас этому научил?', 'Кузнечик, блин...', 'Куплю импортный проигрыватель грампластинок.', 'Лошадью ходи!', 'Лучше враг, чем друг - враг.', 'Ладно, вы тут пока друг друга за волосы таскайте, а я пойду, пообедаю.', 'Мне ваш балет уже надоел!', 'Может, начнется-таки настоящий бой???', 'Мысли лезут в голову изнутри, а удары снаружи.', 'Ну и где ваши коронные удары? Где живописные падения я спрашиваю!', 'Ну, нельзя же так наотмашь лупить!', 'Надо раньше было думать, теперь смертельно поздно...', 'На такое зрелище билеты продавать можно. Народ ухохочется!', 'Нет! Не надо драки! А... ладно деритесь, все равно не умеете.', 'Нет, ну должен быть повод, должен же быть повод?', 'Нет, я отказываюсь это комментировать!', 'Не таких обламывали!', 'Ну выпили вы рюмку, ну две... ну литр, ну два... так зачем же после этого драку затевать?!', 'Ну и кто за этот погром платить будет?', 'Ну и оскал у вас. Из вашей улыбки кастеты делать можно.', 'Ну, что же ты..? Не печалься. Выше голову, так по ней удобней попасть.', 'Ничего... Блок тоже удар.', 'Обернись!!!.... Поздно...', 'Ого! Научите меня так не делать.', 'Осторожно! Сделаешь дырочку, уже не запломбируешь!', 'Оно вам надо???', 'Обычное дело...там что-то отклеилось.', 'Ой, и заболтался я с вами...', 'Он же не промахнётся если ты не отойдёшь!', 'По-моему, кому-то светит инвалидность.', 'Подкинь ему грабли, на которые он еще не наступал.', 'Прав был кот Леопольд, давайте жить дружно?', 'При ударе в живот нарушается кислотно-щелочной баланс.', 'Проверь, не торчит ли у тебя нож из живота.', 'Перестаньте мне орать!', 'Подкинь ему грабли, на которые он еще не наступал.', 'Прыгают тут как блохи... Все, я пошел за дихлофосом!', 'Разбудите меня когда эта порнография закончится...', 'Ребенок сильнее ударил бы!', 'Славно вмазал!', 'Славно они веселятся', 'Смотрю вот на вас, и слезы наворачиваются.', 'Сначала учатся ходить, а потом только в драку лезут.', 'Так они друг другу что-нибудь сломают.', 'Так ты ему все кости переломаешь!', 'У меня в подъезде точно так же соседа отмудохали', 'Убогих развелось...', 'Ух ты, какой прыткий!', 'Фашист!! Надо ж, так по больному месту врезать...', 'Хватит бить его об угол моей кабинки! Мне же потом ее чинить.', 'Хулиганы, прекратите немедленно!', 'Хочешь, подскажу, куда он ударит?', 'Хорошо, что у меня ловкости больше чем у вас всех, а то б вы и меня в инвалидную коляску посадили бы.', 'Хороший бой!', 'Хороший удар!', 'Хиляк-разрядник!', 'Что ты его за волосы схватил?! Отпусти немедленно!', 'Щас я вас настигну, вот тогда мы и похохочем', 'Это была какая-то неизвестная мне техника...', 'Это же противник, а не глина! Хватит мяться!', 'Это не бой, это издевательское избиение.', 'Это поубавит спеси', 'Это и был твой план `Б` ?', 'Это была какая-то неизвестная мне техника...', 'Я же предупреждал, - будет больно.', 'Я не страдаю безумием. Я наслаждаюсь им каждую минуту :)', 'Я красивый, я сильный, я умный, я добрый. А вот вы? Вы себя-то видели?!', 'Я тоже умею драться, но не буду...', '(тревожно озираясь) я вам по секрету скажу... за вами наблюдают!', '<вырезано цензурой> после боя я этих <вырезано цензурой> обоих в <вырезано цензурой> и <вырезано цензурой>', '<вырезано цензурой> каратисты фиговы']; - //$act_com = array(); - if (rand(1, 6) == rand(1, 6)) { - $txt = '{tm1} Комментатор: ' . $boycom[rand(0, count($boycom) - 1)] . ''; - - $vLog = 'time1=' . time() . ''; - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $mas1['text'] = $txt; - $this->add_log($mas1); - - } else { - return false; - } - } - - //Расчет типа удара от оружия - public function weaponTx($item) - { - global $u; - $tp = 0; - if (!isset($item['id'])) { - $i = 1; - while ($i <= 4) { - $itm['tya' . $i] = 1; - $i++; - } - } - $itm = $u->lookStats($item['data']); - $t[0]['z'] = 0; - $t[0]['t'] = 0; - //колящий урон - $t[1]['z'] = round(0 + $itm['tya1']); - $t[1]['t'] = 1; - //рубящий урон - $t[2]['z'] = round(0 + $itm['tya2']); - $t[2]['t'] = 2; - //дробящий урон - $t[3]['z'] = round(0 + $itm['tya3']); - $t[3]['t'] = 3; - //режущий урон - $t[4]['z'] = round(0 + $itm['tya4']); - $t[4]['t'] = 4; - //урон огня - $t[5]['z'] = round(0 + $itm['tym1']); - $t[5]['t'] = 5; - //урон воздуха - $t[6]['z'] = round(0 + $itm['tym2']); - $t[6]['t'] = 6; - //урон воды - $t[7]['z'] = round(0 + $itm['tym3']); - $t[7]['t'] = 7; - //урон земли - $t[8]['z'] = round(0 + $itm['tym4']); - $t[8]['t'] = 8; - //урон света - $t[9]['z'] = round(0 + $itm['tym5']); - $t[9]['t'] = 9; - //урон тьмы - $t[10]['z'] = round(0 + $itm['tym6']); - $t[10]['t'] = 10; - //урон серой магией - $t[11]['z'] = round(0 + $itm['tym7']); - $t[11]['t'] = 11; - - $tpt = $t[0]['z']; - $tpmin = $t[0]; - $tpmax = $t[0]; - $i = 1; - - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmax = $t[$i]; - $ii = $i; - } - $i++; - } - $t[$ii]['z'] = 0; - - $tpt = $t[0]['z']; - $i = 1; - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmin = $t[$i]; - } - $i++; - } - - $setclass = rand(1, 100); - - if ($setclass > $tpmax['z']) { - $tp = $tpmin['t']; - } else { - $tp = $tpmax['t']; - } - - - return $tp; - } - - //Расчет урона от оружия - public function weaponAt($item, $st, $x) - { - $tp = 0; - $tp20 = 0; - if (isset($item['id'])) { - $itm = $this->lookStats($item['data']); - //начинаем расчет урона - $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; - $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; - if ($x != 0) { - /* - Колющий - 60% Силы и 40% Ловкости. - Рубящий - 70% Силы 20% Ловкости и 20% Интуиции. - Дробящий - 100% Силы. - Режущий - 60% Силы и 40% Интуиции. - */ - //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая - if ($x == 1) { - //колющий - $wst = $st['s2'] * 1; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 1; - } elseif ($x == 2) { - //рубящий - $wst = $st['s1'] * 0.75; - $min += 5 + (ceil($wst * 1.4) / 1) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 2; - } elseif ($x == 3) { - //дробящий - $wst = $st['s4'] * 1.5; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 3; - } elseif ($x == 4) { - //режущий - $wst = $st['s3'] * 1; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 4; - } elseif ($x >= 5 && $x <= 22) { - //урон магии и магии стихий - $wst = $st['s1'] * 0.01 + $st['s2'] * 0.01 + $st['s3'] * 0.01 + $st['s5'] * 0.06; - $min += 3 + (ceil($wst * 1.4) / 2.25) + $st['minAtack']; - $max += 5 + (ceil(0.4 + $min / 0.9) / 2.25) + $st['maxAtack']; - $tp20 = 5; - } else { - //без профильного урона - - } - - $wst = ($st['s1'] * 0.02 + $st['s2'] * 0.02 + $st['s3'] * 0.05); - $min1 = -2 + ceil($wst * 1.4) / 1.25; - $max1 = 4 + ceil(0.4 + $min1 / 0.9) / 1.25; - - $min = round(($min + $min1)); - //$max = round(($max+$max1)); - } - $tp = rand(($min + $max) / 3.5, (($min + $max) / 3.5 + (($min + $max) / 3.5) / 100 * 7)); - } - return $tp; - } - - //Расчет урона от оружия - public function weaponAt22($item, $st) - { - $tp = 0; - $tp20 = 0; - if (isset($item['id'])) { - $itm = $this->lookStats($item['data']); - //начинаем расчет урона - $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; - $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; - } - return [$min, $max]; - } - - public function domino($itm) - { - $r = 0; - //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u - //15 предметов - $clss = [ - 1 => 100, //шлем - 2 => 80, //наручи - 3 => 150, //оружие - 14 => 100, //щит - 5 => 200, //броня - 7 => 50, //пояс - 17 => 50, //ботинки - 10 => 80, //кольцо - 11 => 80, //кольцо - 12 => 80, //кольцо - 9 => 100, //амулет - 8 => 100, //серьги - 4 => 50, //рубаха - 16 => 80, //поножи - 6 => 50 //плащ - ]; - $r += $clss[$itm[0]]; - if ($itm[10] > 0) { - //екр.предмет - if ($itm[10] < 500) { - //не артефакт - $r += $clss[$itm[0]] * 4; - } else { - //артефакт - $r += $clss[$itm[0]] * 4; - } - } - return $r; - } - - public function adomino($itm) - { - $r = 0; - //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u - //15 предметов - $clss = [ - 1 => 80, //шлем - 2 => 60, //наручи - 3 => 130, //оружие - 14 => 80, //щит - 5 => 180, //броня - 7 => 30, //пояс - 17 => 30, //ботинки - 10 => 50, //кольцо - 11 => 50, //кольцо - 12 => 50, //кольцо - 9 => 80, //амулет - 8 => 80, //серьги - 4 => 30, //рубаха - 16 => 50, //поножи - 6 => 30 //плащ - ]; - $r += $clss[$itm[0]]; - return $r; - } - - public function domino_lvl($r, $lvl, $lvl_itm) - { - if ($lvl < $lvl_itm) { - $r = $r * ((50 - $lvl + $lvl_itm) / 100); - //расчет урона, если есть добавочные бонусы на подобии екр.вещей \ артефактов, либо легендарных предметов - $r = ceil($r); - } - return $r; - } - /* - public $bal = array( - //Расчет шанса победы X - Y - // танк , уворот , крит , силовик , универсал , маг - 'Танк' => array(0,50,90,00,90,50,50), // танк - 'Уворот' => array(0,00,50,90,00,50,70), // уворот - 'Крит' => array(0,90,00,50,90,30,50), // крит - 'Силовик' => array(0,00,90,00,50,50,50), // силовик - 'Универсал' => array(0,50,30,90,00,50,70), // универсал - 'Маг' => array(0,90,30,00,90,50,50) // маг - ); - */ - - public function yronLvl($lvl1, $lvl2) - { - $r = [ - 1 => [0, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 2 => [0, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 3 => [0, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 4 => [0, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 5 => [0, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 6 => [0, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 7 => [0, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200], - 8 => [0, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200, 200, 200], - 9 => [0, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200, 200, 200], - 10 => [0, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200, 200, 200], - 11 => [0, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600, 400, 200], - 12 => [0, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 800, 600], - 13 => [0, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000], - 14 => [0, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800, 1600, 1400], - 15 => [0, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200, 2000, 1800], - 16 => [0, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2400, 2200], - 17 => [0, 6600, 6400, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600], - 18 => [0, 7000, 6800, 6600, 6400, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400, 3200, 3000], - 19 => [0, 7400, 7200, 7000, 6800, 6600, 6400, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800, 3600, 3400], - 20 => [0, 7800, 7600, 7400, 7200, 7000, 6800, 6600, 6400, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200, 4000, 3800], - 21 => [0, 8200, 8000, 7800, 7600, 7400, 7200, 7000, 6800, 6600, 6400, 6200, 6000, 5800, 5600, 5400, 5200, 5000, 4800, 4600, 4400, 4200] - ]; - $r = floor($r[$lvl1][$lvl2] / 100); - $r = 0; - return $r; - } - //Гамс - //Расчет защиты - public function zago($v) - { - if ($v > 1700) { - $v = 1700; - } - $r = round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2); - return $r; - } - - //Расчет защиты (магия) - public function zmgo($v) - { - //if($v > 1000) { - // $v = 1000; - //} - $r = (1 - (pow(0.5, ($v / 250)))) * 100; - return $r; - } - - - public function yrn($st1, $st2, $u1, $u2, $level, $level2 = null, $type, $min_yron, $max_yron, $min_bron = null, $max_bron = null, $vladenie, $power_yron, $power_krit, $zashita, $ozashita = null, $proboi, $weapom_damage, $weapom_min, $weapom_max, $za_proc = null, $zm_proc = null, $zashitam = null, $ozashitam = null, $wp_type, $witm) - { - - global $u; - - //Поправка - if ($zashita < 1) { - $zashita = 1; - } - - if ($min_yron < 1) { - $min_yron = 1; - } - - if ($max_yron < 1) { - $max_yron = 1; - } - - if (!isset($type) || $type == '') { - $type = 12; - } - - //Параметры для возврвата - $r = ['min' => 0, 'max' => 0, 'type' => $type]; - $p = [ - 'Y' => 0, - 'B' => [0 => 0, 1 => 0, 'rnd' => false], - 'L' => $level, - 'W' => [$weapom_min, $weapom_max, 'rnd' => false], //минимальный урон //максимальный урон добавочный - 'U' => $vladenie, //владение оружием - 'M' => $power_yron, //мощность урона - 'K' => $power_krit, //мощность крита - 'S' => 0, //влияние статов на проф.урон - 'T' => 1, //Кф. оружия - 'iT' => 1, //Итоговый доп. Кф. оружия - /* - (S) - влияние наших статов на профильный урон - Колющий: S = Сила * 0,3 + Ловкость * 0,7 - Рубящий: S = Сила * 0,5 + Ловкость * 0,25 + Интуиция * 0,25 - Дробящий: S = Сила * 1 - Режущий: S = Сила * 0,3 + Интуиция * 0,7 - */ - ]; - - - $witmdata = $this->lookStats($witm['data']); - - //Расчет типа урона - - if ($wp_type == 18) { - $r['type'] = 1; - } elseif ($wp_type == 19) { - $r['type'] = 2; - } elseif ($wp_type == 20) { - $r['type'] = 3; - } elseif ($wp_type == 21) { - $r['type'] = 4; - } else { - $r['type'] = 0; - } - //ТУТ Профильный урон - //колющий - if ($r['type'] == 1) { - $p['S'] = $st1['s1'] * 0.25 + $st1['s2'] * 0.75; - $p['U'] = $st1['a1'] * 1.00; //кинжалы - //рубящий - } elseif ($r['type'] == 2) { - $p['S'] = $st1['s1'] * 1.20; - $p['U'] = $st1['a2'] * 1.00; //топоры - //дробящий - } elseif ($r['type'] == 3) { - $p['S'] = $st1['s1'] * 0.5 + $st1['s4'] * 1.00; - $p['U'] = $st1['a3'] * 1.00; //дубины - //режущий - } elseif ($r['type'] == 4) { - $p['S'] = $st1['s3'] * 1.00; - $p['U'] = $st1['a4'] * 1.00; //мечи - //Магиечески - } elseif ($r['type'] >= 5 && $r['type'] < 12) { - $p['S'] = $st1['s1'] * 0.5 + $st1['s2'] * 0.5; - $p['U'] = $st1['mg' . ($r['type'] - 4)] * 1.00; //магией - $p['Mage'] = true; - } else { - $p['S'] = 0; - $p['U'] = 0; // для кулака(нужно переписывать - } - - $r['bron']['rnd'] = rand($r['bron'][0], $r['bron'][1]); - - $p['B'][0] = 2 + $level + $st1['s1'] - round($st1['s1'] / 5); - $p['B'][1] = $p['B'][0] + 3; - - $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); - $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); - - //Обычный урон - //$p['Mstart'] = 0; //Начальная мощность - if ($r['type'] == 12) { - $r['min'] = ($p['B'][0] + $weapom_min) * $p['T'] * (1 + $p['M'] / 100); - $r['max'] = ($p['B'][1] + $weapom_max) * $p['T'] * (1 + $p['M'] / 100); - } else { - $r['min'] = (($p['B'][0] + $p['S'] * 2 + $weapom_min * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); - $r['max'] = (($p['B'][1] + $p['S'] * 2 + $weapom_max * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); - if ($witmdata['tr_lvl'] < $level) { - } - } - - $r['bRND'] = $p['B']['rnd']; - $r['Kmin'] = ceil((2 + (0 + $p['K'] / 100)) * $r['min']); - $r['Kmax'] = ceil((2 + (0 + $p['K'] / 100)) * $r['max']); - - //Расчет брони - //для обычного - if ($r['type'] < 5 || $r['type'] == 12) { - $r['min_abron'] = round($r['min'] * 0.05); - $r['max_abron'] = round($r['max'] * 0.05); - - if ($proboi != 0) { - $r['bron']['rndold'] = $r['bron']['rnd']; - $r['bron']['rnd'] = 0;//$r['bron'][0]; - } - - $r['Kmin'] -= $r['bron']['rnd'] * 2; //было умножить на 2 - $r['Kmax'] -= $r['bron']['rnd'] * 2; //было умножить на 2 - - $r['min'] -= $r['bron']['rnd']; //не было деления ни на чо. - $r['max'] -= $r['bron']['rnd']; //не было деления ни на чо. - - } - - //Расчет защиты (не более 80%) - if ($r['type'] < 5) { - $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); - } elseif ($r['type'] == 12) { - $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); - } else { - $r['min'] = round($r['min'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zmgo($st2['zm']))); - } - - $r['min'] = round($r['min']); - $r['max'] = round($r['max']); - $r['Kmin'] = round($r['Kmin']); - $r['Kmax'] = round($r['Kmax']); - - $min_yrn = 0; //% - - if ($u1['clone'] > 0) { - $min_yrn = 75; - } - - $r['min'] -= floor($r['min'] / 100 * $min_yrn); - $r['max'] -= floor($r['max'] / 100 * $min_yrn); - $r['Kmin'] -= floor($r['Kmin'] / 100 * ($min_yrn)); - $r['Kmax'] -= floor($r['Kmax'] / 100 * ($min_yrn)); - $r['min_'] -= floor($r['min_'] / 100 * $min_yrn); - $r['max_'] -= floor($r['max_'] / 100 * $min_yrn); - $r['Kmin_'] -= floor($r['Kmin_'] / 100 * ($min_yrn)); - $r['Kmax_'] -= floor($r['Kmax_'] / 100 * ($min_yrn)); - - $defd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1')); - if ($defd[0] > 100) { - $defd[0] = 100; - } - $defd = 0 + $defd[0]; - $powd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1')); - if ($powd[0] > 100) { - $powd[0] = 100; - } - $powd = 0 + $powd[0]; - $defd = $defd - $powd; - - $r['min'] -= floor($defd); - $r['max'] -= floor($defd); - $r['Kmin'] -= floor($defd * 2); - $r['Kmax'] -= floor($defd * 2); - $r['min_'] -= floor($defd); - $r['max_'] -= floor($defd); - $r['Kmin_'] -= floor($defd * 2); - $r['Kmax_'] -= floor($defd * 2); - - $r['min'] += $st1['maxAtack']; - $r['max'] += $st1['maxAtack']; - $r['Kmin'] += $st1['maxAtack'] * 2; - $r['Kmin'] += $st1['maxAtack'] * 2; - if ($r['min'] < 1) { - $r['min'] = 1; - } - if ($r['max'] < 1) { - $r['max'] = 1; - } - if ($r['Kmin'] < 2) { - $r['Kmin'] = 2; - } - if ($r['Kmax'] < 2) { - $r['Kmax'] = 2; - } - if ($r['Kmin_'] < 2) { - $r['Kmin_'] = 2; - } - if ($r['Kmin_'] < 2) { - $r['Kmax_'] = 2; - } - - $r['m_k'] = $r['Kmax']; - - return $r; - } - - public $pr_not_use = [], $pr_reset = [], $pr_yrn = false, $prnt = []; - //Завершение действия приема - // pl прием - // u1 инфа юзера - // t1 тип снятия - // 99 = очищение кровью - // u2 - //$this->delPriem($pd[$k2][1][$k],${'p'.$k2},1,${'p'.$k2jn}); - public $del_val = [], $re_pd = []; - - public function delPriem($pl, $u1, $t = 1, $u2 = false, $rznm = 'Очиститься Кровью', $k2nm = null, $yrn = null, $yrnt = null) - { - global $u, $priem; - if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { - if ($pl['x'] > 1) { - $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; - } - if ($pl['timeUse'] == 77) { - //завершаем прием - mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; - if (isset($u2['id'])) { - $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; - } - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - if ($t == 4) { - $mas1['id_hod']++; - $t = 2; - } - if ($t == 1) { - $mas1['id_hod']++; - if ($pl['priem']['file'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { - require('priems/' . $pl['priem']['file'] . '.php'); - } - } elseif ($pl['priem']['file3'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { - require('priems/' . $pl['priem']['file3'] . '.php'); - } - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; - $this->del_val['eff'][$pl['priem']['id']] = true; - } - } elseif ($t == 2) { - $mas1['text'] = '{tm1} У персонажа {u1} закончилось действие магии "' . $pl['name'] . '".'; - } elseif ($t == 99) { - $mas1['text'] = '{u1} Снял эфект "' . $pl['name'] . '" с помощью ' . $rznm . ' .'; - } else { - if ($t == 100) { - $mas1['id_hod']++; - } - $mas1['text'] = '{tm1} Закончилось действие эффекта "' . $pl['name'] . '" для {u1}.'; - } - if ($pl['priem']['id'] != 24) { - $this->add_log($mas1); - } - $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); - } else { - //не удалось удалить прием или эффект - } - } - - public function hodUserPriem($pl, $u1, $t = 1, $u2 = false, $rznm = 'Очиститься Кровью', $k2nm, $yrn, $yrnt) - { - global $u, $priem; - if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { - - if ($yrnt == 1) { - //обычный удар - $yrn = round($yrn); - } elseif ($yrnt == 6) { - //противник увернулся от удара - $yrn = 0; - } elseif ($yrnt == 9) { - //противник парировал удар - $yrn = 0; - } elseif ($yrnt == 3) { - //вы нанесли крит-удар - $yrn = round($yrn * 1.95) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); - } elseif ($yrnt == 4) { - //вы нанесли крит-удар через блок - $yrn = round($yrn * 0.45) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); - } else { - //неизвестный удар - $yrn = 0; - } - - if ($pl['x'] > 1) { - $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; - } - $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; - if (isset($u2['id'])) { - $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; - } - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - if ($t == 4) { - $mas1['id_hod']++; - $t = 2; - } - if ($t == 1) { - $mas1['id_hod']++; - if ($pl['priem']['file'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { - require('priems/' . $pl['priem']['file'] . '.php'); - } - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; - $this->del_val['eff'][$pl['priem']['id']] = true; - } - } - $this->add_log($mas1); - $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); - } else { - //не удалось удалить прием или эффект - } - } - - //расчет защиты - public function aPower($za, $za1, $yrn) - { - return (1 - (pow(0.5, (($za + $za1) / 250)))) * 100; - } - - //расчет брони - public function bronGo($min, $max) - { - return ceil($min, $max); - } - - //расчет брони (test) - public function bronGoTest($min, $max) - { - return ceil(round($min, $max)); - } - - //Разбираем массив со статами - public function lookStats($m) - { - $ist = []; - $di = explode('|', $m); - $i = 0; - $de = false; - while ($i < count($di)) { - $de = explode('=', $di[$i]); - $ist[$de[0]] = $de[1]; - $i++; - } - return $ist; - } - - //Расчет зависимости уворота - public function mfsgo1($a, $b) - { - return $this->form_mf($a, $b); - } - - //Расчет зависимости крита - public function mfsgo2($a, $b) - { - return $this->form_mf($a, $b); - } - - //Расчет мф. (новая) - public function form_mf($u, $au) - { - $v = $u * 5.1 - $au * 5.1; - if ($v < 0) { - $v = 0; - } - $r = (1 - (pow(99 / 100, (($v) / 100)))) * 100; - $r = round($r); - return $r; - } - - //Ступеньчатая формула (общая) для 5ых уровней. - public function msf_st2($mf, $lvl1, $lvl2) - { - $r = 0; - - if ($lvl1 > $lvl2) { - $lvl = $lvl1; - } else { - $lvl = $lvl2; - } - - /* - 1-ый: от 0 до 50 - линейное изменение шанса от 0 до 25% - 2-ой: от 51 до 151 - линейное изменение шанса от 25% до 50% - 3-ий: от 151 до 400 - линейное изменение шанса от 50% до 75% - 4-ый: свыше 400 - 75% + 0,01 * (разница К и АК - 1000) - Крит АК Разница процент - 350 50 300 85 - 350 100 250 - 350 150 200 85 - 350 175 175 - 350 200 150 - 350 225 125 - 350 250 100 65 - 50 35 - - - - */ - //турнир - if ($mf < 0) { - $mf = 0; - } - if ($lvl <= 7) { - //Баланс 0-7 уровня - if ($mf <= 100) { //0-35 - $prc = $mf; - $r = 35 / 50 * $prc; - } elseif ($mf <= 200) { //35-65 - $prc = $mf - 101; - $r = $prc / 99 * 30; - $r += 35; - } elseif ($mf <= 400) { //65-85 - $prc = $mf - 201; - $r = $prc / 199 * 20; - $r += 65; - } else { //> 75 - $r = 85 + 0.01 * abs(($mf - 1000)); - } - } else { - //Баланс остальных уровней - if ($mf <= 100) { //0-45 - $prc = $mf; - $r = 45 / 100 * $prc; - } elseif ($mf <= 300) { //45-65 - $prc = $mf - 101; - $r = $prc / 199 * 20; - $r += 45; - } elseif ($mf <= 450) { //65-75 - $prc = $mf - 301; - $r = $prc / 149 * 10; - $r += 65; - } else { //> 75 - $r = 85; - } - } - - if ($r < 0) { - $r = 0; - } - - return $r; - } - - //Ступеньчатая формула (уворот) - public function msf_st($mf, $lvl1, $lvl2) - { - $r = 0; - - if ($lvl1 > $lvl2) { - $lvl = $lvl1; - } else { - $lvl = $lvl2; - } - - /* - 1-ый: от 0 до 100 - линейное изменение шанса от 0 до 25% - 2-ой: от 101 до 400 - линейное изменение шанса от 35% до 70% - 3-ий: от 401 до 1000 - линейное изменение шанса от 70% до 85% - 4-ый: свыше 1000 - 85% + 0,01 * (разница У и АУ - 1000) - */ - /* Шпаргалочка для улучшения баланса. 150 АУ у слабых критов, 350 у топовых. - - АУ У Разница Процент - 75 750 675 85 - 100 750 650 70 - 150 750 600 - 200 750 550 55 - - 300 750 450 50 - 350 750 400 50 - - Было 700 у, поправил 750 и соотвественно разницу. Посмотрим как будут убивать У. - */ - - if ($mf < 0) { - $mf = 0; - } - //турнир - if ($lvl <= 7) { - //Баланс 0-7 уровня - if ($mf <= 200) { //0-60 - $prc = $mf; - $r = 60 / 200 * $prc; - } elseif ($mf <= 550) { //60-70 - $prc = $mf - 201; - $r = $prc / 349 * 10; - $r += 60; - } elseif ($mf <= 675) { //70-75 - $prc = $mf - 551; - $r = $prc / 124 * 5; - $r += 70; - } else { //> 85 - $r = 76; - //$r = 85 + 0.01 * abs(($mf-1000)); - } - } else { - //Баланс всех остальных уровней - /* Шпаргалочка для улучшения баланса. 150 АУ у слабых критов, 350 у топовых. - - АУ У Разница Процент - 50 950 1000 85 - 100 950 850 - 150 950 800 - 250 950 700 80 - - 300 950 650 75 - 400 950 550 70 - - - Пробуем разница 100 между У и АУ - шанс 50, остальное попасть нереально. Позже искусственно завышаем АУ танку при размене. - */ - if ($mf <= 250) { //0-35 - $prc = $mf; - $r = 35 / 250 * $prc; - } elseif ($mf <= 600) { //35-50 - $prc = $mf - 251; - $r = $prc / 349 * 15; - $r += 35; - } elseif ($mf <= 800) { //50-70 - $prc = $mf - 601; - $r = $prc / 199 * 20; - $r += 50; - } else { //> 85 - $r = 75; - //$r = 75 + 0.01 * abs(($mf-1000)); - } - } - - if ($r < 0) { - $r = 0; - } - - - return floor($r * 1.25); - } - - //Расчет МФ - public function mfs($type, $mf, $lvl1, $lvl2) - { - $rval = 0; - switch ($type) { - case 1: - - //Крит - - if ($mf['amf'] < 0) { - $mf['amf'] = 0; - } - if ($mf['mf'] < 0) { - $mf['mf'] = 0; - } - if ($mf['mf'] > $mf['smf']) { - $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); - } else { - $rval = 0; - } - - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - if ($mf['amf'] >= 1) { - if ($mf['amf'] > 100) { - $mf['amf'] = 100; - } - if (($mf['amf'] * 100) >= mt_rand(1, 10000)) { - $rval = 100; - } - } - - - break; - case 2: - - if ($mf['mf'] < 0) { - $mf['mf'] = 0; - } - if ($mf['amf'] < 0) { - $mf['amf'] = 0; - } - if ($mf['smf'] < 0) { - $mf['smf'] = 0; - } - if ($mf['asmf'] < 0) { - $mf['asmf'] = 0; - } - - if ($mf['mf'] > $mf['smf']) { - $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5 - } else { - $rval = 0; - } - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - if ($mf['asmf'] >= 0) // - { - if ($mf['asmf'] > 100) { - $mf['asmf'] = 100; - } - if ($mf['asmf'] >= rand(1, 100)) { - $rval = 0; - } - } - if ($mf['amf'] >= 0) { - if ($mf['amf'] > 100) { - $mf['amf'] = 100; - } - if ($mf['amf'] >= rand(1, 100)) { - $rval = 100; - } - } - - - break; - case 3: - //$mf[1] -= 4; - //$mf[2] -= 4; - if ($mf[1] < 1) { - $mf[1] = 1; - } - if ($mf[2] < 1) { - $mf[2] = 1; - } - - //$rval = $mf[1] - $mf[2]; //Парирование - $rval = $mf[1] - $mf[2] / 2; - if ($rval > 75) { - $rval = 75; - } - //$rval = round($rval/3); - if ($rval < 1) { - $rval = 1; - } - - break; - case 4: - $mf = round($mf * 0.6); - if ($mf < 1) { - $mf = 0; - } - if ($mf > 100) { - $mf = 100; - } - //$mf = (1-( pow(0.5, ($mf/200) ) ))*100; - $rval = min($mf, 100); //пробой брони - break; - case 5: - if ($mf < 1) { - $mf = 0; - } - $rval = min($mf, 85); //блок щитом - break; - case 6: - //Контрудар - //$mf['a'] защита - //$mf['b'] атака - if ($mf['a'] > 0) { - if ($mf['b'] > 0) { - $rval = round($mf['a'] - ($mf['b'] / 2)); - } else { - $rval = $mf['a']; - } - } else { - $rval = 0; - } - - - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - - - break; - } - if ($this->get_chanse($rval) == true) { - $rval = 1; - } else { - $rval = 0; - } - return $rval; - } - - public function dodge($a, $b) - { - $i = 0; - $arr = []; //массив для записи уникальных случайных чисел - while ($i < ($b - $a)) { - while (in_array($rand, $arr)) { - $rand = mt_rand(1, 100); - } - $arr[] = $rand; - $i++; - } - - $n = mt_rand(1, 100); - return (!!array_search($n, $arr)); - } - - public function get_chanse($percent) - { - return $this->dodge(1, min($percent, 100)); - } - - //Расчет шанса - public function get_chanse_new($persent) - { - return mt_rand(1, 100) <= $persent; - } - - //Смена противника - public function smena($uid, $auto = false, $lastdie = false) - { - global $u; - if (($auto != false || $u->info['smena'] <= 0) && $auto != true) { - return 'У вас закончились смены противника'; - } - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] < 1) { - return 'Для вас поединок закончен, ожидайте пока завершат другие...'; - } - if (!isset( - $this->uids[$uid]) || - $uid == $u->info['id'] || - $this->users[$this->uids[$uid]]['team'] == $this->users[$this->uids[$u->info['id']]]['team'] - ) { - return 'Нельзя сменить на выбранную цель []'; - } - if (isset($this->ga[$u->info['id']][$uid]) && $lastdie != true) { - return 'Нельзя сменить на выбранную цель!'; - } - if (ceil($this->stats[$this->uids[$uid]]['hpNow']) < 1) { - return 'Нельзя сменить, противник уже мертв'; - }//меняем противника - if ($auto == false) { - $u->info['smena']--; - } - $upd = mysql_query('UPDATE `stats` SET `enemy` = "' . $uid . '",`smena` = "' . $u->info['smena'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->info['enemy'] = $uid; - $this->users[$this->uids[$uid]]['smena'] = $u->info['smena']; - $this->users[$this->uids[$u->info['id']]]['enemy'] = $uid; - return 1; - } - - //авто-смена противника //ТУТ баг выбора - public function autoSmena() - { - global $u; - $ms = []; - $ms_all = []; - $ms_ansf = []; - $i = 0; - $j = 0; - $z = 0; - while ($i < count($this->users)) { - if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] > 0 && -($u->info['enemy']) != $this->users[$i]['id']) { - if (!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) { - $ms[$j] = $this->users[$i]['id']; - $j++; - - } - if (!isset($this->uids[(-($u->info['enemy']))])) { - $ms_all[] = $this->users[$i]['id']; - } - if (isset($this->ga[$this->users[$i]['id']][$u->info['id']])) { - $ms_ansf[$z] = $this->users[$i]['id']; - $z++; - } - } - $i++; - } - $msh = []; - if ($j == 0 && $z == 0) { - - $enemydie = 0; - - if (isset($this->stats[$this->uids[$u->info['enemy']]])) { - $u->info['enemy'] = 0; - $enemydie = 1; - } - - if ((!isset($this->uids[(-($u->info['enemy']))]) || $this->stats[$this->uids[(-($u->info['enemy']))]]['hpNow'] < 1) && ($u->info['enemy'] < 0 || $enemydie == 1)) { - $i = 0; - $j = 0; - while ($i < count($this->users)) { - if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] >= 1 && -($u->info['enemy']) != $this->users[$i]['id']) { - $ms[$j] = $this->users[$i]['id']; - $msh[$ms[$j]] = true; - $j++; - } - $i++; - } - } - } - - $ms = $ms[rand(0, $j - 1)]; - $ms_ansf = $ms_ansf[rand(0, $z - 1)]; - if ($z > 0) { - $this->smena($ms_ansf, true); - } elseif ($j > 0) { - if (isset($msh[$ms])) { - $this->smena($ms, true, true); - } else { - $this->smena($ms, true); - } - } else { - if ($u->info['enemy'] < 0) { - $this->smena(-($u->info['enemy']), true); - } - } - } - - //Действия бота (атака) - public function botAtack($uid, $pl, $tp) - { - $test_atack = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND (( - `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '" - ) OR ( - `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '" - )) LIMIT 1')); - - if ($tp == 1 && !isset($test_atack['id'])) { - - $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); - $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { - $a = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $b = rand(1, 5); - $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")'); - } - } elseif ($tp == 2) { - //бот отвечает на удар - $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); - $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl['uid2'] . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { - $bot = $this->users[$this->uids[$pl['uid2']]]; - $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; - $a222 = rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5); - $a = explode('_', $a222); - $i = 1; - $na['id'] = time(); - while ($i <= 5) { - if (isset($a[$i - 1])) { - $a[$i - 1] = intval(round($a[$i - 1])); - if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { - $na['a'][$i] = $a[$i - 1]; - } else { - $na['a'][$i] = 0; - } - } - $i++; - } - $na['b'] = rand(1, 5); - //Проводим удар - - $this->atacks[$pl['id']]['a2'] = $a222; - $this->atacks[$pl['id']]['b2'] = $na['b']; - $this->startAtack($pl['id']); - - } - } - - } - - //Проверяем удары, приемы, свитки, зверей - public function testActions() - { - //проверяем удары - $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id` ASC'); - $i = 0; - $botA = []; - $botR = []; - while ($pl = mysql_fetch_array($m)) { - $pluids = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl['uid1'] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl['uid2'] . '" AND `hpNow` <= 0) LIMIT 1')); - $pltest = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1')); - if (isset($pltest['id'])) { - if (isset($pluids['hpNow'])) { - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } elseif ($pl['time'] + $this->info['timeout'] > time()) { - //удар не пропущен по тайму, просто заносим данные - $this->atacks[$pl['id']] = $pl; - $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id']; - $this->ag[$pl['uid2']][$pl['uid1']] = $pl['id']; - if (isset($this->iBots[$pl['uid1']])) { - //ударил бот и нет ответа - $botA[$pl['uid1']] = $pl['id']; - } elseif (isset($this->iBots[$pl['uid2']])) { - //ударили бота и он не ответил - $botR[$pl['uid2']] = $pl['id']; - if ($this->users[$this->uids[$pl['uid2']]]['timeGo'] < time()) { - $this->botAtack($pl['uid1'], $pl, 2); - } - } - } else { - //пропуск по тайму - $pl['time'] = time(); - if ($pl['a1'] == 0 && $pl['a2'] == 0) { - //игрок 1 пропустил по тайму - $pl['out1'] = time(); - $pl['tout1'] = 1; - //игрок 2 пропустил по тайму - $pl['out2'] = time(); - $pl['tout2'] = 1; - } elseif ($pl['a1'] == 0) { - //игрок 1 пропустил по тайму - $pl['out1'] = time(); - $pl['tout1'] = 1; - } elseif ($pl['a2'] == 0) { - //игрок 2 пропустил по тайму - $pl['out2'] = time(); - $pl['tout2'] = 1; - } - //наносим удар по пропуску - if (!isset($pluids['hpNow'])) { - $this->atacks[$pl['id']] = $pl; - $this->startAtack($pl['id']); - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '"'); - } - } - } - } - //тест удара - if ($this->uAtc['id'] > 0) { - if ($this->na == 1) { - if ($pl['out1'] == 0 && $pl['out2'] == 0) { - //Может разменяться только тот кто бил - if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) { - $this->addNewAtack(); - } - } else { - $this->addNewAtack(); - } - } - } - //тест использования заклятий - - //тест использования приемов - - //тест, бот делает удары - $i = 0; - while ($i < count($this->bots)) { - $bot = $this->bots[$i]; - if (isset($bot) && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['pass'] != 'saintlucia') //Тут проверка на бота saintlucia - { - $j = 0; - while ($j < count($this->users)) { - if ($this->info['razdel'] == 0) { - $tnbot = time() + rand(1, 1); - } else { - $tnbot = time() + rand(1, 2); - } - if ($this->users[$j]['timeGo'] >= time() || $this->users[$this->uids[$bot]]['timeGo'] >= time()) { - - } elseif ($this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']) { - if (isset($this->users[$j]) && $this->stats[$j]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && !isset($this->ga[$bot][$this->users[$j]['id']]) && !isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['id'] != $bot && $this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $this->botAtack($this->users[$j]['id'], $bot, 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } elseif (isset($this->users[$i]) && $this->users[$i]['bot'] > 0 && $this->stats[$i]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$i]['id'] != $bot && $this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - if ($this->botAct($bot) == true) { - if (!isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time() && !isset($this->ag[$bot][$this->users[$i]['id']])) { - $this->botAtack($this->users[$i]['id'], $bot, 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } elseif (isset($this->ag[$bot][$this->users[$i]['id']])) { - } elseif (isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $this->botAtack($bot, $this->users[$i]['id'], 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } - } - } else { - //Удары между ботами - // - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1) { - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); - if (isset($this->ga[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // тестовый бой - $tnbot = time() - 1; - } - $this->startAtack($this->ga[$bot][$this->users[$j]['id']]); - $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } elseif (isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { - if ($this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['timeGo'] < time()) { - $this->startAtack($this->ag[$bot][$this->users[$j]['id']]); - $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // тестовый бой - $tnbot = time() - 1; - } - $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } - } - // - } - } - $j++; - } - } - $i++; - } - } - - //Действия бота - public function botAct($uid) - { - $r = false; - if ($this->users[$this->uids[$uid]]['bot'] > 0) { - if ($this->users[$this->uids[$uid]]['online'] < time() - 3) { - $r = true; - $this->users[$this->uids[$uid]]['online'] = time(); - mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . ((int)$uid) . '" LIMIT 1'); - } else { - if (rand(0, 2) == 1) { - $r = true; - } - } - } - return $r; - } - - //получаем данные о поединке - public function battleInfo($id) - { - $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); - if (isset($b['id'])) { - $this->hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $b['id'] . '" ORDER BY `id` DESC LIMIT 1')); - if (isset($this->hodID['id_hod'])) { - $this->hodID = $this->hodID['id_hod']; - } else { - $this->hodID = 0; - } - return $b; - } else { - return false; - } - } - - //наносим удар противнику - public function addAtack() - { - global $js; - if (isset($_POST['atack'], $_POST['block'])) { - $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; - $a = explode('_', $_POST['atack']); - $i = 1; - $na['id'] = time(); - while ($i <= 5) { - if (isset($a[$i - 1])) { - $a[$i - 1] = intval(round($a[$i - 1])); - if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { - $na['a'][$i] = $a[$i - 1]; - } else { - $na['a'][$i] = 0; - } - } - $i++; - } - - $na['b'] = intval(round($_POST['block'])); - if ($na['b'] < 1 || $na['b'] > 5) { - $na['b'] = 0; - } - - $this->uAtc = $na; - $js .= 'testClearZone();'; - } else { - $this->e = 'Выберите зоны удара и блока'; - } - } - - //выделяем пользователей - public function teamsTake() - { - global $u; - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - //данные о игроках в бою - $nxtlg = []; - $t = mysql_query('SELECT `u`.`room`,`u`.`no_ip`,`u`.`twink`,`u`.`stopexp`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - $i = 0; - $bi = 0; - $up = ''; - if ($this->info['start2'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start2` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - $upd = mysql_query('UPDATE `battle` SET `start2` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } else { - $this->info['start2'] = time(); - } - - } - while ($pl = mysql_fetch_array($t)) { - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$i] = $pl; - $this->uids[$pl['id']] = $i; - - if ($this->info['start2'] == 0) { - mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - $this->users[$i]['notrhod'] = -1; - } - - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - //записываем статы - $this->stats[$i] = $u->getStats($pl, 0, 0, false, $this->cached, true); - //Заносим старт - if ($this->info['start2'] == 0) { - if (!isset($ts[$this->users[$i]['team']])) { - $tsi++; - $ts[$this->users[$i]['team']] = $tsi; - } - - if ($this->users[$i]['level'] <= 7) { - $this->users[$i]['tactic7'] = floor(10 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] == 8) { - $this->users[$i]['tactic7'] = floor(20 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] == 9) { - $this->users[$i]['tactic7'] = floor(30 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] >= 10) { - $this->users[$i]['tactic7'] = floor((40 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } - - if ($this->stats[$i]['s7'] > 49) { - mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 101 AND `delete` = 0'); - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '" . $this->stats[$i]['id'] . "', 'Спасение', 'add_spasenie=1', 101, 77, 0, '" . $this->stats[$i]['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); - "); - } - - // Бафф Зверя animal_bonus - if ($this->users[$i]['animal'] > 0) { - - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if (isset($a['id'])) { - if ($a['eda'] >= 1) { - $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); - $anl = $anl['bonus']; - - $tpa = [1 => 'cat', 2 => 'owl', 3 => 'wisp', 4 => 'demon', 5 => 'dog', 6 => 'pig', 7 => 'dragon']; - $tpa2 = [1 => 'Кота', 2 => 'Совы', 3 => 'Светляка', 4 => 'Чертяки', 5 => 'Пса', 6 => 'Свина', 7 => 'Дракона']; - $tpa3 = [1 => 'Кошачья Ловкость', 2 => 'Интуиция Совы', 3 => 'Сила Стихий', 4 => 'Демоническая Сила', 5 => 'Друг', 6 => 'Полная Броня', 7 => 'Инферно']; - - mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 100 AND `delete` = 0'); - - mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $this->users[$i]['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $this->users[$i]['id'] . '")'); - - //добавление духа от дракона - if ($a['type'] == 7) { - if ($a['level'] == 10) { - $this->users[$i]['tactic7'] = floor((50 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($a['level'] == 11) { - $this->users[$i]['tactic7'] = floor((65 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($a['level'] == 12) { - $this->users[$i]['tactic7'] = floor((90 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } - } - // - $anl = $u->lookStats($anl); - - $vLog = 'time1=' . time() . '||s1=' . $this->users[$i]['sex'] . '||t1=' . $this->users[$i]['team'] . '||login1=' . $this->users[$i]['login'] . ''; - $vLog .= '||s2=1||t2=' . $this->users[$i]['team'] . '||login2=' . $a['name'] . ' (Зверь ' . $this->users[$i]['login'] . ')'; - - $mas1 = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => 1, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - - $ba = ''; - $i6 = 0; - while ($i6 < count($u->items['add'])) { - if (isset($anl['add_' . $u->items['add'][$i6]])) { - if ($anl['add_' . $u->items['add'][$i6]] > 0) { - if ($u->items['add'][$i6] == 'mib1') { - $ba .= 'Броня головы: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib2') { - $ba .= 'Броня корпуса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib3') { - $ba .= 'Броня пояса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib4') { - $ba .= 'Броня ног: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mab1' || $u->items['add'][$i6] == 'mab2' || $u->items['add'][$i6] == 'mab3' || $u->items['add'][$i6] == 'mab4') { - - } else { - $ba .= $u->is[$u->items['add'][$i6]] . ': +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } - } - } - $i6++; - } - $ba = trim($ba, ', '); - if ($ba == '') { - $ba = 'Эффект отсутсвует'; - } - - $mas1['text'] = '{tm1} {u2} очнулся от медитации, и призвал заклятье "' . $tpa3[$a['type']] . ' [' . $a['level'] . ']" на {u1}. (' . $ba . ')'; - $nxtlg[count($nxtlg)] = $mas1; - mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "' . $a['id'] . '" LIMIT 1'); - $this->get_comment(); - } - } - } - - mysql_query('UPDATE `stats` SET `last_hp` = "0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7` = "' . ($this->users[$i]['tactic7']) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - $rs[$this->users[$i]['team']] .= $u->microLogin($this->users[$i], 2) . ', '; - } - $up .= '`uid` = "' . $pl['id'] . '" OR'; - $mybu = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . mysql_real_escape_string($pl['id']) . '" LIMIT 1')); - if (!isset($mybu['id'])) { - //Пустое значение статистики для данного персонажа за текущий бой - $this->addstatuser($pl['id']); - } - $i++; - } - - $up = rtrim($up, ' OR'); - //Заносим в лог начало поединка - - if ($this->info['start1'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start1` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - $upd = mysql_query('UPDATE `battle` SET `start1` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - if ($upd) { - $i = 0; - $r = ''; - while ($i <= $tsi) { - if (isset($rs[$i]) && $rs[$i] != '') { - $r .= rtrim($rs[$i], ', ') . ' и '; - } - $i++; - } - $r = rtrim($r, ' и '); - $r = str_replace('"', '\\\\\"', $r); - $this->hodID++; - $vLog = 'time1=' . time() . '||'; - $mass = ['time' => time(), 'battle' => $this->info['id'], 'id_hod' => $this->hodID, 'text' => 'test', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; - $r = 'Часы показывали ' . date('d.m.Y H:i', $this->info['time_start']) . ', когда ' . $r . ' бросили вызов друг другу.'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $r . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - if (!$ins) { - //echo $r; - } - $this->info['start1'] = time(); - } - } - - // - - if (count($nxtlg) > 0) { - $i = 0; - while ($i < count($nxtlg)) { - $this->add_log($nxtlg[$i]); - $i++; - } - } - - // - } - } - } - - //Возращаем зоны блока по умолчанию - public function restZonb($uid1, $uid2) - { - if ($this->stnZbVs[$uid1] > 0) { - $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid1]; - } - if ($this->stnZbVs[$uid2] > 0) { - $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid2]; - } - } - - //проверка блока (Визуальная) - public function testZonbVis() - { - global $u; - if ($this->stnZbVs == 0) { - $zb = $this->stats[$this->uids[$u->info['id']]]['zonb']; - $this->stnZbVs = $zb; - } else { - $zb = $this->stnZb; - } - $eu = $this->users[$this->uids[$u->info['id']]]['enemy']; - if ($zb > 3) { - $zb = 3; - } - if ($eu != '' && $eu != 0) { - if ($this->stats[$this->uids[$eu]]['weapon1'] == 1 || $this->stats[$this->uids[$eu]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$u->info['id']]]['weapon1'] != 1 && $this->stats[$this->uids[$u->info['id']]]['weapon2'] != 1) { - $zb -= 1; - } - } - } - if ($zb < 1) { - $zb = 1; - } - return $zb; - } - - //проверка блока - public function testZonb($uid, $uid2) - { - global $u; - $zba = [1 => 0, 2 => 0]; - - $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; - $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; - - if ($this->stnZb[$uid] == 0) { - $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; - $this->stnZb[$uid] = $zba[1]; - } else { - $zba[1] = $this->stnZb[$uid]; - } - - if ($this->stnZb[$uid2] == 0) { - $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; - $this->stnZb[$uid] = $zba[2]; - } else { - $zba[2] = $this->stnZb[$uid2]; - } - - if ($zba[1] > 3) { - $zba[1] = 3; - } - if ($zba[2] > 3) { - $zba[2] = 3; - } - - //Блоки игрока 1 - if ($this->stats[$this->uids[$uid2]]['weapon1'] == 1 || $this->stats[$this->uids[$uid2]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$uid]]['weapon1'] != 1 && $this->stats[$this->uids[$uid]]['weapon2'] != 1) { - $zba[1] -= 1; - } - } - - //Блоки игрока 2 - if ($this->stats[$this->uids[$uid]]['weapon1'] == 1 || $this->stats[$this->uids[$uid]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$uid2]]['weapon1'] != 1 && $this->stats[$this->uids[$uid2]]['weapon2'] != 1) { - $zba[2] -= 1; - } - } - - if ($zba[1] < 1) { - $zba[1] = 1; - } - if ($zba[2] < 1) { - $zba[2] = 1; - } - - $this->stats[$this->uids[$uid]]['zonb'] = $zba[1]; - $this->stats[$this->uids[$uid2]]['zonb'] = $zba[2]; - if ($this->stats[$this->uids[$uid]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid]]['zonb'] < $this->stats[$this->uids[$uid]]['min_zonb']) { - $this->stats[$this->uids[$uid]]['zonb'] = $this->stats[$this->uids[$uid]]['min_zonb']; - } - if ($this->stats[$this->uids[$uid2]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid2]]['zonb'] < $this->stats[$this->uids[$uid2]]['min_zonb']) { - $this->stats[$this->uids[$uid2]]['zonb'] = $this->stats[$this->uids[$uid2]]['min_zonb']; - } - } - - //генерируем команды - public function genTeams($you) - { - global $u; - $ret = ''; - $teams = []; - //выделяем пользователей - $i = 0; - $j = 1; - $tms = []; - //if( $this->users[$this->uids[$you]]['team'] > 0 && $this->stats[$this->uids[$you]]['hpNow'] > 0 ) { - $teams[$this->users[$this->uids[$you]]['team']] = ''; - $tms[0] = $this->users[$this->uids[$you]]['team']; - //} - while ($i < count($this->uids)) { - if ($this->stats[$i]['hpNow'] > 0) { - if (!isset($teams[$this->users[$i]['team']])) { - $tms[$j] = $this->users[$i]['team']; - $j++; - } - if ($this->stats[$i]['hpNow'] < 0) { - $this->stats[$i]['hpNow'] = 0; - } - if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) { - $this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll']; - } - $a1ms = ''; - if (isset($this->ga[$this->users[$i]['id']][$you]) && $this->ga[$this->users[$i]['id']][$you] != false) { - $a1mc = ''; - $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1')); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { - $a1mc = 'color:red;'; - } - $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"'; - } elseif (isset($this->ag[$this->users[$i]['id']][$you]) && $this->ag[$this->users[$i]['id']][$you] != false) { - $a1mc = ''; - $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1')); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { - $a1mc = 'color:green;'; - } - $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"'; - } - if ($this->users[$i]['login2'] == '') { - $this->users[$i]['login2'] = $this->users[$i]['login']; - } - if ($this->users[$i]['align'] == 9) { - $this->stats[$i]['hpNow'] = $this->stats[$i]['hpNow'] / ($this->stats[$i]['hpAll'] / 100); - $this->stats[$i]['hpAll'] = '100%'; - } - $ldr = ''; - if ($this->users[$i]['lider'] == $this->info['id']) { - $ldr = 'users[$i]['team'] . '.gif \>'; - } - $teams[$this->users[$i]['team']] .= ', ' . $ldr . 'users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']'; - } - $i++; - } - - //генерируем команды - $i = 0; - while ($i < count($tms)) { - $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', '); - if ($teams[$tms[$i]] != '') { - $teams[$tms[$i]] = ' ' . $teams[$tms[$i]]; - $ret .= $teams[$tms[$i]]; - if (count($tms) > $i + 1) { - $ret .= '   против   '; - } - } - $i++; - } - return 'genteam("' . $ret . '");'; - } - - - public function addTravm($uid, $type, $lvl) - { - global $u; - $t = $type; - if ($t == 1) { - $name = 'Легкая травма'; - $stat = rand(1, 3); // пока без духовности - $timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов - $data = 'add_s' . $stat . '=-' . $lvl; - $img = 'eff_travma1.gif'; - $v1 = 1; - //echo ''.$name.''; - } elseif ($t == 2) { - $name = 'Средняя травма'; - $stat = rand(1, 3); // пока без духовности - $timeEnd = rand(3, 5);// время травмы от 6 до 12 часов - $data = 'add_s' . $stat . '=-' . ($lvl * 2); - $v1 = 2; - $img = 'eff_travma2.gif'; - } elseif ($t == 3) { - $name = 'Тяжелая травма'; - $stat = rand(1, 3); // пока без духовности - $timeEnd = rand(5, 7);// время травмы от 12 до 6 часов - $data = 'add_s' . $stat . '=-' . ($lvl * 3); - $v1 = 3; - $img = 'eff_travma3.gif'; - } elseif ($t == 4) { - $name = 'Неизлечимая травма'; - $stat = rand(1, 3); // пока без духовности - $timeEnd = 24;// время травмы от 24 часа - $data = 'add_s' . $stat . '=-' . ($lvl * 50); - $v1 = 4; - $img = 'eff_travma4.gif'; - } - $timeEnd = $timeEnd * 3600; - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $v1 . '")'); - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")'); - } - - public function testUserInfoBattle($uid) - { - global $u; - if (!isset($this->uids[$uid])) { - //Заносим данные об игроке снова (видимо он погиб и его стерло с инфо) - if (!isset($this->uids[$uid])) { - $this->uids[$uid] = count($this->users); - } - $this->users[$this->uids[$uid]] = mysql_fetch_array(mysql_query('SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $uid . '" LIMIT 1')); - $this->stats[$this->uids[$uid]] = $u->getStats($this->users[$this->uids[$uid]], 0, 0, false, false, true); - } - } - - ///----Спасение функция - public function spaCheck($u1) - { - if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { - mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"'); - if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) // - { - //Свиток спасения - // - if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) { - //Даем призрачку - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', 'Призрачная защита', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5); - - } elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) { - //Абсолютная защита - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', 'Абсолютная защита', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75); - } elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) { - //Абсолютная защита x2 - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', 'Защита Мироздателя', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); - } - - if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { - $this->stats[$this->uids[$u1]]['hpNow'] = 1; - } - if ($this->stats[$this->uids[$u1]]['mpNow'] < 1) { - $this->stats[$this->uids[$u1]]['mpNow'] = 1; - } - if ($this->stats[$this->uids[$u1]]['hpNow'] > $this->stats[$this->uids[$u1]]['hpAll']) { - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); - } - if ($this->stats[$this->uids[$u1]]['mpNow'] > $this->stats[$this->uids[$u1]]['mpAll']) { - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); - } - - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u1 . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$this->uids[$u1]]['hpNow'] . '",`mpNow` = "' . $this->stats[$this->uids[$u1]]['mpNow'] . '", `tactic7` = `tactic7` - 25 WHERE `id` = "' . $u1 . '" LIMIT 1'); - $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' убит...' . $this->stats[$this->uids[$u1]]['login'] . ' был спасен. '; - $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, - ' ', - $mas['text'], - ($this->hodID + 0) - ); - // - - - } else { - - if (isset($this->stats[$this->uids[$u1]]['login'])) { - mysql_query('UPDATE `stats` SET `hpNow` = "0",`mpNow` = "0" WHERE `id` = "' . $u1 . '" LIMIT 1'); - $this->stats[$this->uids[$u1]]['hpNow'] = 0; - $this->users[$this->uids[$u1]]['hpNow'] = 0; - $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' погиб.'; - $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, - ' ', - $mas['text'], - ($this->hodID + 1) - //Удаляем размен из базы //ТУТ возможен лаг удаления - ); - mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "-' . $this->stats[$this->uids[$u1]]['id'] . '"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->stats[$this->uids[$u1]]['id'] . '" AND `v1` = "priem" AND `delete` =0'); - // v1 priem - } - } - } - } - //Конец спасения - -} - -$btl = new battleClass; \ No newline at end of file diff --git a/_incl_data/class/__battle.php-cleared b/_incl_data/class/__battle.php-cleared new file mode 100644 index 00000000..49474796 --- /dev/null +++ b/_incl_data/class/__battle.php-cleared @@ -0,0 +1,8360 @@ +db = $db; + } + + /** Должно бы уехать в Priems. + * @param $u1 + * @param $u2 + * @param $type + * @return string + */ + public function maginfoattack($u1, $u2, $type) + { + /* + 1 - огонь, + 2 - воздух, + 3 - вода, + 4 - земля + */ + $v_l = str_replace(' ', ' ', $this->users[$this->uids[$u1]]['login']); + + //защита цели + $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type]; + //подавление защиты от магии + $v_p = round(($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4); + //мощность мага + $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type]; + + return + ' magelogin=' . $v_l . + ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); '; + } + + /** Узнаём тип поединка в зависимоти от $x + * @param $x + * @return array + */ + private function typeBattle($x) + { + $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок']; + if ($x >= 50000 && $x < 100000) { + $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; + } elseif ($x < 500000) { + $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; + } elseif ($x < 1000000) { + $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; + } elseif ($x < 2500000) { + $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; + } elseif ($x >= 5000000) { + $r = [150, 150, 'Судный День', 'Судный День']; + } + return $r; + } + + ## ВСЕ ТРИ ПЕРЕМЕННЫЕ - КОНСТАНТЫ ДЛЯ PRIEMS (номерные) + public $mncolor = [ + 1 => '006699', + 2 => '006699', + 3 => '006699', + 4 => '006699', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + public $mcolor = [ + 1 => 'A00000', + 2 => '008080', + 3 => '0000FF', + 4 => 'A52A2A', + 5 => '006699', + 6 => '006699', + 7 => '006699', + ]; //не крит + public $mname = [ + 'огонь' => 1, + 'воздух' => 2, + 'вода' => 3, + 'земля' => 4, + 'свет' => 5, + 'тьма' => 6, + 'серая' => 7, + ]; + + /** Перечень приёмов (?) + *
    act: + *
    1 - когда персонаж получает повреждение + *
    2 - когда персонаж наносит удар + *
    type_of: + *
    1 - уворот + *
    2 - крит + *
    3 - атака + *
    4 - защита + *
    5 - прочее + * @var array[] + */ + private $prm = [ + 1 => ['name' => 'Прикрыться', 'act' => 1, 'type_of' => 5], + 2 => ['name' => 'Вломить', 'act' => 2, 'type_of' => 3], + 4 => ['name' => 'Сильный удар', 'act' => 2, 'type_of' => 3], + 7 => ['name' => 'Активная защита', 'act' => 1, 'type_of' => 4], + + 290 => ['name' => 'Вытягивание души', 'act' => 1, 'type_of' => 4], + + //Излом хаоса + //291 => array( 'name' => 'Грация Боя', 'act' => 2, 'type_of' => 4 ), + + //Канализация + 294 => ['name' => 'Зловонная Вода', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 295 => ['name' => 'Проткнуть', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 296 => ['name' => 'Гнилая Кровь', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 297 => ['name' => 'Собраться', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 298 => ['name' => 'Приказ Слабости', 'act' => 2, 'type_of' => 3], + + 141 => ['name' => 'Призрачная защита', 'act' => 2, 'type_of' => 4], + 147 => ['name' => 'Призрачный кинжал', 'act' => 2, 'type_of' => 4], + 148 => ['name' => 'Призрачный топор', 'act' => 2, 'type_of' => 4], + 149 => ['name' => 'Призрачный удар', 'act' => 2, 'type_of' => 4], + 150 => ['name' => 'Призрачное лезвие', 'act' => 2, 'type_of' => 4], + + 142 => ['name' => 'Призрачный огонь', 'act' => 2, 'type_of' => 4], + 144 => ['name' => 'Призрачный воздух', 'act' => 2, 'type_of' => 4], + 146 => ['name' => 'Призрачная земля', 'act' => 2, 'type_of' => 4], + 145 => ['name' => 'Призрачная вода', 'act' => 2, 'type_of' => 4], + + 8 => ['name' => 'Танец ветра', 'act' => 1, 'type_of' => 1], + 9 => ['name' => 'Дикая удача', 'act' => 2, 'type_of' => 3], + 10 => ['name' => 'Предвидение', 'act' => 1, 'type_of' => 1], + 11 => ['name' => 'Удачный удар', 'act' => 2, 'type_of' => 3], + + 45 => ['name' => 'Полная защита', 'act' => 1, 'type_of' => 4], + + 47 => ['name' => 'Слепая удача', 'act' => 2, 'type_of' => 2], + 48 => ['name' => 'Танец лезвий', 'act' => 1, 'type_of' => 1], + 49 => ['name' => 'Второе дыхание', 'act' => 1, 'type_of' => 1], + 138 => ['name' => 'Сокрушающий удар', 'act' => 2, 'type_of' => 3], + 140 => ['name' => 'Абсолютная защита', 'act' => 1, 'type_of' => 4], + 193 => ['name' => 'Усиленные удары', 'act' => 2, 'type_of' => 3], + 204 => ['name' => 'Обречённость', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 211 => ['name' => 'Агрессивная защита', 'act' => 1, 'type_of' => 4], + 213 => ['name' => 'Коварный Уход', 'act' => 1, 'type_of' => 4], + 215 => ['name' => 'Скрытая ловкость', 'act' => 1, 'type_of' => 1], + 216 => ['name' => 'Скрытая сила', 'act' => 2, 'type_of' => 2], + 217 => ['name' => 'Разгадать тактику', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 219 => ['name' => 'Точный удар', 'act' => 2, 'type_of' => 3], + 220 => ['name' => 'Ставка на опережение', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 222 => ['name' => 'Последний удар', 'act' => 2, 'type_of' => 3], + 225 => ['name' => 'Магическая защита', 'act' => 1, 'type_of' => 4], + 226 => ['name' => 'Возмездие', 'act' => 1, 'type_of' => 4], + 231 => ['name' => 'Глухая защита', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 234 => ['name' => 'Осторожность', 'act' => 2, 'type_of' => 4], + 235 => ['name' => 'Шокирующий удар', 'act' => 2, 'type_of' => 3], + 342 => ['name' => 'Круговая Защита', 'act' => 0, 'type_of' => 0], + 343 => ['name' => 'Натиск', 'act' => 0, 'type_of' => 0], + + 237 => ['name' => 'Разведка боем', 'act' => 2, 'type_of' => 3 /*, 'moment' => 3*/], + + 239 => ['name' => 'Поступь смерти', 'act' => 2, 'type_of' => 3], + 240 => ['name' => 'Хлебнуть крови', 'act' => 2, 'type_of' => 5], + + //Оледенение + 21 => ['name' => 'Оледенение [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 73 => ['name' => 'Оледенение [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 74 => ['name' => 'Оледенение [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 75 => ['name' => 'Оледенение [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 76 => ['name' => 'Оледенение [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 77 => ['name' => 'Оледенение [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 78 => ['name' => 'Оледенение [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 79 => ['name' => 'Оледенение [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Отравление + 22 => ['name' => 'Отравление [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 80 => ['name' => 'Отравление [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 81 => ['name' => 'Отравление [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 82 => ['name' => 'Отравление [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 83 => ['name' => 'Отравление [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 84 => ['name' => 'Отравление [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Регенерация + 36 => ['name' => 'Регенерация [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 85 => ['name' => 'Регенерация [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 86 => ['name' => 'Регенерация [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 87 => ['name' => 'Регенерация [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 88 => ['name' => 'Регенерация [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 89 => ['name' => 'Регенерация [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 90 => ['name' => 'Регенерация [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Ядовитое облако + 23 => ['name' => 'Ядовитое Облако [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 70 => ['name' => 'Ядовитое Облако [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 71 => ['name' => 'Ядовитое Облако [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 72 => ['name' => 'Ядовитое Облако [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Иней + 269 => ['name' => 'Иней [8]', 'act' => 2, 'type_of' => 9], + 276 => ['name' => 'Иней [9]', 'act' => 2, 'type_of' => 9], + 277 => ['name' => 'Иней [10]', 'act' => 2, 'type_of' => 9], + + 270 => ['name' => 'Духи Льда', 'act' => 2, 'type_of' => 5, 'type_sec' => 5], + 280 => ['name' => 'Хватка Льда', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 281 => ['name' => 'Жертва Воде', 'act' => 2, 'type_of' => 5], + 282 => ['name' => 'Ледяное Спасение', 'act' => 2, 'type_of' => 5], + + //Медитация + 24 => ['name' => 'Медитация', 'act' => 2, 'type_of' => 0, 'moment' => 3], + + //Магический барьер + 210 => ['name' => 'Магический Барьер [4]', 'act' => 2, 'type_of' => 8], + 209 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8], + 208 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8], + 207 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8], + 206 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8], + 284 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8], + + //Силовое поле + 175 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8], + 176 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8], + 177 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8], + 178 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8], + 179 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8], + + //Метеорит + 42 => ['name' => 'Метеорит [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 121 => ['name' => 'Метеорит [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 122 => ['name' => 'Метеорит [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 123 => ['name' => 'Метеорит [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 124 => ['name' => 'Метеорит [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 125 => ['name' => 'Метеорит [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + 249 => ['name' => 'Каменный Щит', 'act' => 2, 'type_of' => 4], + 248 => ['name' => 'Песчаный Щит', 'act' => 2, 'type_of' => 4], + 251 => ['name' => 'Заземление: Плюс', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 252 => ['name' => 'Заземление: Минус', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Туманный образ + 273 => ['name' => 'Туманный Образ [10]', 'act' => 1, 'type_of' => 4], + 286 => ['name' => 'Туманный Образ [9]', 'act' => 1, 'type_of' => 4], + 287 => ['name' => 'Туманный Образ [8]', 'act' => 1, 'type_of' => 4], + 288 => ['name' => 'Туманный Образ [7]', 'act' => 1, 'type_of' => 4], + + 255 => ['name' => 'Воздушный Щит', 'act' => 2, 'type_of' => 8], + + ////Пещерные приемы + 337 => ['name' => 'Выпить Душу', 'act' => 2, 'type_of' => 5], + + //Пожирающее Пламя + 33 => ['name' => 'Пожирающее Пламя [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 56 => ['name' => 'Пожирающее Пламя [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 57 => ['name' => 'Пожирающее Пламя [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 58 => ['name' => 'Пожирающее Пламя [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 59 => ['name' => 'Пожирающее Пламя [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 60 => ['name' => 'Пожирающее Пламя [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + + //Огненный Щит + 245 => ['name' => 'Огненный Щит', 'act' => 2, 'type_of' => 9], + + ////Эффекты + 327 => ['name' => 'Живая Вода', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 328 => ['name' => 'Сушеный Мухомор', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 329 => ['name' => 'Мешочек Пыли', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 330 => ['name' => 'Отвар когтей ПГ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 331 => ['name' => 'Отвар Василиска', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 332 => ['name' => 'Точильный Камень', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 333 => ['name' => 'Волшебный Эликсир', 'act' => 2, 'type_of' => 0, 'moment' => 3], + 334 => ['name' => 'Цепь Защитника', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 335 => ['name' => 'Эликсир Безумного Критовика', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3,], + + //1 сентября, квест + 299 => ['name' => 'Ядовитые язвы', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 300 => ['name' => 'Элементарный заряд', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 301 => ['name' => 'Темное ранение', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 302 => ['name' => 'Подлечиться', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 303 => ['name' => 'Шкура поглощения', 'act' => 2, 'type_of' => 4], + 304 => ['name' => 'Особенное проклятье!', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + 305 => ['name' => 'Кровожадность', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], + ]; + + /** Сохраняем лог в архив + * @return void + */ + private function saveLogs() + { + mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` <= ' . $this->hodID); + mysql_query('DELETE FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . 'all'); + mysql_query('DELETE FROM `battle_stat` WHERE `battle` < ' . ($this->info['id'] - 100)); + mysql_query('DELETE FROM `battle_actions` WHERE `btl` = ' . $this->info['id']); + } + + /** Кандидат на перенос в Priems + * @param $uid + * @param $hp + * @param $false_t7 + * @return false|float + */ + public function hphe($uid, $hp, $false_t7 = false) + { + if (!isset($this->stats[$this->uids[$uid]])) { + echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!'; + } else { + $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']); + $hpall = $this->stats[$this->uids[$uid]]['hpAll']; + if ($hp > 0) { + //Хиляем + if ($hpnow + $hp > $hpall) { + $hpli = $hpnow + $hp - $hpall; + $hp -= $hpli; + } + if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) { + $hp = 0; + } else { + $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']); + } + //Отнимаем тактику + if (!$false_t7) { + if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) { + $hp = 0; + $this->users[$this->uids[$uid]]['tactic7'] = 0; + $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; + } else { + $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2); + if ($gdhh == 0) { + $gdhh = 0.01; + } + + $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100); + + $this->users[$this->uids[$uid]]['tactic7'] = round(($this->users[$this->uids[$uid]]['tactic7'] - $gdhh), + 2); + if ($this->users[$this->uids[$uid]]['tactic7'] < 0) { + $this->users[$this->uids[$uid]]['tactic7'] = 0; + } + $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; + if ($gdhd < 100) { + $hp = floor($hp / 100 * $gdhd); + } + } + } + } elseif ($hp < 0) { + //Отнимаемф + if ($hpnow + $hp < 0) { + $hpli = $hpnow + $hp; + $hp += -($hpli); + } + } + + if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) { + $hp = 0; + } + + $this->stats[$this->uids[$uid]]['last_hp'] = -$hp; + mysql_query('UPDATE `stats` SET + `last_hp` = ' . $this->users[$this->uids[$uid]]['last_hp'] . ', + `tactic7` = ' . $this->users[$this->uids[$uid]]['tactic7'] . ' + WHERE `id` = ' . $uid); + } + + return floor($hp); + } + + public function deleffm($pid, $uid, $id) + { + if ($id > 0) { + if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = ' . $id . ' AND `v1` = "priem" AND `v2` != 0')) { + echo '[*Ошибка удаления прием[' . $id . ',' . $pid . ',' . $uid . ']]'; + } + } else { + mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $uid . ' AND `v1` = "priem" AND `v2` = ' . $pid); + } + } + + /** возможность использовать удар + * @var int + */ + private $na = 1; + + /** % опыта в бою + * @var int + */ + private $expCoef = 0; + + /** Добавочный опыт в боях + * @var int + */ + private $aBexp = 0; + + /** Список uid кто нанес удар и по кому + * $ga[ {id кого ударили} ][ {id кто ударил} ] + * @var array + */ + private $ag = []; + + /** ID ботов + * @var array + */ + private $bots = []; + + /** i бота ??? + * @var array + */ + private $iBots = []; + + private $stnZbVs = 0; + private $stnZb = []; + + /** Если игрок нанес удар (?) [константа?] + * @var array + */ + private $uAtc = [ + 'id' => 0, + 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], + 'b' => 0, + ]; + + /** Чем лупили + * @var string[][] + */ + private $lg_itm = [ + 0 => ['грудью', 'ребром руки', 'лбом', 'кулаком', 'ногой', 'левой ногой', 'правой ногой', 'коленом'], + 1 => ['ножом', 'тыльной стороной лезвия ножа', 'рукоятью ножа', 'лезвием ножа'], + 2 => ['сучковатой палкой', 'поленом', 'тяжелой дубиной', 'дубиной', 'рукоятью молота'], + 3 => ['секирой', 'топором', 'лезвием секиры', 'алебардой', 'тяжелым держаком', 'длинной секирой'], + 4 => ['ножнами', 'гардой', 'мечом', 'лезвием меча', 'рукоятью меча', 'тупым лезвием', 'острой стороной меча', 'огромным мечом',], + 5 => ['сучковатой палкой', 'посохом', 'тяжелой тростью', 'корявым посохом', 'основанием посоха'], + 22 => ['костылем'], + ]; + + /** Куда лупили + * @var string[][] + */ + private $lg_zon = [ + 1 => ['в нос', 'в глаз', 'в челюсть', 'по переносице', 'в кадык', 'по затылку', 'в правый глаз', 'в левый глаз', 'в скулу',], + 2 => ['в грудь', 'в корпус', 'в солнечное сплетение', 'в сердце', 'в область лопаток'], + 3 => ['в бок', 'по желудку', 'по левой руке', 'по правой руке'], + 4 => ['по <вырезано цензурой>', 'в пах', 'в промежность', 'по левой ягодице', 'по правой ягодице'], + 5 => ['по ногам', 'в область правой пятки', 'в область левой пятки', 'по коленной чашечке', 'по икрам'], + ]; + + /** Ошибка (текст) + * @var + */ + public $e; + + /**Кэширование данных + * @var bool + */ + public $cached = false; + + /** Отображаем главное окно: + *
    1 - можно бить, + *
    2 - ожидаем ход противника, + *
    3 - Проиграли. Ожидаем завершения поединка + * @var int + */ + public $mainStatus = 1; + + /** Информация о поединке + * @var array + */ + public $info = []; + + /** Информация о пользователях в этом бою + * @var array + */ + public $users = []; + + /** Информация о статах пользователей в этом бою + * @var array + */ + public $stats = []; + + /** Список пользователей и их id в stats или users. + *
    Пример id пользователя = 555 , то $uids[555] выдаст его порядковый номер в массиве users \ stats + * @var array + */ + public $uids = []; + + /** Список ударов в этом бою (действующих) + * @var array + */ + public $atacks = []; + + /** Список uid кто нанес удар и по кому + *
    $ga[ {id кто ударил} ][ {id кого ударил} ] + * @var array + */ + public $ga = []; + public $hodID = 0; + + public $is = []; + public $items = []; + + private $uclearc = []; + private $ucleari = []; + private $user = []; + /** + * @param $uid + * @return void + */ + private function clear_cache($uid) + { + if ($uid > 0 && !isset($this->uclearc[$uid])) { + $this->uclearc[$uid] = true; + $this->ucleari[] = $uid; + } + } + + /** + * @return void + */ + public function clear_cache_start() + { + $q = 'delete from battle_cache where uid in (' . implode(', ', $this->ucleari) . ')'; + mysql_query($q); + } + + // + + /** Проверка урон приемов над защитными. Перенести в Priems. + *
    Логика работы ускользает от понимания. + * @param $pid + * @param $u1 + * @param $u2 + * @param $hp + * @return mixed + */ + public function testYronPriemAttack($pid, $u1, $u2, $hp) + { + //Игрок 1 бьет по Игроку 2 при помощи приема № pid на hp ед. здоровья + /* Полная защита */ + //Получаем приемы и смотрим когда какой действует + + foreach ($this->stats[$this->uids[$u2]]['effects'] as $effect) { + if ( + isset($effect) && + $effect['id_eff'] == 22 && + $effect['v1'] == 'priem' && + in_array($effect['v2'], [45, 140, 211]) + ) { + //Приемы от которых урон = 1 , то есть выдаем 0 + $hp['y'] = -1; + $hp['r'] = 1; + $hp['k'] = 2; + $hp['m_y'] = 1; + $hp['m_k'] = 2; + } + } + return $hp; + } + + /** Расчет опыта + * @param $y + * @param $s1 + * @param $s2 + * @param $id1 + * @param $id2 + * @return float|int + */ + private function testExp($y, $s1, $s2, $id1, $id2) + { + global $c; + //ТУТ таблица умножения оыта + $oplevel = [ // Максимум для каждого уровня. + 0 => 1, + 1 => 1, + 2 => 1, + 3 => 1, + 4 => 2, + 5 => 2, + 6 => 2, + 7 => 2, + 8 => 3, + 9 => 4, + 10 => 5, + 11 => 6, + 12 => 7, + 13 => 50, + 14 => 75, + ]; + + if ($y < 0) { + $y = 0; + } + if ($s2['hpNow'] < 0) { + $y = 0; + } + if ($s2['hpNow'] < $y) { + $y = $s2['hpNow']; + } + if ($y < 0) { + $y = 0; + } + $addExp = (int)($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]); + if ($s2['hpAll'] - $y <= 0) { + $addExp = 100; + } + + if ($addExp < 0) { + $addExp = 0; + } + if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') { + if ($this->info['razdel'] != 5 && $c['exp_limit_many']) { + $texp = mysql_fetch_array(mysql_query('SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = ' . $id1 . ' AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = ' . $id2 . ' AND `b`.`team` != `a`.`team` AND `b`.`time` > ' . (time() - 86400) . ' ) LIMIT 1')); + $texp = $texp[0]; + // + if ($texp > 5) { + $addExp = $addExp * 0.00; + } elseif ($texp > 4) { + $addExp = $addExp * 0.50; + } elseif ($texp > 3) { + $addExp = $addExp * 0.75; + } elseif ($texp > 2) { + $addExp = $addExp * 1.00; + } elseif ($texp > 1) { + $addExp = $addExp * 1.00; + } else { + $addExp = $addExp * 1.00; + } + } + } else { + $addExp = 0; + } + + return $addExp; + } + + /** Добавляем опыт \ нанесенный урон + * @param $id + * @param $y + * @param $id1 + * @param $id2 + * @param $mgregen + * @return void + */ + public function takeExp($id, $y, $id1, $id2, $mgregen = false) + { + global $u; + if (isset($this->users[$this->uids[$id]])) { + $s1 = $this->stats[$this->uids[$id1]]; + $s2 = $this->stats[$this->uids[$id2]]; + if ($id1 != $id2) { + $e = $this->testExp($y, $s1, $s2, $id1, $id2); + } else { + $e = 0; + } + + if ( + (int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && + $this->users[$this->uids[$id1]]['dnow'] != 0 && + $this->info['dungeon'] != 1 + ) { + $dun_limitForLevel = [ // Максимум для каждого уровня. + 4 => 750, + 5 => 1500, + 6 => 3500, + 7 => 8000, + 8 => 25000, + 9 => 50000, + 10 => 75000, + 11 => 125000, + 12 => 250000, + 13 => 500000, + 14 => 750000, + ]; + $dun_expFactor = [ // Максимум для каждого уровня. + 4 => 5, + 5 => 5, + 6 => 5, + 7 => 5, + 8 => 5, + 9 => 3, + 10 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 14 => 1, + ]; + + if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) { + $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']]; + } + if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит + $dun_exp = []; // Текущий лимит опыта игрока в подземельях. + $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = ' . $this->users[$this->uids[$id1]]['id'])); + $rep = explode(',', $rep['dungeonexp']); + foreach ($rep as $key => $val) { + $val = explode('=', $val); + if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { + $dun_exp[(int)$val[0]] = (int)$val[1]; + } // текущий лимит опыта в подземке + } + unset($rep); + + if (!isset($dun_exp[$this->info['dungeon']])) { + $dun_exp[$this->info['dungeon']] = 0; + } + if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // Если лимит не задан, опыт не даем. + $e = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] + ) { // Если лимит уже достигнут, опыт не даем. + $e = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']] + ) { // Если текущая репутация не достигла лимита. + if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { + // Если опыта набрано достаточно, для достижения лимита. + $e = abs($e - abs($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']]))); + $dun_exp[$this->info['dungeon']] += $e; + } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) { + // Если опыта недостаточно, для достижения лимита. + $dun_exp[$this->info['dungeon']] += $e; + } else { + $e = 0; + } + } else { // В любой непонятной ситуцаии. + $e = 0; + } + } else // Опыт в пещерах. + { + if ($this->info['dungeon'] == 102) { + $e = floor($e * 0.002); + } + } + } + + $this->users[$this->uids[$id1]]['battle_exp'] += floor($e); + // + if (!$mgregen) { + $this->users[$this->uids[$id1]]['battle_yron'] += floor($y); + if ($this->stats[$this->uids[$id1]]['notactic'] != 1) { + if ($s2['hpAll'] <= 1000) { + if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), + 10); + } else { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), + 10) / 3; + } + } else { + if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10); + } else { + $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10) / 3; + } + } + } + } + + $upd = mysql_query('UPDATE `stats` SET `last_hp` = ' . $this->users[$this->uids[$id1]]['last_hp'] . ',`tactic6` = ' . $this->users[$this->uids[$id1]]['tactic6'] . ',`battle_yron` = ' . $this->users[$this->uids[$id1]]['battle_yron'] . ',`battle_exp` = ' . $this->users[$this->uids[$id1]]['battle_exp'] . ' WHERE `id` = ' . (int)$id1); + if (!$upd) { + echo '[не удача при использовании приема]'; + } else { + $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; + $this->clear_cache($id1); + $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + if ($id1 == $u->info['id']) { + $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; + $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; + $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron']; + $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic']; + $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic']; + } + } + unset($s1, $s2); + } + } + + /** Добавляем нанесенный урон. + * @param $uid + * @param $y + * @return void + * @todo Перенести в класс Priems. + */ + public function takeYronNow($uid, $y) + { + global $u; + $this->users[$this->uids[$uid]]['battle_yron'] += floor($y); + $this->stats[$this->uids[$uid]]['battle_yron'] += floor($y); + if ($uid == $u->info['id']) { + $u->info['battle_yron'] += floor($y); + $u->stats['battle_yron'] += floor($y); + } + mysql_query('UPDATE `stats` SET `battle_yron` = `battle_yron` + ' . mysql_real_escape_string(floor($y)) . ' WHERE `id` = ' . (int)$uid); + } + + /** JS информация о игроке. Действительно, что ещё хранить в _battles.. + * @param $id + * @param $t + * @return false|string + */ + public function myInfo($id, $t) + { + global $u; + if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) { + if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) { + //Всегда обновляем + $this->users[$this->uids[$id]] = mysql_fetch_array(mysql_query('SELECT + + `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1')); + $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true); + } + + $ur = $this->users[$this->uids[$id]]; + $st = $this->stats[$this->uids[$id]]; + $itm = $this->stats[$this->uids[$id]]['items']; + $eff = $this->stats[$this->uids[$id]]['effects']; + $ef = ''; + $i = 0; + if ($u->info['seff'] < 1) { + $ef .= '
    Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
    '; + + while ($i != -1) { + $nseef = 0; + if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) { + if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) { + $nseef = 1; + if ($eff[$i]['v1'] == 'priem') { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + } + if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) { + $nseef = 0; + } + } + } + + if (isset($eff[$i]) && $eff[$i] != 'delete') { + if ($nseef == 0) { + $ei = '' . $eff[$i]['name'] . ''; + if ($eff[$i]['x'] > 1) { + $ei .= ' x' . $eff[$i]['x'] . ' '; + } + if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) { + $ei .= ' (Эликсир)'; + } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) { + $ei .= ' (Заклятие)'; + } elseif ($eff[$i]['type1'] == 14) { + $ei .= ' (Прием)'; + } elseif ($eff[$i]['type1'] == 15) { + $ei .= ' (Изучение)'; + } elseif ($eff[$i]['type1'] == 17) { + $ei .= ' (Проклятие)'; + } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) { + $ei .= ' (Травма)'; + } elseif ($eff[$i]['type1'] == 20) { + $ei .= ' (Пристрастие)'; + } elseif ($eff[$i]['type1'] == 22) { + $ei .= ' (Ожидание)'; + } else { + $ei .= ' (Эффект)'; + } + $ei .= '
    '; + + $out = ''; + $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']); + if ($eff[$i]['timeAce'] == 0) { + $time_still += $eff[$i]['timeUse']; + } + $time_still -= time(); + if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) { + if ($eff[$i]['type1'] != 13) { + $ei .= 'Осталось: ' . $u->timeOut($time_still); + } + } else { + if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) { + $ei .= 'Осталось: ' . $u->timeOut($time_still); + } elseif ($eff[$i]['hod'] >= 0) { + $ei .= 'Зарядов: ' . $eff[$i]['hod']; + } + } + + if ($eff[$i]['user_use'] != '') { + if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') { + $ei .= '
    Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . ''; + } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') { + $ei .= '
    Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . ''; + } + } + + //Действие эффекта + $tr = ''; + $ti = $u->items['add']; + $x = 0; + $ed = $this->lookStats($eff[$i]['data']); + while ($x < count($ti)) { + $n = $ti[$x]; + if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') { + $z = ''; + if ($ed['add_' . $n] > 0) { + $z = '+'; + } + $tr .= '
    ' . $u->is[$n] . ': ' . $z . $ed['add_' . $n]; + } + $x++; + } + + if ($ed['add_mib1'] != 0) { + if ($ed['add_mab1'] != 0) { + $tr .= '
    Броня головы: ' . $ed['add_mib1'] . '-' . $ed['add_mab1']; + } else { + $m1l = $ed['add_mib1']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
    Броня головы: ' . $m1l; + } + } + if ($ed['add_mib2'] != 0) { + if ($ed['add_mab2'] != 0) { + $tr .= '
    Броня корпуса: ' . $ed['add_mib2'] . '-' . $ed['add_mab2']; + } else { + $m1l = $ed['add_mib2']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
    Броня корпуса: ' . $m1l; + } + } + if ($ed['add_mib3'] != 0) { + if ($ed['add_mab3'] != 0) { + $tr .= '
    Броня пояса: ' . $ed['add_mib3'] . '-' . $ed['add_mab3']; + } else { + $m1l = $ed['add_mib3']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
    Броня пояса: ' . $m1l; + } + } + if ($ed['add_mib4'] != 0) { + if ($ed['add_mab4'] != 0) { + $tr .= '
    Броня ног: ' . $ed['add_mib4'] . '-' . $ed['add_mab4']; + } else { + $m1l = $ed['add_mib4']; + if ($m1l > 0) { + $m1l = '+' . $m1l; + } + $tr .= '
    Броня ног: ' . $m1l; + } + } + + $efix = 0; + if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) { + $efix = $ed['add_pog2']; + } + if (isset($ed['add_pog'])) { + $tr .= '
    Магический барьер способен поглотить еще ' . $ed['add_pog'] . ' ед. урона'; + } + if (isset($ed['add_pog2'])) { + $tr .= '
    Магический барьер способен поглотить еще ' . $ed['add_pog2'] . ' ед. урона (' . $ed['add_pog2p'] . '%)'; + } + + if ($tr != '') { + $ei .= $tr; + } + if ($eff[$i]['info'] != '') { + $ei .= '
    Информация:
    ' . $eff[$i]['info']; + } + + $ef .= '
    '; + unset($efix); + } + } elseif ($eff[$i] != 'delete') { + $i = -2; + } + $i++; + } + } else { + $ef .= '
    Развернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
    '; + } + + $ca = ''; + if ($ur['clan'] > 0) { + $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = ' . $ur['clan'])); + if (isset($cl['id'])) { + $ca = ''; + } + } + if ($ur['align'] > 0) { + $ca = '' . $ca; + } + if ($ur['login2'] == '') { + $ur['login2'] = $ur['login']; + } + if (floor($st['hpNow']) > $st['hpAll']) { + $st['hpNow'] = $st['hpAll']; + } + if (floor($st['mpNow']) > $st['mpAll']) { + $st['mpNow'] = $st['mpAll']; + } + $stsua = '' . $ur['login2'] . ''; + $stsua .= '
    Сила: ' . $st['s1']; + $stsua .= '
    Ловкость: ' . $st['s2']; + $stsua .= '
    Интуиция: ' . $st['s3']; + $stsua .= '
    Выносливость: ' . $st['s4']; + if ($st['s5'] != 0) { + $stsua .= '
    Интелект: ' . $st['s5']; + } + if ($st['s6'] != 0) { + $stsua .= '
    Мудрость: ' . $st['s6']; + } + if ($st['s7'] != 0) { + $stsua .= '
    Духовность: ' . $st['s7']; + } + if ($u->info['admin'] > 0) { + $align = $ur['align']; + } + $tp_img = [ + 1 => 4, + 2 => 5, + 14 => 6, + 3 => 7, + 5 => 8, + 7 => 9, + 17 => 10, + 16 => 11, + 13 => 12, + 10 => 13, + 9 => 14, + 8 => 15, + 11 => 17, //кольцо 2 + 12 => 18 //кольцо 3 + ]; + $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor($st['hpNow']) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor($st['mpAll']) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();'; + $i = 0; + while ($i < count($itm)) { + // + if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) { + $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]]; + } + //генерируем предметы + $ttl = '' . $itm[$i]['name'] . ''; + $td = $this->lookStats($itm[$i]['data']); + $lvar = ''; + if ($td['add_hpAll'] > 0) { + $td['add_hpAll'] = '+' . $td['add_hpAll']; + $lvar .= '
    Уровень жизни: ' . $td['add_hpAll']; + } + if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) { + $lvar .= '
    Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']); + } + if ($td['add_mab1'] > 0) { + if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { + $m1l = '+'; + $lvar .= '
    Броня головы: ' . $m1l . (0 + $td['add_mab1']); + } else { + $lvar .= '
    Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']); + } + } + if ($td['add_mab2'] > 0) { + if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) { + $m1l = '+'; + $lvar .= '
    Броня корпуса: ' . $m1l . (0 + $td['add_mab2']); + } else { + $lvar .= '
    Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']); + } + } + if ($td['add_mab3'] > 0) { + if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) { + $m1l = '+'; + $lvar .= '
    Броня пояса: ' . $m1l . (0 + $td['add_mab3']); + } else { + $lvar .= '
    Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']); + } + } + if ($td['add_mab4'] > 0) { + if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) { + $m1l = '+'; + $lvar .= '
    Броня ног: ' . $m1l . (0 + $td['add_mab4']); + } else { + $lvar .= '
    Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']); + } + } + if ($itm[$i]['iznosMAX'] > 0) { + if ($itm[$i]['iznosMAXi'] == 999999999) { + $lvar .= '
    Долговечность: неразрушимо'; + } else { + $lvar .= '
    Долговечность: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']); + } + } + $ttl .= $lvar; + $ccv = ''; + + if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') { + if ($itm[$i]['magic_inc'] == '') { + $itm[$i]['magic_inc'] = $itm[$i]['magic_inci']; + } + $temp01 = mysql_query('SELECT * FROM `eff_main` WHERE `id2` = ' . $itm[$i]['magic_inc'] . ' AND `type1` = 12345 LIMIT 1'); + if ($temp01) { + $mgi = mysql_fetch_array($temp01); + if (isset($mgi['id2'])) { + $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);'; + } + } + } + + $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");'; + $i++; + } + + return $info; + } else { + return false; + } + } + + //Проверка на выживших + public function testUsersLive() + { + $tl = 0; + for ($i = 0; $i < count($this->uids); $i++) { + if ($this->stats[$i]['id'] <= 0) { + continue; + } + if (isset($tml[$this->users[$i]['team']]) || floor($this->stats[$i]['hpNow']) < 1) { + continue; + } + $tml[$this->users[$i]['team']] = 1; + $tl++; + if ($tl > 1) { + break; + } + } + return $tl > 1; + } + + //Мини лог + private function miniLogAdd(array $user, $text) + { + $time = time(); + $vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . $time . + '||time2=' . $time . + '||s1=' . $user['sex'] . + '||t1=' . $user['team'] . + '||login1=' . $user['login'] . + '||'; + $mas1 = [ + 'time' => $time, + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + 1), + 'text' => $text, + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + + $this->add_log($mas1); + } + + /** Проверяем завершение боя. + *
    [Оптимизируй меня]: много повторяющихся элементов. + * @return void + */ + public function testFinish() + { + global $u; + // + mysql_query('START TRANSACTION;'); + // + $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` = -1 LIMIT 1 FOR UPDATE')); + // + mysql_query('COMMIT;'); + // + if ($this->info['team_win'] == -1 && isset($test['id'])) { + $hp = []; + $tml = []; + $tmv = []; + $tl = 0; + $i = 0; + $j = 0; + while ($i < count($this->uids)) { + if ($this->stats[$i]['id'] > 0) { + if (floor($this->stats[$i]['hpNow']) < 1) { + $this->stats[$i]['hpNow'] = 0; + } + $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); + if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { + $tml[$this->users[$i]['team']] = 1; + $tmv[$j] = $this->users[$i]['team']; + $tl++; + } + } + $i++; + } + + if ($tl <= 1) { + //Доп.проверка + $tmHpNow = []; + $tmNow = []; + $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`u`.`battle`,`s`.`team`,`s`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if (!isset($tmHpNow[$pl['team']])) { + $tmHpNow[$pl['team']] = 0; + $tmNow[] = $pl['team']; + } + $hpTm = floor($pl['hpNow']); + if ($hpTm < 0) { + $hpTm = 0; + } + if ($hpTm > 0) { + $tmHpNow[$pl['team']] += $pl['hpNow']; + } + } + $gdj = 0; + $i = 0; + while ($i < count($tmNow)) { + if (isset($tmNow[$i])) { + $j = $tmNow[$i]; + if ($tmHpNow[$j] > 0) { + $gdj++; + } + } + $i++; + } + if ($gdj > 1) { + $tl = $gdj; + echo 'Поединок может завершиться не корректно... (Сообщите Администрации об этом)'; + } + } + + if ($tl <= 1) { + //завершаем поединок, кто-то один победил, либо ничья + + $i = 0; + $tmwin = 0; + while ($i < count($tmv)) { + if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { + $tmwin = $tmv[$i]; + } + $i++; + } + + if ($this->info['izlom'] == 0) { + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + unset($this->users, $this->stats, $this->uids, $this->bots, $this->iBots); + $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC'); + $ir = 0; + $bi = 0; + $this->users = null; + $this->stats = null; + $this->uids = null; + $this->bots = null; + $this->iBots = null; + while ($pl = mysql_fetch_array($trl)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$ir] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$ir] = $u->getStats($pl, 0, 0, false, false, true); + $ir++; + } + } + } elseif (!isset($this->uids[$u->info['id']])) { + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $this->info['id'] . '" LIMIT 1'); + $pl = mysql_fetch_array($trl); + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + } + //записываем статы + $this->stats[] = $u->getStats($pl, 0, 0, false, false, true); + } + } + + + if ($this->info['izlom'] > 0 && $tmwin == 1) { + // выкидываем ботов из боя + $i = 0; + $dlt = ''; + $dlt2 = ''; + $sp = mysql_query('SELECT `users`.`id`,`stats`.`bot`,`stats`.`team` FROM `users`,`stats` WHERE `users`.`battle` = "' . $this->info['id'] . '" AND `stats`.`id` = `users`.`id` LIMIT 250'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['bot'] == 1 && $pl['team'] != $u->info['team']) { + $dlt .= ' `id`="' . $pl['id'] . '" OR'; + $dlt2 .= ' `uid`="' . $pl['id'] . '" OR'; + $i++; + } + } + + if ($i > 0) { + $dlt = trim($dlt, 'OR'); + $dlt2 = trim($dlt2, 'OR'); + mysql_query('DELETE FROM `users` WHERE ' . $dlt . ' LIMIT ' . $i); + mysql_query('DELETE FROM `stats` WHERE ' . $dlt . ' LIMIT ' . $i); + mysql_query('DELETE FROM `items_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); + mysql_query('DELETE FROM `eff_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); + } + + unset($i, $dlt, $dlt2); + + $j = 0; + $k = 0; + $obr = 0; + + //Это излом, добавляем еще ботов + if ($this->get_chanse(20)) { + //Уникальные монстры + if ($this->info['izlomLvl'] == 8) { + $bots = [ + 'Валентайский Охотник', + 'Шипокрыл Хаоса', + 'Шипокрыл', + 'Лик Хаоса', + 'Фанатик Хаоса', + ]; + //$bots = array( 'Валентайский Охотник' ); + } + $logins_bot = []; + // + echo '
    Приближается нечто...
    '; + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + round($this->info['izlomRoundSee'])); + if (isset($id['id']) && $bot) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + $u->addAction(time(), 'win_bot_' . $id['id'], '', $this->users[$i]['id']); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } else { + //Обычные монстры + if ($this->info['izlomLvl'] == 8) { + $bots = [ + 'Литейщик', + 'Проклятие Глубин', + 'Пустынник Маньяк', + 'Пустынник Убийца', + 'Рабочий Мглы', + 'Смотритель Мглы', + 'Сторож Мглы', + ]; + } + $logins_bot = []; + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + ($this->info['izlomRoundSee'] * 2)); + if (isset($id['id']) && $bot) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + // + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + // + if (rand(0, 100) < 70) { + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } + //Каждые 10 вол = +1 монстр + $irb = floor($this->info['izlomRoundSee'] / 10); + while ($irb > 0) { + // + if (rand(0, 100) < 20) { + $id2 = rand(0, (count($bots) - 1)); + $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); + $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, + $this->info['izlomRoundSee']); + if (isset($id['id']) && $bot) { + // + $btxt = ''; + if ($id['align'] > 0) { + $btxt = $btxt . ''; + } + if ($id['clan'] > 0) { + $btxt = $btxt . ''; + } + $btxt = $btxt . '{u1}[' . $id['level'] . ']'; + if ($id['sex'] == 1) { + $btxt = $btxt . ' вмешалась в поединок.'; + } else { + $btxt = $btxt . ' вмешался в поединок.'; + } + $this->miniLogAdd([ + 'login' => $id['login'], + 'sex' => $id['sex'], + 'team' => 0, + ], '{tm1} ' . $btxt); + // + $logins_bot = $bot['logins_bot']; + mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + if (rand(0, 10000) < 1500) { + $obr++; + } + $j++; + } + } + $irb--; + } + } + // + unset($logins_bot); + if ($j == 0) { + //конец излома + $this->finishBattle($tml, $tmv, null, $tl); + $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); + } else { + $this->info['izlomRound'] = $iz['round']; + mysql_query('UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; + $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; + $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; + $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; + $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; + + $mas = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + 1), + 'vars' => $vLog, + 'type' => 1, + ]; + if ($u->info['sex'] == 1) { + $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' воспользовалась приемом "Передышка".'; + } else { + $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' воспользовался приемом "Передышка".'; + } + if ($u->stats['hpNow'] < $u->stats['hpAll']) { + $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); + if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { + $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); + } + $mas['text'] .= ' +' . $hpSks . ''; + } else { + $hpSks = 0; + $mas['text'] .= ' --'; + } + $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; + $this->add_log($mas); + + mysql_query('UPDATE `stats` SET `hpNow` = "' . ($u->info['hpNow'] + ($u->stats['hpAll'] * ((rand(15, + 25)) / 100))) . '",`mpNow` = "' . ($u->info['mpNow'] + ($u->stats['mpAll'] * 0.25)) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + } else { + //завершаем бой + $this->finishBattle($tml, $tmv, null, $tl); + if ($this->info['izlom'] > 0) { + $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); + } + } + if (isset($fin1)) { + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '","Касание Хаоса","nofastfinisheff=1","' . time() . '")'); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "','Вы создали предмет "Образец"x" . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) . "','" . time() . "','6','0')"); + $i01 = 1; + while ($i01 <= (($this->info['izlomObr'] - $this->info['izlomObrNow'])) * 7) { + $u->addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); + $i01++; + } + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")'); + unset($fin1); + } + } + } else { + mysql_query('START TRANSACTION;'); + $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`, `testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1 FOR UPDATE')); + mysql_query('COMMIT;'); + if (isset($test['id'])) { + $this->finishBattle(null, null, 10, $tl); + } + } + } + + + /** Завершение поединка. + *
    ЁБИЧЕСКАЯ СИЛА! СЮДА НАПИХАНО ВСЁ! + *
    Эта функция принесёт больше всего проблем. + * @param $t ??? + * @param $v ??? + * @param $nl ??? + * @param $tl [unused] ??? + * @return void + */ + private function finishBattle($t, $v, $nl, $tl) + { + global $u, $c; + mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE'); + $frtu = false; + $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`,`testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1;')); + if ($test['testfinish'] != -1) { + $trtt = mysql_query('UPDATE `battle` SET `testfinish` = "-1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + $relbf = $this->info['team_win']; + if ($nl != 10) { + $i = 0; + $dnr = 0; + if ($this->info['team_win'] == -1) { + $this->info['team_win'] = 0; + while ($i < count($v)) { + if ($v[$i] >= 1 && $t[$v[$i]] > 0) { + $this->info['team_win'] = $v[$i]; + } + $i++; + } + } + } + + + //данные о игроках в бою + $t = mysql_query('SELECT `u`.`stopexp`,`u`.`twink`,`u`.`city`,`u`.`room`,`u`.`no_ip`,`u`.`pass`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + $i = 0; + $bi = 0; + while ($pl = mysql_fetch_array($t)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$i] = $pl; + $this->uids[$pl['id']] = $i; + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$i] = $u->getStats($pl, 0, 0, false, false, true); + $i++; + } + unset($pl, $t); + + if ($this->info['time_over'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `time_over` = "0" LIMIT 1')); + if (isset($tststrt['id'])) { + if ($this->info['inTurnir'] == 0 || $this->info['type'] == 500) { + mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `battle_stat` SET `team_win` = "' . $this->info['team_win'] . '" WHERE `battle_id` = "' . $this->info['id'] . '"'); + //Заносим данные о завершении боя + $i = 0; + $vl = ''; + $vtvl = ''; + $relu = 0; + while ($i < count($this->users)) { + $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; + if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) { + $vtvl .= '' . $this->users[$i]['login'] . ', '; + } + $i++; + } + + $this->info['players_c'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` NOT LIKE "%(зверь%" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->info['players_c'] = $this->info['players_c'][0]; + + mysql_query('UPDATE `battle` SET `players_c` = "' . $this->info['players_c'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + + if ($vtvl != '') { + $vtvl = rtrim($vtvl, ', '); + $vtvl = str_replace('"', '\\\\\"', $vtvl); + $this->hodID++; + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'Бой закончен, победа за ' . $vtvl . '.'; + } else { + $this->info['players_cc'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` > 0 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); + $this->info['players_cc'] = $this->info['players_cc'][0]; + $this->info['players_cc2'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` >= 1 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); + $this->info['players_cc2'] = $this->info['players_cc2'][0]; + $inf_test = ', users: ' . $this->info['players_cc'] . ' and ' . $this->info['players_cc2'] . ''; + $this->hodID++; + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'Бой закончен, ничья.'; + } + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + + $this->saveLogs(); + + if ($this->info['type'] == 99) { + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $vtvl = 'И победители стали калечить проигравших...'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + $i = 0; + $vtvl = ''; + $tr_nm = [ + 1 => 'легкую', + 2 => 'среднюю', + 3 => 'тяжелую', + 4 => 'неизлечимую', + ]; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->info['team_win']) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); + if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { + if ($this->info['smert'] == 1) { + $tr_tp = 4; + } else { + $tr_tp = rand(1, 3); + } + if (isset($tr_pl['id'])) { + $tr_tp = rand(($tr_pl['v1'] + 1), 3); + } + if ($this->users[$i]['sex'] == 1) { + $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение: ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; + } else { + $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение: ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; + } + $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); + } + } + $i++; + } + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + + if ($vl != '') { + $vl = rtrim($vl, ','); + mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ' . $vl . ''); + } + mysql_query('INSERT INTO `battle_end` (`battle_id`,`city`,`time`,`team_win`) VALUES ("' . $this->info['id'] . '","' . $this->info['city'] . '","' . $this->info['time_start'] . '","' . $this->info['team_win'] . '")'); + } + + + $vLog = 'time1=' . time(); + $mass = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => 'test', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $i = 0; + $vtvl = ''; + $tr_nm = [ + 1 => 'легкую', + 2 => 'среднюю', + 3 => 'тяжелую', + 4 => 'неизлечимую', + ]; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->info['team_win'] && $this->info['team_win'] > 0) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 292 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" LIMIT 1')); + + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + + if (isset($tr_pl['id'])) { + if (rand(0, 100) < $tr_pl['data']) { + $tr_tp = rand(($tr_pl['v1'] + 1), 3); + if ($this->users[$i]['sex'] == 1) { + $vtvl = '' . $this->users[$i]['login'] . ' получила повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; + } else { + $vtvl = '' . $this->users[$i]['login'] . ' получил повреждение (Искалечить, автор: ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' травму.
    ' . $vtvl; + } + $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); + } + } + } + $i++; + } + if ($vtvl != '') { + if ($this->info['type'] != 99) { + $vtvl2 = 'И победители стали калечить проигравших...'; + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + } + + //Турнир БС + if ($this->info['inTurnir'] > 0 && $this->info['dungeon'] != 15 && $u->info['room'] != 413) { + $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->info['inTurnir'] . '" LIMIT 1')); + $i = 0; + $j = 0; + while ($i < count($this->users)) { + if ($this->stats[$i]['hpNow'] < 1 && $this->users[$i]['clone'] == 0 && $this->stats[$i]['clone'] == 0) { + //Добавляем в лог БС + if ($this->users[$i]['sex'] == 0) { + $text .= '{u1} повержен и выбывает из турнира'; + } else { + $text .= '{u1} повержена и выбывает из турнира'; + } + //Выкидываем предметы с персонажа + $spik = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` ="0"'); + while ($plik = mysql_fetch_array($spik)) { + /* + БС-1 + */ + mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $plik['item_id'] . '","' . (time() - 600) . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '" + )'); + } + unset($spik, $plik); + // + $usrreal = ''; + $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $this->users[$i]['login'] . '" AND `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (!isset($usr_real['id'])) { + $usr_real = $this->users[$i]; + } + if (isset($usr_real['id'])) { + if ($usr_real['align'] > 0) { + $usrreal .= ''; + } + if ($usr_real['clan'] > 0) { + $usrreal .= ''; + } + $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + $text = str_replace('{u1}', $usrreal, $text); + mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", + "' . round($bs['money'] * 0.85, 2) . '","' . $i . '" + )'); + // + //Удаление клона + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); + //Обновление персонажа + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `login` = "' . $this->users[$i]['login'] . '" OR `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //Обновляем заявку + mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `inBot` = "' . $this->users[$i]['id'] . '" AND `off` = "0" LIMIT 1'); + unset($text, $usrreal, $usr_real); + if ($this->users[$i]['pass'] != 'bstowerbot') { + $bs['users']--; + $bs['users_finish']++; + } else { + $bs['arhiv']--; + } + $j++; + } + $i++; + } + if ($j > 0) { + mysql_query('UPDATE `bs_turnirs` SET `arhiv` = "' . $bs['arhiv'] . '",`users` = "' . $bs['users'] . '",`users_finish` = "' . $bs['users_finish'] . '" WHERE `id` = "' . $bs['id'] . '" LIMIT 1'); + } + + unset($bs, $j); + } + + //Награда за события + if ($this->info['type'] == 500 && isset($tststrt['id'])) { + //Предметы которые выпадают в центр + + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['no_ip'] == 'trupojor') { + $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (isset($mon['id'])) { + if ($this->info['team_win'] == 0) { + //Ничья + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + $mon['nich_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + } elseif ($this->info['team_win'] != $this->users[$i]['team']) { + //Выиграли + $j = 0; + $usrwin = ''; + while ($j < count($this->users)) { + if ($this->users[$j]['no_ip'] != 'trupojor' && $this->users[$j]['bot'] == 0) { + if ($this->stats[$j]['hpNow'] > 0) { + $usrwin .= ', '; + if ($this->users[$j]['align'] > 0) { + $usrwin .= 'users[$j]['align'] . '.gif >'; + } + if ($this->users[$j]['clan'] > 0) { + $usrwin .= 'users[$j]['clan'] . '.gif >'; + } + $usrwin .= '' . $this->users[$j]['login'] . ' [' . $this->users[$j]['level'] . ']users[$j]['id'] . ' >'; + } + } + $j++; + } + if ($usrwin != '') { + $usrwin = ltrim($usrwin, ', '); + } else { + $usrwin = 'Команда героев'; + } + + + mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + $truptimelast = time() + rand(1800, 3600); + + mysql_query('UPDATE `stats` SET `res_x` = "' . $truptimelast . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + str_replace('{u}', $usrwin, + $mon['win_text']))) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + unset($usrwin); + } else { + //Проиграли + if ($mon['win_back'] == 1) { + mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string(str_replace('{b}', + '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', + $mon['lose_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); + } + } + } + $i++; + } + } + } + + // выкидываем ботов из боя + $i = 0; + $botsi = 0; + if (isset($tststrt['id'])) { + while ($i < count($this->users)) { + //Тут выкидываем юзеров из Призавого хаота + if ($this->info['type'] == 33) { + $plde = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if (isset($plde['mail']) && $plde['mail'] == "haot@new-combats.com") { + $pld = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + + if (isset($pld['id'])) { + if ($this->users[$i]['battle_yron'] >= 500) { + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $u->addItem(4754, $pld['id'], ''); + $pld['battle_text'] .= ' За Героическое Сражение вы получаете Реликвия Ангела (x5). '; + mysql_query('UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); + + if ($this->users[$i]['team'] == $this->info['team_win']) { + if (rand(1, 100) <= 5) { + $u->addItem(10020, $pld['id'], ''); + $pld['battle_text'] .= ' и Жетон Успеха. '; + } + } + } else { + $pld['battle_text'] .= ' Вы ничего не получили. Нужно набить больше 500 урона урона .'; + } + + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $pld['city'] . "','" . $pld['room'] . "','','" . $pld['login'] . "','" . $pld['battle_text'] . "','-1','6','0')"); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + } + + unset ($plde, $pld); + } + + if ($this->users[$i]['bot'] == 1) { + $botsi++; + mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } elseif ($this->users[$i]['bot'] == 2) { + $this->users[$i]['battle'] = 0; + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`timeGo` = "'.time().'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } elseif ($this->users[$i]['bot'] > 0) { + $this->users[$i]['battle'] = 0; + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); + } + if ($this->users[$i]['clone'] > 0 && $this->users[$i]['bot'] > 0 && isset($this->users[$this->uids[$this->users[$i]['clone']]]['id']) && $this->users[$this->uids[$this->users[$i]['clone']]]['team'] != $this->users[$i]['team']) { + //Добавляем что клон побежден + if ($this->users[$this->uids[$this->users[$i]['clone']]]['team'] == $this->info['team_win']) { + $u->addAction(time(), 'win_bot_clone', '', $this->users[$i]['clone']); + } elseif ($this->info['team_win'] == 0) { + $u->addAction(time(), 'nich_bot_clone', '', $this->users[$i]['clone']); + } else { + $u->addAction(time(), 'lose_bot_clone', '', $this->users[$i]['clone']); + } + } elseif ($this->users[$i]['bot'] > 0 && $this->users[$i]['bot_id'] > 0) { + //Добавляем что бота победили + $j = 0; + while ($j < count($this->users)) { + if ($this->users[$j]['bot'] == 0 && $this->users[$j]['team'] != $this->users[$i]['team']) { + if ($this->users[$j]['team'] == $this->info['team_win']) { + $u->addAction(time(), 'win_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + // + mysql_query('UPDATE `dialog_act` SET `now` = `now` + 1 WHERE `uid` = "' . $this->users[$j]['id'] . '" AND + ( `btl_bot` LIKE "' . $this->users[$i]['bot_id'] . '!%" OR `btl_bot` LIKE "%!' . $this->users[$i]['bot_id'] . '!%" ) + AND `val` != 1 + LIMIT 1'); + // + } elseif ($this->info['team_win'] == 0) { + $u->addAction(time(), 'nich_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + } else { + $u->addAction(time(), 'lose_bot_' . $this->users[$i]['bot_id'], '', + $this->users[$j]['id']); + } + } + $j++; + } + } + $i++; + } + } + + $botss = []; + + if ($nl != 10) { + //Из бота падают предметы + if ($this->info['dungeon'] > 0) { + if ($this->info['team_win'] == $u->info['team'] && $this->info['dungeon'] == 102) { + $j1 = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->info['dn_id'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1')); + if (isset($j1['id'])) { + mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $j1['id'] . '" LIMIT 1'); + //Выпадает шмотка + mysql_query('INSERT INTO `laba_obj` (`use`,`lib`,`time`,`type`,`x`,`y`,`vars`) VALUES ( + "0","' . $j1['lib'] . '","' . time() . '","6","' . $j1['x'] . '","' . $j1['y'] . '","' . (0 + $botsi) . '" + )'); + } + } elseif ($this->info['team_win'] == $u->info['team']) { + //выйграли люди, выкидываем предметы из мобов + $j1 = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->info['y'] . '" LIMIT 100'); + while ($tbot = mysql_fetch_array($j1)) { + $j2 = 0; + while ($j2 < $tbot['colvo']) { + if (isset($tbot['id2'])) { + $tbot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $tbot['id_bot'] . '" LIMIT 1')); + $itms = explode('|', $tbot2['p_items']); + $tii = 0; + $testdrop = 0; + while ($tii < count($itms) && $testdrop == 0) { + $itmz = explode('=', $itms[$tii]); + if ($itmz[0] > 0) { + if (isset($itmz[2]) && $itmz[2] != '') { + $questDrop = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%' . $itmz[2] . '%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); + } + if (isset($questDrop['id'])) { // Если квест есть, предмет имеет шанс выпасть + } elseif (isset($itmz[2]) && $itmz[2] != '') { + $itmz[1] = 0; + } // Если предмет квестовый, а квеста у игрока нет, то предмет выпадет с вероятностью 0 + unset($questDrop); + + //Добавляем этот предмет в зону Х и У + if ($itmz[1] * 100000 >= rand(1, 10000000)) { + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz[0] . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + if (!isset($questDrop['id'])) { + $testdrop = 1; //ТУТ drop-drop //quest + } + } + } + $tii++; + } + } + $j2++; + } + // + //Квест 1-15 сентября, + if (date('m') == 9 && date('d') < 15) { + if ($this->get_chanse(99)) { + //Не выпало + } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 101) { + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmz = [ + rand(4745, 4751), + 100, + ]; + // + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz[0] . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + } + } + // + //Странички саныча, + + if (rand(1, 100) <= 99) { + //Не выпало + } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 3 || + $this->info['dungeon'] == 101 || $this->info['dungeon'] == 16 || + $this->info['dungeon'] == 9 || $this->info['dungeon'] == 10 || + $this->info['dungeon'] == 13 || $this->info['dungeon'] == 106) { + $tou = 0; //какому юзеру предназначено + // выделяем случайного юзера из команды + $itmz = rand(3143, 3192); + // + $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz . '" LIMIT 1')); + $itmnm = $itmnm['name']; + + $rtxt = 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'; + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + + $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $this->info['dn_id'] . '", + "' . $tou . '", + "' . $itmz . '", + "' . time() . '", + "' . $this->info['x'] . '", + "' . $this->info['y'] . '")'); + } + } + mysql_query('UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" '); + } else { + //выкидываем всех игроков в клетку RESTART + $dnr = 1; + if ($this->info['dungeon'] != 102) { + mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `y`= "' . $this->info['y'] . '"'); + } + } + } + } + $gm = []; + $gms = []; + $bm = []; + $bms = []; + + //Квестовый раздел + //Квестовый раздел + //завершаем поединок + $i = $this->uids[$u->info['id']]; + + if ($this->info['team_win'] >= 0) { + if ($this->stats[$i]['pbe'] > 0) { + //Бонус покупателя + $this->expCoef += $this->stats[$i]['pbe']; + } + + if ( + $this->info['razdel'] == 5 && + (($c['m'] >= 6 && $c['m'] <= 8) || ($c['w'] == 0 || $c['w'] == 6)) + ) { + //Лето и выходные + $this->expCoef += 5; + } + + $this->stats[$i]['exp'] += $this->expCoef; + + $this->stats[$i]['exp'] += $this->aBexp * $c['exp']; + + if ($this->stats[$i]['os4'] > 0) { + $this->stats[$i]['exp'] += $this->stats[$i]['os4']; + } + + $act01 = 0; + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] + ($this->users[$i]['battle_exp'] / 100 * (1 + $this->info['addExp'] + $this->stats[$i]['exp']))); + + if ($this->info['type'] == 564) { + //Бой с копией + $this->users[$i]['battle_exp'] = 0; + } + + if ($this->info['dungeon'] == 104) { + $this->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->uids) - 1); + } elseif ($this->info['dungeon'] > 0 && $this->users[$i]['dnow'] != 0 && $this->info['dungeon'] != 1 && $this->users[$i]['team'] == $this->info['team_win']) { + $dun_limitForLevel = [ + 4 => 750, + 5 => 1500, + 6 => 3500, + 7 => 8000, + 8 => 25000, + 9 => 50000, + 10 => 75000, + 11 => 100000, + 12 => 100000, + 13 => 100000, + 14 => 100000, + ]; + // Максимум для каждого уровня. + + if ($this->users[$i]['battle_exp'] > 0) { + $dun_exp = []; // Текущий лимит опыта игрока в подземельях. + $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + $rep = explode(',', $rep['dungeonexp']); + foreach ($rep as $key => $val) { + $val = explode('=', $val); // текущий лимит опыта в подземке + if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { + $dun_exp[(int)$val[0]] = (int)$val[1]; + } + } + unset($rep); + } + + if (!isset($dun_exp[$this->info['dungeon']])) { + $dun_exp[$this->info['dungeon']] = 0; + } + + if (!isset($dun_limitForLevel[(int)$this->users[$i]['level']])) { // Если лимит не задан, опыт не даем. + $this->users[$i]['battle_exp'] = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$i]['level']] + ) { // Если лимит уже достигнут, опыт не даем. + $this->users[$i]['battle_exp'] = 0; + } elseif ( + isset($dun_exp[$this->info['dungeon']]) && + $dun_limitForLevel[(int)$this->users[$i]['level']] > $dun_exp[$this->info['dungeon']] + ) { // Если текущая репутация не достигла лимита. + if (($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->users[$i]['level']]) { + // Если опыта набрано достаточно, для достижения лимита. + $this->users[$i]['battle_exp'] = abs($this->users[$i]['battle_exp'] - abs($dun_limitForLevel[(int)$this->users[$i]['level']] - ($this->users[$i]['battle_exp'] + $dun_exp[$this->info['dungeon']]))); + $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; + } elseif ($dun_limitForLevel[(int)$this->users[$i]['level']] > ($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp'])) { + // Если опыта недостаточно, для достижения лимита. + $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; + } else { + $this->users[$i]['battle_exp'] = 0; + } + } else { // В любой непонятной ситуцаии. + $this->users[$i]['battle_exp'] = 0; + } + + + if ($this->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->info['dungeon']]) && $dun_exp[$this->info['dungeon']] > 0) { + $dunexp = []; + foreach ($dun_exp as $key => $val) { + $dunexp[$key] = $key . '=' . $val; // текущий лимит опыта в подземке + } + $dun_exp = implode(",", $dunexp); + mysql_query('UPDATE `rep` SET `dungeonexp` = "' . $dun_exp . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + unset($dunexp, $dun_exp); + } + unset($dun_limitForLevel); + } + + $sinf = ''; + if ($c['exp_mega']) { + $this->users[$i]['battle_exp'] += floor($this->users[$i]['battle_exp'] / 100 * $c['exp_mega_val'][$this->users[$i]['level']]); + } + + if ($this->info['team_win'] == 0 && $this->info['type'] != 564) { + //ничья + if ($this->users[$i]['level'] <= 1) { + $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] * 0.50); + } else { + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); + } + $this->users[$i]['nich'] += 1; + // + mysql_query('UPDATE `users` SET `swin` = 0, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + // + } elseif ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['type'] != 564) { + //выйграл + $gm[$i] = $this->info['money']; + + $gms[$i] = $this->info['money3']; + + $this->users[$i]['win'] += 1; + $act01 = 1; + // + mysql_query('UPDATE `users` SET `swin` = `swin` + 1, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + // + } elseif ($this->info['type'] != 564) { + //проиграл + if ($this->users[$i]['level'] <= 1) { + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.33); + } else { + $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); + } + $bm[$i] = $this->info['money']; + + $bms[$i] = $this->info['money3']; + + $this->users[$i]['lose'] += 1; + mysql_query('UPDATE `users` SET `swin` = 0, `slose` = `slose` + 1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + $act01 = 2; + } + //Рассчитываем кол-во выигрышных сумм и кто сколько получил (для екр.) + if ($this->info['money3'] > 0 && isset($gms[$i]) && $this->info['type'] != 564) { + $mn = [ + 'l' => 0, //сколько проигравших игроков + 'w' => 0, //сколько выигрывших игроков + 'm' => 0 //сумма выигрыша (общая) + ]; + if ($act01 == 1) { + $mn['l'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` != "' . $this->users[$i]['team'] . '" LIMIT 1')); + $mn['l'] = $mn['l'][0]; + $mn['w'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` = "' . $this->users[$i]['team'] . '" LIMIT 1')); + $mn['w'] = $mn['w'][0]; + $mn['m'] = round(($mn['l'] * $this->info['money3']) / 100 * 87, 2); + $gms[$i] = round(($mn['m'] / $mn['w']), 2); + } + } + // + //заносим данные в БД + //Поломка предметов + if ($act01 == 1) { + //победа + if ($this->users[$i]['dnow'] == 0) { + if ($this->users[$i]['hpNow'] < 1) { + $lom = 0.05; + } + } + } elseif ($act01 == 2) { + //поражение + $lom = 0.55; + } else { + //ничья + $lom = 0.05; + } + //$lom = round($lom*2.75,2); + $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)]; + if ($this->info['type'] == 564) { + $lom = 0; + } + if ($this->stats[$i]['silver'] >= 4) { + $lom = 0; + } + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW`+' . $lom . ' WHERE `inOdet` < "18" AND `inOdet` > "0" AND `uid` = "' . $this->users[$i]['id'] . '" AND `inOdet`!="0" AND `inOdet`!=' . $nlom[0] . ' AND `inOdet`!=' . $nlom[1] . ' AND `inOdet`!=' . $nlom[2] . ' AND `inOdet`!=' . $nlom[3] . ' LIMIT 18'); + + $prc = ''; + if ($this->users[$i]['align'] == 2) { + $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] / 2); + } + if ($this->users[$i]['animal'] > 0) { + $ulan = $u->testAction('`uid` = "' . $this->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->info['id'] . '" LIMIT 1', + 1); + if (isset($ulan['id']) && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['level'] > $ulan['vals']) { + $a004 = mysql_fetch_array(mysql_query('SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); + //33% от опыта переходит зверю, но не более максимума + $aexp = (round($this->users[$i]['battle_exp'] / 100 * 33)); + if ($aexp > $a004['max_exp']) { + $aexp = $a004['max_exp']; + } + unset($ulan); + // + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat` + ) VALUES ( + '1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "' + ,'Ваш питомец "" . $a004['name'] . "" получил опыт: " . $aexp . "','-1','6','0')"); + // + $upd = mysql_query('UPDATE `users_animal` SET `exp` = `exp` + ' . $aexp . ' WHERE `id` = "' . $this->users[$i]['animal'] . '" AND `level` < ' . $this->users[$i]['level'] . ' LIMIT 1'); + if ($upd) { + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 100 * 67); + $this->info['addExp'] -= 33.333; + } + } + } + + $prsusers = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" LIMIT 1')); + unset($prsusers); + $btlstatus = $this->typeBattle($prsusers[0]); + if ($this->info['smert'] == 1) { + $btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; + } + // + if ($this->stats[$i]['clanpos'] > 0) { + if ($this->stats[$i]['clanpos'] == 1) { + $this->info['addExp'] += 0; + } elseif ($this->stats[$i]['clanpos'] == 2) { + $this->info['addExp'] += 0; + } elseif ($this->stats[$i]['clanpos'] == 3) { + $this->info['addExp'] += 0; + } + } + + unset($r1); + //Статусная битва + if ($btlstatus[0] > 0) { + if ($this->info['type'] == 99) { + $this->info['addExp'] += $btlstatus[1]; + } else { + $this->info['addExp'] += $btlstatus[0]; + } + } + + if ($this->users[$i]['align'] == 2 || $this->users[$i]['haos'] > time()) { + $this->stats[$i]['exp'] = -($this->info['addExp'] + 50); + } + if ($this->info['addExp'] + $this->stats[$i]['exp'] != 0) { + $prc = ' (' . (100 + $this->info['addExp'] + $this->stats[$i]['exp']) . '%)'; + } + if ($this->info['money'] > 0) { + if (isset($gm[$i])) { + $prc .= ' Вы выйграли ' . $gm[$i] . ' кр. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж выйграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money'] += $gm[$i]; + } elseif (isset($bm[$i])) { + $prc .= ' Вы заплатили ' . $bm[$i] . ' кр. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж проиграл ' . $gm[$i] . ' кр. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money'] -= $bm[$i]; + } + } + // + if ($c['money_haot'] && $this->users[$i]['exp'] <= 200000000) { + if ($act01 == 1 && $this->info['razdel'] == 5 && $this->users[$i]['level'] >= 8) { + //Сколько нужно опыта набить + $trexp = [ + 8 => 1200, + 9 => 3000, + 10 => 4500, + 11 => 12000, + 12 => 20000, + 13 => 30000, + 14 => 30000, + 15 => 30000, + 16 => 30000, + 17 => 30000, + 18 => 30000, + 19 => 30000, + 20 => 30000, + 21 => 30000, + ]; + $trexp = $trexp[$this->users[$i]['level']]; + + //Какая цена фулла должна быть + $trmn = [ + 8 => 1000, + 9 => 3000, + 10 => 2500, + 11 => 3000, + 12 => 3000, + 13 => 3000, + 14 => 3000, + 15 => 3000, + 16 => 3000, + 17 => 3000, + 18 => 3000, + 19 => 3000, + 20 => 3000, + 21 => 3000, + ]; + $trmn = $trmn[$this->users[$i]['level']]; + + //Сколько екр дается + $admn = [ + 8 => 0.05, //0.05 + 9 => 0.065, //0.065 + 10 => 0.075, //0.075 + 11 => 0.085, //0.085 + 12 => 0.1, //0.1 + 13 => 0.1, + 14 => 0.1, + 15 => 0.1, + 16 => 0.1, + 17 => 0.1, + 18 => 0.1, + 19 => 0.1, + 20 => 0.1, + 21 => 0.1, + ]; + $admn = $admn[$this->users[$i]['level']]; + + if ($c['m'] >= 6 && $c['m'] <= 8) { + //Летний период + if ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { + //Выходные дни + $admn = $admn * 2; + } + } elseif ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { + //Выходные дни + $admn = $admn * 2; + } + if ($this->users[$i]['battle_exp'] < $trexp) { + //недостаточно опыта набито за бой + $prc .= ', Награда 0 ЕКР за этот бой (Мало опыта набили).'; + //недостаточно стоимость кр вещей + } elseif ($admn > 0) { + if ($this->info['type'] != 33) { + $prc .= ', Награда ' . $admn . ' ЕКР за этот бой.'; + } + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж получил ' . $admn . ' ЕКР (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money2'] += $admn; + } + } + } + + if ($this->info['money3'] > 0) { + if (isset($gms[$i])) { + $prc .= ' Вы выйграли ' . $gms[$i] . ' $. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж выйграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money3'] += $gms[$i]; + mysql_query('UPDATE `users` SET `money3` = `money3` + "' . $gms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } elseif (isset($bms[$i])) { + $prc .= ' Вы заплатили ' . $bms[$i] . ' $. за этот бой.'; + $u->addDelo(4, $this->users[$i]['id'], + '"System.battle": Персонаж проиграл ' . $gms[$i] . ' $. (В бою №' . $this->info['id'] . ').', + time(), $this->info['city'], 'System.battle', 0, 0); + $this->users[$i]['money3'] -= $bms[$i]; + mysql_query('UPDATE `users` SET `money3` = `money3` - "' . $bms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + } + + $lime = [ + 8 => 18000, + 9 => 28000, + 10 => 84000, + 11 => 100, + 12 => 100, + 13 => 100, + 14 => 100, + 15 => 100, + 16 => 100, + 17 => 100, + 18 => 100, + 19 => 100, + 20 => 100, + 21 => 100, + ]; + + if ($this->users[$i]['level'] < 8) { + $lime = 5400; + } else { + $lime = $lime[$this->users[$i]['level']]; + } + + if ($this->stats[$i]['silver'] >= 5) { + $lime += round($lime); + } + + if ($this->users[$i]['stopexp'] == 1) { + $lime = 0; + $this->users[$i]['battle_exp'] = 0; + } + + if ($lime < $this->users[$i]['battle_exp'] && $c['limitedexp']) { + $this->users[$i]['battle_exp'] = $lime; + } + unset($lime); + + if ($btlstatus[0] > 0) { + if ($this->info['type'] == 99) { + $prc .= ' (' . $btlstatus[3] . ')'; + } else { + $prc .= ' (' . $btlstatus[2] . ')'; + } + } + + if ($this->info['dungeon'] == 1 && $this->users[$i]['team'] == $this->info['team_win']) { + //канализация лимит + $rep = mysql_fetch_array(mysql_query('SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if ($rep['dl' . $this->info['dungeon']] > 0) { + $this->users[$i]['battle_exp'] += 3 * count($this->users); + if ($rep['dl' . $this->info['dungeon']] > $this->users[$i]['battle_exp']) { + $rep['dl' . $this->info['dungeon']] -= $this->users[$i]['battle_exp']; + } else { + $this->users[$i]['battle_exp'] = $rep['dl' . $this->info['dungeon']]; + $rep['dl' . $this->info['dungeon']] = 0; + } + mysql_query('UPDATE `rep` SET `dl' . $this->info['dungeon'] . '` = "' . $rep['dl' . $this->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'); + } else { + $this->users[$i]['battle_exp'] = 0; + } + } + + if ($this->users[$i]['battle_exp'] < 1) { + $this->users[$i]['battle_exp'] = 0; + } + + if ( + $this->users[$i]['battle_exp'] < 1 && + $this->users[$i]['twink'] == 0 && + $this->info['money'] == 0 && + $this->info['money3'] == 0 && + $this->info['kingfight'] == 0 && + empty($admnb) + ) { + $prc = ''; + } + + if ($this->user[$i]['host_reg'] == 'real_bot_user') { + $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 3); + } + + if ($sinf != '') { + $sinf = ' ( ' . $sinf . ' )'; + } + + //--------------Лимит 8-9-------------- + + if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) { + $this->users[$i]['battle_exp'] = 23000; + } + if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) { + $this->users[$i]['battle_exp'] = 31000; + } + if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) { + $this->users[$i]['battle_exp'] = 52000; + } + if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) { + $this->users[$i]['battle_exp'] = 75000; + } + //------------------------------------- + + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] = 'Бой закончен. Всего вами нанесено урона: ' . floor($this->users[$i]['battle_yron']) . ' HP. Получено опыта: ' . (0 + $this->users[$i]['battle_exp']) . '' . $prc . '.' . $sinf; //stats + } + + /*Выпадение зубов в конце боя */ + if ($c['nolevel']) { + $rex95 = substr($this->users[$i]['exp'], -1); + if ($this->users[$i]['money4'] < 1000 && $this->users[$i]['exp'] == 12499) { + $rex95 = 6; + $rex95 = 5; + } + } else { + $rex95 = 5; + } + + if ($c['zuby'] && $this->info['dungeon'] == 0 && ($this->info['clone'] == 0 || $this->users[$i]['level'] < 5) && $rex95 != 9 && $this->info['type'] != 564) { + if ($this->users[$i]['align'] != 2 && $this->users[$i]['level'] >= 0 && $this->users[$i]['level'] < 8 && $this->users[$i]['battle_exp'] > 0) { + $rzb = 0; + + if ($this->get_chanse(50)) { + $rzb += rand(1, 3); + } elseif ($this->users[$i]['battle_exp'] > 15) { + $rzb += 1; + } + + $chzbs = 100; + + if ($this->stats[$i]['silver'] > 0) { + $chzbs = 150; + } + + if ($this->users[$i]['battle_exp'] > 9) { + if ($this->users[$i]['level'] > 1) { + //Нормальный зуб + if ($this->get_chanse(25 / 100 * $chzbs)) { + $rzb += 10; + } + } elseif ($this->users[$i]['level'] == 1 && $this->get_chanse(30 / 100 * $chzbs)) { + $rzb += 10; + } + + if ($this->users[$i]['level'] > 3 && $this->get_chanse(5 / 100 * $chzbs)) { + $rzb += 100; + } + } + + if ($this->users[$i]['team'] == $this->info['team_win']) { + //выиграли + if ($this->users[$i]['level'] < 8) { + $rzb += 1; + } + } elseif ($this->users[$i]['team'] == 0) { + //ничья + if ($this->get_chanse(25 / 100 * $chzbs) && $this->users[$i]['battle_exp'] > 2) { + $rzb = rand(0, 1); + } else { + $rzb = 0; + } + } else { + //проиграли + if ($this->users[$i]['level'] >= 1) { + $rzb = 0; + } else { + if ($this->users[$i]['battle_exp'] < 3) { + $rzb = 0; + } elseif ($this->user[$i]['lose'] > $this->user[$i]['win']) { + if ($this->get_chanse(5 / 100 * $chzbs)) { + $rzb = rand(0, 1); + } else { + $rzb = 0; + } + } elseif ($this->get_chanse(10 / 100 * $chzbs)) { + $rzb = rand(0, 1); + } + } + $rzb = 0; + } + + if ($rex95 == 6) { + $rzb = $this->users[$i]['battle_exp'] > 10 ? rand(0, 1) : 0; + } + + if ($rzb > 0 && rand(0, 1000) <= 500) { + $rzb = rand(1, 3); + } + if ($rzb > 0) { + if ($this->stats[$i]['silver'] >= 5) { + $rzb = $rzb * 2; + } + mysql_query('UPDATE `users` SET `money4` = `money4` + "' . $rzb . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + $this->users[$i]['battle_text'] .= ' Вы получили ' . $u->zuby($rzb, + 1) . ' за этот бой.'; + } + } + } + + if ($this->info['priz'] > 0) { + //Призовой хаот + /* + [4754] + 2-3 лвл = 1 жетон + 4-5 лвл = 1 жетона + 6-7 лвл = 2 жетонов + 8-9 лвл = 3 жетонов + В случаи победы (х3) + + */ + + $tmon = [ + 2 => 1, + 3 => 1, + 4 => 1, + 5 => 1, + 6 => 1, + 7 => 2, + 8 => 3, + 9 => 3, + 10 => 5, + 11 => 5, + ]; + $tmon = $tmon[$this->users[$i]['level']]; + // + $tmonc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "' . $this->users[$i]['id'] . '" ) AND `priz` > 0 AND `time_start` > "' . strtotime(date('d.m.Y')) . '"')); + $tmonc = $tmonc[0]; + // + if ($this->users[$i]['team'] == $this->info['team_win']) { + //При выигрыше увеличиваем + if ($tmonc < 1) { + $tmonc = 1; + } elseif ($tmonc > 96) { + $tmonc = 96; + } + $tmon = ($tmon * $tmonc); + } + // + $tmoni = 1; + while ($tmoni <= floor($tmon / 2)) { + $u->addItem(4754, $this->users[$i]['id'], ''); // + $tmoni++; + } + // + $this->users[$i]['battle_text'] .= ' За призовой хаот вы получаете Призовой Жетон (x' . floor($tmon / 2) . '). (Чем больше призовых хаотов вы примите за сутки, тем больше будет выдаваться жетонов при победе! Призовых хаотов посещено сегодня ' . ($tmonc) . '/96 )'; + // + unset($tmon, $tmoni); + } + //Снижение времени Право на подвиг Титул за победу в хаоте + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['team'] == $this->info['team_win']) { + //ТУТ2 + $u->repexp_add($this->users[$i]['id'], 2); //Репутация за поб в хаоте +2 + $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); + if (isset($check['id'])) { + $urcheck = 10000; + if ($this->users[$i]['level'] == 8) { + $urcheck = 3000; + } elseif ($this->users[$i]['level'] == 9) { + $urcheck = 7000; + } elseif ($this->users[$i]['level'] == 10) { + $urcheck = 12000; + } elseif ($this->users[$i]['level'] >= 11) { + $urcheck = 18000; + } + + if ($this->users[$i]['battle_yron'] >= $urcheck) { + mysql_query('UPDATE `eff_users` SET `timeUse` = `timeUse` - 300 WHERE `id_eff`=478 AND `delete` = 0 AND `uid` =' . $this->users[$i]['id'] . ' LIMIT 1'); + $this->users[$i]['battle_text'] .= ' За победу в хаоте и нанесение урона в ' . $urcheck . ' и более вы получаете -5 мин. к праву на подвиг!'; + } + } + mysql_query('UPDATE `users_achiv` SET `vx`= `vx`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); // + + } + //Награда за клан вар + if ($this->info['dungeon'] == 0 && $this->info['type'] == 250 && $this->users[$i]['team'] == $this->info['team_win']) { + mysql_query('UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + if (date('w') == 0 || date('w') == 6 || date('w') == 4) { + $u->repexp_add($this->users[$i]['id'], 25); //Клановые войны(победа) 25 + } + } + //Награда за клан вар + if ($this->info['dungeon'] == 0 && $this->info['type'] == 99 && $this->users[$i]['team'] == $this->info['team_win']) { + if (date('w') == 0 || date('w') == 6 || date('w') == 5) { + $u->repexp_add($this->users[$i]['id'], 10); //Кровавые войны(победа) 10 + } + } + + //Новая выдача на трупожора + if ($this->info['dungeon'] == 0 && $this->info['type'] == 500 && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['no_ip'] != 'trupojor' && $this->users[$i]['bot'] == 0) { + if ($this->users[$i]['level'] > 9) { + $mid = 903093; + } else { + $mid = 89489; + } + $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $mid . '" LIMIT 1')); + + if ($this->users[$i]['battle_yron'] >= 2000) { + $ritem = rand(1, 100); + if ($ritem <= 20) { + $mon['win_itm'] = '4459@1'; + } elseif ($ritem <= 40) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 60) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 80) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } elseif ($this->users[$i]['battle_yron'] >= 1500) { + $ritem = rand(1, 100); + if ($ritem <= 20) { + $mon['win_itm'] = '4459@1'; + } elseif ($ritem <= 40) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 60) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 80) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } elseif ($this->users[$i]['battle_yron'] >= 1000) { + $ritem = rand(1, 100); + if ($ritem <= 25) { + $mon['win_itm'] = '4460@1'; + } elseif ($ritem <= 50) { + $mon['win_itm'] = '4461@1'; + } elseif ($ritem <= 75) { + $mon['win_itm'] = '4462@1'; + } else { + $mon['win_itm'] = '4463@1'; + } + } else { + $mon['win_itm'] = '4392@1'; + $timewait = 0; + } + if ($this->users[$i]['battle_yron'] > 0) { + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '","Право на подвиг","pravonapodvig=1","' . time() . '")'); + } + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")'); + mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'); + $ritem = rand(1, 1000); + if ($ritem == 555) { + $mon['win_itm'] = $mon['win_itm'] . ',5022@1'; + } + + $this->addGlobalItems($mid, $this->users[$i]['id'], $mon['win_itm'], $mon['win_eff'], + $mon['win_ico'], 1, $mon['win_money1'], $mon['win_money2']); //$mon['win_exp'] + + } + + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $u->info['battle_yron'] >= 2000) { + //Реликвия Ангела ang_g + if ($this->users[$i]['team'] == $this->info['team_win']) { + //При выигрыше увеличиваем + $tmoni = 2; + } else { + $tmoni = 1; + } + + $tmon = $tmoni; + $effblago = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `delete` = 0 AND `id_eff`= 414 LIMIT 1')); + if (isset ($effblago['id'])) { + $limitg = 50; + } else { + $limitg = 25; + } + while ($tmoni >= 1) { + if ($u->info['ang_g'] < $limitg) { + $u->addItem(4754, $this->users[$i]['id'], ''); + mysql_query('UPDATE `users` SET `ang_g`=`ang_g`+1 WHERE `id` =' . $this->users[$i]['id']); + } else { + $tmon--; + } + $tmoni--; + } + + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] .= ' За хаот вы получаете Реликвия Ангела (' . $tmon . '). Всего [' . ($u->info['ang_g'] + $tmon) . '/' . $limitg . '] в день. '; + } + unset($tmon, $tmoni, $effblago, $limitg); + } + + + if ($this->info['razdel'] == 5 || $this->info['razdel'] == 4) { + if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) { + //Хэллоуин 4504 + $this->users[$i]['battle_text'] .= ' Вы получаете Тыква (x1).'; + $u->addItem(4504, $this->users[$i]['id'], '|sudba=1'); + } + } + + + //Добавляем воинственность + if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['exp'] >= 1500 + ) { + if ($this->users[$i]['battle_exp'] > 100 * $this->users[$i]['level']) { + $rzbvo = $this->users[$i]['battle_exp'] * 6 / 1000; + + if ($this->users[$i]['level'] == 8) { + if ($rzbvo >= 100) { + $rzbvo = 100; + } + } + if ($this->users[$i]['level'] == 9) { + if ($rzbvo >= 150) { + $rzbvo = 150; + } + } + if ($this->users[$i]['level'] == 10) { + if ($rzbvo >= 200) { + $rzbvo = 200; + } + } + if ($this->users[$i]['level'] == 11) { + if ($rzbvo >= 250) { + $rzbvo = 250; + } + } + if ($this->users[$i]['level'] == 12) { + if ($rzbvo >= 250) { + $rzbvo = 250; + } + } + if ($this->info['type'] != 33) { + $this->users[$i]['battle_text'] .= ' Вы получили ' . $rzbvo . ' воинственности за этот бой.'; + } + mysql_query('UPDATE `rep` SET `rep3` = `rep3` + ' . $rzbvo . ' WHERE `id` = ' . $this->users[$i]['id']); + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")'); + } + } + + if ($this->stats[$i]['hpNow'] >= 1) { + $this->stats[$i]['test_heal'] = mysql_fetch_array(mysql_query('SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->stats[$i]['test_heal'] = $this->stats[$i]['test_heal'][0]; + $this->stats[$i]['test_start'] = mysql_fetch_array(mysql_query('SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); + $this->stats[$i]['test_start'] = $this->stats[$i]['test_start']['hpStart']; + // + $this->stats[$i]['hpNow'] = ($this->stats[$i]['test_start'] - $this->stats[$i]['test_heal']); + if ($this->stats[$i]['hpNow'] < 1) { + $this->stats[$i]['hpNow'] = 1; + } + } else { + $this->stats[$i]['hpNow'] = 0; + } + + unset($this->stats[$i]['test_heal']); + + $this->users[$i]['last_b'] = $this->info['id']; //stats + $this->users[$i]['last_a'] = $act01; + $this->users[$i]['battle'] = -1; //users + $this->users[$i]['battle_yron'] = 0; //stats + + $this->users[$i]['exp'] += $this->users[$i]['battle_exp']; //users + + //Добавляем клан опыт (Все кроме пещер) + + if ($this->users[$i]['clan'] > 0) { + $cpr = 1; + if ($this->info['typeBattle'] == 9) { + $cpr = 25; + } elseif ($this->info['typeBattle'] == 50) { + $cpr = 65; + } + if ($this->stats[$i]['silver'] >= 5) { + $cpr = floor($cpr / 100 * 150); + } + mysql_query('UPDATE `clan` SET `exp` = `exp` + "' . round($this->users[$i]['battle_exp'] / 100 * $cpr) . '" WHERE `id` = "' . $this->users[$i]['clan'] . '" LIMIT 1'); + } + + $this->users[$i]['battle_exp'] = 0; //stats + + if ($this->users[$i]['team'] == $this->info['team_win']) { + mysql_query('UPDATE `rep` SET `n_capitalcity` = `n_capitalcity` + ' . $this->users[$i]['bn_capitalcity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_demonscity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_suncity'] . ' WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + } + + //репутация + $this->users[$i]['bn_demonscity'] = 0; + $this->users[$i]['bn_capitalcity'] = 0; + $this->users[$i]['bn_suncity'] = 0; + //завершение эффектов с финишем + $spe = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `file_finish` != "" AND `v1` = "priem" LIMIT 30'); + while ($ple = mysql_fetch_array($spe)) { + if (file_exists('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php')) { + require('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php'); + } + } + //обновляем данные + mysql_query('DELETE FROM `eff_users` WHERE `v1` = "priem" AND `uid` = "' . $this->users[$i]['id'] . '" LIMIT 50'); + if ($dnr == 1) { + if ($this->users[$i]['room'] == 370) { + $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "dielaba" LIMIT 1')); + $dies = $dies[0]; + mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","dielaba","" + )'); + } else { + $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "die" LIMIT 1')); + $dies = $dies[0]; + mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","die","" + )'); + } + if ($dies < 2 || $this->info['dungeon'] == 15) { + // + $tshbn = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 AND `item_id` = "4910" LIMIT 1')); + if (isset($tshbn['id'])) { + //выбрасываем шайбу + mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $tshbn['id'] . '" LIMIT 1'); + // + mysql_query('INSERT INTO `dungeon_obj` ( + `name`,`dn`,`x`,`y`,`img`,`delete`,`action`,`for_dn`, + `type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date` + ) VALUES ( + "Шайба","' . $this->info['dn_id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","shaiba.png","0","fileact:15/shaiba","0", + "0","120","220","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}" + )'); + // + } + //телепортируем в рестарт (координата 0х0) + $this->users[$i]['x'] = $this->users[$i]['res_x']; + $this->users[$i]['y'] = $this->users[$i]['res_y']; + $this->users[$i]['s'] = $this->users[$i]['res_s']; + $r_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `room` WHERE `id` = "' . (int)$this->users[$i]['room'] . '" LIMIT 1')); + if ($this->users[$i]['room'] == 370) { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в начале лабиринта'; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в начале лабиринта'; + } + } else { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб и находится в комнате "' . $r_n['name'] . '"'; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла и находится в комнате "' . $r_n['name'] . '"'; + } + } + } elseif ($this->info['dungeon'] == 102) { + $nld = ''; + $lab = mysql_fetch_array(mysql_query('SELECT `id`,`users` FROM `laba_now` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); + if ($lab['users'] < 2) { + //Удаляем подземелье + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //удаляем все предметы которые пропадают после выхода из пещеры + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")'); + if ($this->users[$i]['login'] != '') { + if ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; + } + } + } else { + $tinf = mysql_fetch_array(mysql_query('SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1')); + $nld = ''; + if ($tinf['uid'] == $this->users[$i]['id']) { + $tinf = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($tinf['id'])) { + $tinf = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $tinf['id'] . '" LIMIT 1')); + $nld .= ', новым лидером становится "' . $tinf['login'] . '"'; + mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1'); + } + } + $rooms = [ + 374 => 372, //ПТП (Кэпитал сити) + 189 => 188, //Водосток (Кэпитал сити) + 392 => 393, //Шахты (Кэпитал сити) + + 398 => 397, //Шахты (Ангелс сити) + 243 => 395, //Водосток (Ангелс сити) + 360 => 242, //Бездна (Ангелс сити) + + 19 => 293 //Катакомбы + ]; + // $n_rm = $rooms[$this->users[$i]['room']]; + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `room` = "321" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + //удаляем все предметы которые пропадают после выхода из пещеры + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['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 ($this->users[$i]['sex'] == 0) { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погиб без права на воскрешение и покидает подземелье' . $nld; + } else { + $rtxt = '' . $this->users[$i]['login'] . ' трагически погибла без права на воскрешение и покидает подземелье' . $nld; + } + } + if ($rtxt != '') { + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); + } + } + + mysql_query('UPDATE `users` SET `login2` = "" WHERE `battle` = "' . $this->info['id'] . '"'); + mysql_query('UPDATE `users` SET `login2` = "", `money` = "' . $this->users[$i]['money'] . '", `money2` = "' . $this->users[$i]['money2'] . '",`win` = "' . $this->users[$i]['win'] . '",`lose` = "' . $this->users[$i]['lose'] . '",`nich` = "' . $this->users[$i]['nich'] . '",`battle` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + if ($u->info['id'] == $this->users[$i]['id']) { + $u->info['battle_text'] = $this->users[$i]['battle_text']; + } + + mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + if ($this->info['turnir'] == 0) { + //пишем в чат + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "','" . $this->users[$i]['battle_text'] . "','-1','6','0')"); + } else { + mysql_query('UPDATE `turnirs` SET `winner` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['turnir'] . '" LIMIT 1'); + } + //завершаем сам бой + mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + + // Жрать хочет + if ($this->users[$i]['animal'] > 0) { + $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `id` = ' . $this->users[$i]['animal'] . ' AND `pet_in_cage` = 0 AND `delete` = 0 LIMIT 1')); + if (isset($a['id'])) { + if ($a['eda'] < 1) { + $u->send('', $this->users[$i]['room'], $this->users[$i]['city'], '', + $this->users[$i]['login'], '' . $a['name'] . ' нуждается в еде...', + time(), 6, 0, 0, 0, 1); + } + } + } + mysql_query("UPDATE `stats` SET `battle_text` = '',`last_b` = 0 WHERE `id` = " . $this->users[$i]['id']); + mysql_query("UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = " . $this->users[$i]['id']); + $this->saveLogs(); + if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) { + echo ''; + } + } + } else { + sleep(2); + } + mysql_query('UPDATE `battle` SET `testfinish` = 0 WHERE `id` = ' . $this->info['id']); + mysql_query('UNLOCK TABLES'); + } + + //Выдаем предметы + private $ainm = []; + + /** + * @param $uid + * @param int $itemId + * @param string $data + * @return void + */ + private function addGlobalItem($uid, $itemId, $data) + { + $room = $this->users[$this->uids[$uid]]['room']; + $login = $this->users[$this->uids[$uid]]['login']; + $q = "insert into items_local (room, time, item_id, data, tr_login, colvo) values + ($room, unix_timestamp(), $itemId, $data, $login, 1)"; + mysql_query($q); + } + + private function addGlobalItems($bid, $uid, $itm, $eff, $ico, $exp, $cr, $ecr) + { + global $u; + // + //Выпадение дропа на ЦП + if ($bid == 1008) { + //Старый Новый Год + $jit = 0; + $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > unix_timestamp() - 120')); + $iit = floor($iit[0] / 20); + $iit = rand(1, $iit); + while ($jit < $iit) { + if (rand(0, 100) < 50) { + $svtk = array_fill(0, 71, 1000); + array_push($svtk, + 1461, 1462, 1463, 4037, + 4038, 4039, 4040, 911, + 1172, 1173, 2142, 2141, + 2143, 2870, 2144); + + $svtk = $svtk[rand(0, count($svtk) - 1)]; + if ($svtk == 1000) { + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + } + $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200'); + } + $jit++; + } + unset($svtk); + } elseif ($bid == 1007) { + //Хэллоуин, Тыквоголовый CAPITAL CITY + $jit = 0; + $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > unix_timestamp() - 120')); + $iit = floor($iit[0] / 20); + $iit = rand(1, $iit); + while ($jit < $iit) { + if (rand(0, 100) < 50) { + $this->addGlobalItem($uid, 4504, ''); + } + $jit++; + } + } elseif ($bid == 1006) { + //Трупожор CAPITAL CITY + if (rand(0, 100) < 10) { + $this->addGlobalItem($uid, 4451, 'srok=86400'); + } + } elseif ($bid == 1000) { + //Трупожор CAPITAL CITY + $this->addGlobalItem($uid, 4460, 'srok=2592000'); + } elseif ($bid == 1001) { + //Трупожор CAPITAL CITY + $this->addGlobalItem($uid, 4461, 'srok=2592000'); + } elseif ($bid == 1002) { + //Трупожор CAPITAL CITY + $this->addGlobalItem($uid, 4462, 'srok=2592000'); + } elseif ($bid == 1003) { + //Трупожор CAPITAL CITY + $this->addGlobalItem($uid, 4463, 'srok=2592000'); + } elseif ($bid == 1004) { + //Трупожор CAPITAL CITY + $this->addGlobalItem($uid, 4459, 'srok=2592000'); + } + + if ($exp >= 0) { + $this->users[$this->uids[$uid]]['battle_exp'] += round($exp * $this->users[$this->uids[$uid]]['battle_yron'] / $this->stats[$this->uids[$bid]]['hpAll']); + mysql_query('UPDATE `stats` SET `battle_exp` = "' . mysql_real_escape_string($this->users[$this->uids[$uid]]['battle_exp']) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); + } + + if ($cr != '' && $cr > 0) { + if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { + mysql_query('UPDATE `users` SET `money` = (`money` + ' . mysql_real_escape_string($cr) . ') WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили кредиты: " . mysql_real_escape_string($cr) . " кр.','-1','6','0')"); + } + } + // + if ($ecr != '' && $ecr > 0) { + if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { + $this->users[$this->uids[$uid]]['money2'] += $ecr; + $resulttp = mysql_query('UPDATE `users` SET `money2` = (`money2` + ' . mysql_real_escape_string($ecr) . ') WHERE `id` = "' . $this->users[$this->uids[$uid]]['id'] . '" LIMIT 1'); + if (!$resulttp) { + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Трупожор был пуст!!!','-1','6','0')"); + $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], + '"System.battle>": (В бою трупожор), ПУСТ!!! ', + time(), + $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); + } else { + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили Евро-кредиты: " . mysql_real_escape_string($ecr) . " екр.','-1','6','0')"); + $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], + '"System.battle": Персонаж получил ' . $ecr . ' ЕКР (В бою трупожор), сейчас: ' . $this->users[$this->uids[$uid]]['money2'] . ' ЕКР', + time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); + } + } + } + // + if ($ico != '') { + /* + 0(тип, 1 - значок, 2 - подвиг)@ + 1(время в минутах)@ + 2(название картинки)@ + 3(название)@ + 4(требует остаться в живых 0 или 1, либо игрок умер -1)@ + 5(требует набить с ботам урона в % Например 0.001)@ + 6(действия например: add_s1=5|add_hpAll=50)@ + 7(Требует другой значок, название картинки)@ + 8(плюсует значок 0 или 1)@ + 9(удаляем прошлый значок 0 or 1) + */ + $i = 0; + $txt = ''; + $ico = explode('#', $ico); + while ($i < count($ico)) { + $ico_e = explode('@', $ico[$i]); + if (isset($ico_e[3])) { + // + $add = 1; + if ($ico_e[4] == 1 && floor($this->stats[$this->uids[$uid]]['hpNow']) < 1) { + $add = 0; + } + if ($add == 1) { + $ins = false; + if ($ico_e[8] == 0) { + $ins = true; + if ($ico_e[9] == 1) { + mysql_query('DELETE FROM `users_ico` WHERE `uid` = ' . (int)$uid . ' AND `img` = ' . mysql_real_escape_string($ico_e[2])); + } + } else { + $old_ico = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_ico` WHERE `uid` = ' . (int)$uid . ' AND (`endTime` > unix_timestamp() OR `endTime` = 0) AND `img` = ' . mysql_real_escape_string($ico_e[2]) . ' LIMIT 1')); + if (!isset($old_ico['id'])) { + $ins = true; + } else { + if ($old_ico['id'] > 0) { + $txt .= ', "' . $ico_e[3] . ' (Обновление)"'; + mysql_query('UPDATE `users_ico` SET `x` = `x` + 1,`endTime` = ' . (time() + $ico_e[1] * 60) . ' WHERE `id` = ' . $old_ico['id']); + } else { + $ins = true; + } + } + unset($old_ico); + } + + if ($ins) { + if ($ico_e[9] == 1) { + mysql_query('DELETE FROM `users_ico` WHERE `uid` = ' . mysql_real_escape_string($uid) . ' AND `img` = ' . mysql_real_escape_string($ico_e[2])); + } + mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`type`,`bonus`) VALUES ( + ' . mysql_real_escape_string($uid) . ', + unix_timestamp(), + ' . mysql_real_escape_string($ico_e[3]) . ', + ' . mysql_real_escape_string($ico_e[2]) . ', + ' . mysql_real_escape_string(time() + $ico_e[1] * 60) . ', + ' . mysql_real_escape_string($ico_e[0]) . ', + ' . mysql_real_escape_string($ico_e[6]) . ' + )'); + $txt .= ', "' . $ico_e[3] . '"'; + } + } + } + $i++; + } + if ($txt != '') { + $txt = ltrim($txt, ', '); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы совершили подвиг: " . mysql_real_escape_string($txt) . "','-1','6','0')"); + } + } + // + if ($itm != '') { + $i = 0; + $txt = ''; + $itm = explode(',', $itm); + while ($i < count($itm)) { + $itm_e = explode('@', $itm[$i]); + if ($itm_e[0] > 0) { + $j = 0; + while ($j < $itm_e[1]) { + $u->addItem($itm_e[0], $uid, '|' . $itm_e[2]); + $j++; + } + if (!isset($this->ainm[$itm_e[0]])) { + $this->ainm[$itm_e[0]] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = ' . mysql_real_escape_string($itm_e[0]))); + } + if (isset($this->ainm[$itm_e[0]]['id'])) { + //Добавляем текст о добавлении предмета + $txt .= ', ' . $this->ainm[$itm_e[0]]['name'] . ''; + if ($itm_e[1] > 1) { + $txt .= ' (x' . $itm_e[1] . ')'; + } + } + } + $i++; + } + if ($txt != '') { + $txt = ltrim($txt, ', '); + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','Вы получили предметы: " . mysql_real_escape_string($txt) . "','-1','6','0')"); + } + } + } + + /** Удар + * @return void + */ + private function addNewAtack() + { + global $u; + if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) { + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) { + $us = $this->stats[$this->uids[$u->info['id']]]; + $i = 1; + $no = 0; + + while ($i <= $us['zona']) { + if ($this->uAtc['a'][$i] == 0) { + $no = 1; + } + $i++; + } + + if ($this->uAtc['b'] == 0) { + $no = 1; + } + + if ($no == 0) { + //наносим удар + if ($u->info['enemy'] > 0) { + if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { + if ( + $this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && + $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1 + ) { + //наносим новый удар + $a = $this->uAtc['a'][1] . + $this->uAtc['a'][2] . + $this->uAtc['a'][3] . + $this->uAtc['a'][4] . + $this->uAtc['a'][5]; + $b = $this->uAtc['b']; + mysql_query('DELETE FROM `battle_act` WHERE `battle` = ' . $this->info['id'] . ' AND ((`uid2` = ' . $u->info['id'] . ' AND `uid1` = ' . $u->info['enemy'] . ') OR (`uid1` = ' . $u->info['id'] . ' AND `uid2` = ' . $u->info['enemy'] . ')) LIMIT 2'); + $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES (' . $this->info['id'] . ',' . time() . ',' . $u->info['id'] . ',' . $u->info['enemy'] . ',' . $a . ',' . $b . ')'); + if (!$d) { + $this->e = 'Не удалось нанести удар по противнику...'; + } else { + $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); + } + } + } else { + //отвечаем на удар противника + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { + if (isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) { + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . $this->uAtc['a'][2] . $this->uAtc['a'][3] . $this->uAtc['a'][4] . $this->uAtc['a'][5]; + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; + $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); + } + } + } + } + } else { + $this->e = 'Выберите зоны удара и блока'; + } + } else { + $this->e = 'Для вас поединок закончен, ожидайте пока завершат другие...'; + } + } + } + + + /** Запускаем магические предметы, если в них что-то встроено. + * Ещё один дебильный файл с инклюдами. Неиспользуемые переменные могут передаваться в инклюды. + *
    Файлы: /class/priems/* + * @param int $uid1 + * @param int $uid2 + * @param int $end если > 0, то подключается *.end.php, иначе *.php + * @return void + */ + private function magicItems($uid1, $uid2, $end) + { + if (!isset($this->stats[$this->uids[$uid1]])) { + return; + } + foreach ($this->stats[$this->uids[$uid1]]['items'] as $item) { + if (!$item['id'] || !$this->lookStats($item['data'])['bm_a1']) { + continue; + } + $file = $this->lookStats($item['data'])['bm_a1'] . $end > 0 ? '.end.php' : '.php'; + if (file_exists('../../_incl_data/class/priems/' . $file)) { + require_once '../../_incl_data/class/priems/' . $file; + } + } + } + + private $rehodeff = []; + + //Поглощение урона + private $poglast = []; + + public function testPogB($uid, $yr, $pliid, $test = 0) + { + $yr2 = $yr; + + $checktuman = mysql_fetch_array(mysql_query('SELECT id FROM `eff_users` WHERE `uid` = ' . $uid . ' + AND v2 in (273, 286, 287, 288) + AND `delete` =0 LIMIT 1')); //проверка на туманный образ + //if ( !isset($checktuman['id'])) + if ($yr > 0 && !isset($checktuman['id'])) { + global $priem; + $i = 0; + while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { + $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; + if ($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] == $pliid || $test == 1) { + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], + 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + $dt3 = $this->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + + $dt3['add_pog2p'] = min(floor($j['y'] / $yr2 * 100), $dt3['add_pog2p']); + + if (isset($dt3['add_pog2mp'])) { + if ((round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) > $this->stats[$this->uids[$uid]]['mpNow']) { + //не хватило маны, считаем сколько хватит % от поглощенного урона + $j['yhj'] = $this->stats[$this->uids[$uid]]['mpNow'] / (round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) * 100; + $j['yhj'] = floor($j['yhj']); //Сколько % мы можем поглотить + $dt3['add_pog2p'] = floor($dt3['add_pog2p'] / 100 * $j['yhj']); + } + if ($test == 1) { + $priem->minMana($uid, round(round($yr2 / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); + } + } + if (!isset($this->poglast[$uid])) { + $this->poglast[$uid] = 0; + } + $this->poglast[$uid] += $yr2; + if ($test == 1) { + $j['y'] -= round($this->poglast[$uid] / 100 * $dt3['add_pog2p']); + $priem->minMana($uid, + round(round($this->poglast[$uid] / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); + } + if (isset($dt3['add_pog2p'])) { + $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); + } + if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { + $dt2 = $this->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { + //удаляем прием + //Добавляем в лог + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); + $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], + $this->users[$this->uids[$uid]], 4, $uid); + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; + } + unset($dt2); + $j['y'] = 0; + } + $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; + if (isset($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'])) { + $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', + 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); + mysql_query('UPDATE `eff_users` SET `data` = ' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . ' WHERE `id` = ' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id']); + } + + if ($j['y'] - $this->poglast[$uid] + $yr2 < 0) { + $yr -= $yr + ($j['y'] - $this->poglast[$uid] + $yr2); + $yr2 = $yr; + $i = count($this->stats[$this->uids[$uid]]['set_pog2']) + 1; + } + } + $i++; + } + } + return $yr2; + } + + /** Тестируем удары и т.д */ + private function newRazmen($id) + { + $at = [1 => [0], 2 => [0]]; + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->atacks[$id]['out1'] == 0) { + $at[1] = $this->usersTestAtack($id, $uid1, $uid2); + } + if ($this->atacks[$id]['out2'] == 0) { + $at[2] = $this->usersTestAtack($id, $uid2, $uid1); + } + + return $at; + } + + /** Игрок1 наносит удар Игрок2 (сломано?) */ + private function usersTestAtack($id, $uid1, $uid2) + { + $r = []; + $block = [0, 0, 0, 0, 0, 0,]; + + //Проверка блоков + $i = 1; + if ($uid1 == $this->atacks[$id]['uid1']) { + $a = 2; + $j = $this->atacks[$id]['b2']; + $atack = [ + 0, + $this->atacks[$id]['a1'][0], + $this->atacks[$id]['a1'][1], + $this->atacks[$id]['a1'][2], + $this->atacks[$id]['a1'][3], + $this->atacks[$id]['a1'][4], + ]; + } elseif ($uid2 == $this->atacks[$id]['uid1']) { + $a = 1; + $j = $this->atacks[$id]['b1']; + $atack = [ + 0, + $this->atacks[$id]['a2'][0], + $this->atacks[$id]['a2'][1], + $this->atacks[$id]['a2'][2], + $this->atacks[$id]['a2'][3], + $this->atacks[$id]['a2'][4], + ]; + } + if ($this->atacks[$id]['out' . $a] == 0) { + while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { + //echo '{'.$j.'}'; + $block[$j] = 1; + $j++; + if ($j > 5 || $j < 1) { + $j = 1; + } + $i++; + } + } + //Проверка ударов + $i = 1; + while ($i <= $this->stats[$this->uids[$uid1]]['zona']) { + if (!isset($atack[$i]) || $atack[$i] == 0) { + $atack[$i] = rand(1, 5); + } + if ($atack[$i] > 0) { + if ($block[$atack[$i]] == 1) { + //удар был заблокирован + // КУДА БИЛ , ТИП УДАРА + $r['atack'][] = [$atack[$i], 3, 0]; + } else { + //Удар прошел + // КУДА БИЛ , ТИП УДАРА + $r['atack'][] = [$atack[$i], 1, 0]; + } + } + $i++; + } + return $r; + } + + //Проверка зоны и блока + + /** + * @param $id + * @param $uid1 + * @param $uid2 + * @param $atack + * @return bool (bool) удар был заблокирован + */ + public function testRazmenblock1($id, $uid1, $uid2, $atack) + { + $block = []; + //Проверка блоков + $i = 1; + $j = 0; + if ($uid1 == $this->atacks[$id]['uid1']) { + $j = $this->atacks[$id]['b2']; + } elseif ($uid2 == $this->atacks[$id]['uid1']) { + $j = $this->atacks[$id]['b1']; + } + if ($this->atacks[$id]['out2'] == 0) { + while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { + //echo '{'.$j.'}'; + $block[$j] = 1; + $j++; + if ($j > 5 || $j < 1) { + $j = 1; + } + $i++; + } + } + //Проверка ударов + return $atack > 0 && $block[$atack] == 1; + } + + //Первичный расчет мф. эффектов (пример) + /** + * private function firstRazmen($id, $at) + * { + * $uid1 = $this->atacks[$id]['uid1']; + * $uid2 = $this->atacks[$id]['uid2']; + * + * $i = 1; + * while ($i <= 2) { + * if ($i == 1) { + * $u1 = $uid1; + * $u2 = $uid2; + * } else { + * $u1 = $uid2; + * $u2 = $uid1; + * } + * + * //Расчет уворота Цели от Атакующего + * $i++; + * } + * return $at; + * } + */ + + /** Для yhod_user. + * @var int + */ + private $import_user = 0; + + /** Проверка ухода удара в игрока */ + private function yhod_user($uid1, $uid2, $type) + { + // 1 - кто бьет . 2 - в кого бьют . тип + //Удал летит прямо в противника + if ($this->import_user == 0) { + $r = $uid1; + $rand_user = false; + if ($type == 2) { + //Случайный персонаж из своей команды (в том числе игрок) + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type == 4) { + //Случайный персонаж, любой + $i = 0; + while ($i < count($this->users)) { + //if( $this->users[$i]['team'] == $this->users[$this->uids[$uid1]]['team'] ) { + $rand_user[] = $this->users[$i]['id']; + //} + $i++; + } + } elseif ($type == 5) { + //Случайный персонаж, любой (кроме игрока) + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team'] && $uid2 != $this->users[$i]['id']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type == 6) { + //Случайный персонаж из команды противника + $i = 0; + while ($i < count($this->users)) { + if ($this->users[$i]['team'] != $this->users[$this->uids[$uid2]]['team']) { + $rand_user[] = $this->users[$i]['id']; + } + $i++; + } + } elseif ($type > 100) { + //Удар идет в конкретного игрока + if (!isset($this->users[$this->uids[$type]]) || $this->users[$this->uids[$type]]['id'] != $type) { + $r = $uid2; + } else { + $r = $type; + } + } + if (!empty($rand_user)) { + $r = $rand_user[rand(0, (count($rand_user) - 1))]; + } + $this->import_user = $r; + } else { + $r = $this->import_user; + } + return $r; + } + + /** Расчет уворота игроков */ + private function mf1Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + if ($pat) { + $pat = $at; + $at = $pat['p']; + } else { + $pat = false; + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + + //Расчет уворота Цели (u2) от Атакующего (u1) + $j = 0; + $wp01 = 3; + $k01 = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp01 = 3; + $k01 = 1; + } else { + //Правая рука + if ( + isset($this->stats[$this->uids[$u1]]['wp14id']) && + $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13 + ) { + $wp01 = 14; + } else { + $wp01 = 3; + } + $k01 = 0; + } + $witm_type01 = 0; + $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; + $witm_data01 = $this->lookStats($witm01['data']); + if ($at[$a]['atack'][$j][2] == $v) { + $tyv = $this->mfs(2, [ + 'u1' => $u1, + 'u2' => $u2, + 'mf' => $this->stats[$this->uids[$u2]]['m4'], + 'amf' => (int)$this->stats[$this->uids[$u2]]['m15'], + 'smf' => ($this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5']), + 'asmf' => $this->stats[$this->uids[$u1]]['m21'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']); + if ($tyv == 1 && $this->atacks[$id]['out' . $b] == 0) { + //увернулся, гад :) + $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); + if (!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] <= 0) { + $at[$a]['atack'][$j][1] = 2; + } else { + $this->stats[$this->uids[$u1]]['nopryh']--; + $this->stats[$this->uids[$u1]]['nopryh_act']++; + } + } + } + $j++; + } + $i++; + } + unset($witm01, $witm_type01, $wp01, $k01); + + if ($pat) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + /** Расчет крита игроков */ + private function mf2Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + global $u; + + if ($pat) { + $pat = $at; + $at = $pat['p']; + } else { + $pat = false; + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $u1 = $uid2; + $u2 = $uid1; + } + + //Расчет крита Атакующего (u1) по Цели (u2) + $j = 0; + $wp01 = 0; + $k01 = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j <= 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp01 = 3; + $k01 = 1; + } else { + //Правая рука + if ( + isset($this->stats[$this->uids[$u1]]['wp14id']) && + $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13 + ) { + $wp01 = 14; + } else { + $wp01 = 3; + } + $k01 = 0; + } + $witm_type01 = 0; + $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; + $witm_data01 = $this->lookStats($witm01['data']); + if ($this->mfs(1, [ + 'u1' => $u1, + 'u2' => $u2, + 'mf' => $this->stats[$this->uids[$u1]]['m1'] + $witm_data01['sv_m1'], + 'amf' => $this->stats[$this->uids[$u1]]['m14'], + 'smf' => $this->stats[$this->uids[$u2]]['m2'], + 'aamf1' => (int)$this->stats[$this->uids[$u2]]['enemy_am1'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { + //кританул, гад :) + if ($at[$a]['atack'][$j][1] == 3) { + //в блок + $at[$a]['atack'][$j][1] = 4; //Тут тест + } elseif ($at[$a]['atack'][$j][1] != 2 && $at[$a]['atack'][$j][1] != 6 && $at[$a]['atack'][$j][1] != 7 && $at[$a]['atack'][$j][1] != 8) { + //обычный крит + $at[$a]['atack'][$j][1] = 5; + } else { + $at[$a]['atack'][$j][1] = 1; + } + } + $j++; + } + $i++; + } + unset($witm01, $witm_type01, $k01, $wp01); + + if ($pat) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + /**Расчет парирования игроков*/ + private function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + if ($pat) { + $pat = $at; + $at = $pat['p']; + } else { + $pat = false; + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + + //Расчет парирования Цели (u2) от Атакующего (u1) + //print_r( $at[$i] ); + $j = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ((!isset($this->stats[$this->uids[$u2]]['no_pr1']) || $this->stats[$this->uids[$u2]]['no_pr1'] == 0) && $at[$a]['atack'][$j][2] == $v) { + if ($this->mfs(3, [ + 'u1' => $u1, + 'u2' => $u2, + '1' => $this->stats[$this->uids[$u2]]['m7'], + '2' => $this->stats[$this->uids[$u1]]['m7'], + ], $this->users[$this->uids[$u1]]['level'], + $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { + //Парировал, гад :) + $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); + if ((!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0) && $this->stats[$this->uids[$u1]]['nopryh_act'] < 1) { + $at[$a]['atack'][$j][1] = 6; + $this->stats[$this->uids[$u1]]['nopryh']--; + $this->stats[$this->uids[$u1]]['nopryh_act']++; + } + } + } + $j++; + } + $i++; + } + + if ($pat) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + /**Расчет блока щитом игроков (скорее всего сломано) */ + private function mf4Razmen($id, $at, $v, $pat = false, $rjd = 0) + { + if ($pat) { + $pat = $at; + $at = $pat['p']; + } else { + $pat = false; + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) { + //Расчет блока щитом Цели (u2) от Атакующего (u1) + //print_r( $at[$i] ); + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($at[$a]['atack'][$j][2] == $v && $this->mfs(5, + ($this->stats[$this->uids[$u2]]['m8'] / 2 + $this->stats[$this->uids[$u2]]['m18']), + $this->users[$this->uids[$u1]]['level'], + $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { + //блокировал щитом, гад :) + $at[$a]['atack'][$j][1] = 7; + } + $j++; + } + } + $i++; + } + + if ($pat) { + $pat['p'] = $at; + $at = $pat; + } + + return $at; + } + + /**Расчет контрудара игроков*/ + private function mf5Razmen($id, $at, $v, $rjd = 0) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + + //Расчет контрудара Цели (u2) по Атакующему (u1) + $j = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($at[$a]['atack'][$j][2] == $v && $at[$a]['atack'][$j][1] == 2 && $this->mfs(6, [ + 'u1' => $u1, + 'u2' => $u2, + 'a' => $this->stats[$this->uids[$u2]]['m6'], + 'b' => $this->stats[$this->uids[$u1]]['m6'], + ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { + //контрудар, гад :) + $at[$a]['atack'][$j][1] = 8; + $rnd_a = rand(1, 5); + $rjd = count($at[$b]['atack']); + if (!$this->testRazmenblock1($id, $u2, $u1, $rnd_a)) { + $at[$b]['atack'][] = [$rnd_a, 1, 0, 1]; // 3 , 0 , 1 + } else { + $at[$b]['atack'][] = [$rnd_a, 3, 0, 1]; // 3 , 0 , 1 + } + $at = $this->contrRestart($id, $at, 1, $rjd); + } + $j++; + } + $i++; + } + return $at; + } + + //Выделение из лог текста + public function addlt($a, $id, $s, $rnd = null) + { + global $log_text; + if (is_null($rnd)) { + $rnd = rand(0, (count($log_text[$s][$id]) - 1)); + } + return '{' . $a . 'x' . $id . 'x' . $rnd . '}'; + } + + private function addNewStatDb($id) + { + mysql_query('INSERT INTO `battle_stat` + ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( + ' . $this->info['id'] . ', + ' . $id['uid1'] . ', + ' . $id['uid2'] . ', + ' . $id['time'] . ', + ' . $id['type'] . ', + ' . $id['a'] . ', + ' . $id['b'] . ', + ' . $id['ma'] . ', + ' . $id['mb'] . ', + ' . $id['type_a'] . ', + ' . $id['type_b'] . ', + ' . $id['yrn'] . ', + ' . $id['yrn_krit'] . ', + ' . $id['tm1'] . ', + ' . $id['tm2'] . ' + )'); + } + + //Добавляем статистику + public function addNewStat($stat) + { + if (isset($stat[1])) { + $this->addNewStatDb($stat[1]); + } + if (isset($stat[2])) { + $this->addNewStatDb($stat[2]); + } + } + + //Добавляем размены в лог + private function addlogRazmen($id, $at) + { + $this->hodID++; + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $dies = [ + 1 => 0, + 2 => 0, + ]; + + //массив для статистики + $stat = [ + 1 => [ + 'uid1' => 0, + 'uid2' => 0, + 'time' => time(), + 'type' => 0, + 'a' => '00000', + 'b' => '0', + 'type_a' => '', + 'type_b' => '0', + 'yrn' => 0, + 'yrn_krit' => 0, + 'ma' => 0, + 'mb' => 0, + 'tm1' => 0, + 'tm2' => 0, + ], + 2 => [ + 'uid1' => 0, + 'uid2' => 0, + 'time' => time(), + 'type' => 0, + 'a' => '00000', + 'b' => '0', + 'type_a' => '', + 'type_b' => '0', + 'yrn' => 0, + 'yrn_krit' => 0, + 'ma' => 0, + 'mb' => 0, + 'tm1' => 0, + 'tm2' => 0, + ], + ]; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + + if ($this->stats[$this->uids[$u2]]['yhod'] > 0) { + $u2 = $this->yhod_user($u1, $u2, $this->stats[$this->uids[$u2]]['yhod']); + } + + $s1 = $this->users[$this->uids[$u1]]['sex']; + $s2 = $this->users[$this->uids[$u2]]['sex']; + + $stat[$a]['uid1'] = $u1; + $stat[$a]['uid2'] = $u2; + $stat[$a]['ma'] = $this->stats[$this->uids[$u1]]['zona']; + $stat[$a]['mb'] = $this->stats[$this->uids[$u1]]['zonb']; + $stat[$a]['tm1'] = $this->users[$this->uids[$u1]]['team']; + $stat[$a]['tm2'] = $this->users[$this->uids[$u2]]['team']; + $stat[$a]['a'] = $this->atacks[$id]['a' . $a]; + $stat[$a]['b'] = $this->atacks[$id]['b' . $a]; + + $vLog = + 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . + '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . + '||bl1=' . $this->atacks[$id]['b' . $a] . + '||bl2=' . $this->atacks[$id]['b' . $b] . + '||time1=' . $this->atacks[$id]['time'] . + '||time2=' . $this->atacks[$id]['time2'] . + '||s' . $a . '=' . $s1 . + '||s' . $b . '=' . $s2 . + '||t2=' . $this->users[$this->uids[$u2]]['team'] . + '||t1=' . $this->users[$this->uids[$u1]]['team'] . + '||login1=' . $this->users[$this->uids[$u1]]['login2'] . + '||login2=' . $this->users[$this->uids[$u2]]['login2']; + + $mas = [ + 'text' => '', + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'vars' => $vLog, + 'type' => 1, + ]; + + if (!isset($at[$a]['atack'])) { //ТУТ тест пропуска + if ($this->atacks[$id]['tpo' . $a] == 2) { + $mas['text'] .= '{u1} потратил свой ход на магию.'; + } else { + // + if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + mysql_query('INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES ( + ' . $this->info['id'] . ',' . $u1 . ',' . $u2 . ', unix_timestamp(), 1)'); + } + // + if (isset($u1)) { + $mas['text'] .= '{u1} пропустил свой ход.'; + //Проверка сброс туманок + mysql_query('update eff_users set `delete` = unix_timestamp() where `uid` = ' . $u1 . ' AND `delete` = 0 AND `v1` = "priem" AND v2 in (288, 287, 286, 273) LIMIT 1'); + } + } + $mas['text'] = '{tm1} ' . $mas['text']; + $this->add_log($mas); + } else { + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + // + $mas['text'] = ''; + // + $wt = [ + 21 => 4, + 22 => 5, + 20 => 2, + 28 => 2, + 19 => 3, + 18 => 1, + 26 => 22, + ]; + $par = [ + 'zona' => '{zn2_' . $at[$a]['atack'][$j][0] . '} ', + 'kyda' => $this->lg_zon[$at[$a]['atack'][$j][0]][rand(0, + (count($this->lg_zon[$at[$a]['atack'][$j][0]]) - 1))], + 'chem' => $this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]][rand(0, + (count($this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]]) - 1))], + ]; + // + $this->atacks[$id]['uid_' . $u1 . '_t' . $at[$a]['atack'][$j][1]]++; + + // + if ($at[$a]['atack'][$j][1] == 1 || $at[$a]['atack'][$j][1] == 5) { + //u1 ударил обычным ударом u2 + //u1 ударил критическим ударом u2 + $mas['text'] .= + $par['zona'] . '{u2} ' . + $this->addlt($b, 1, $s2) . + $this->addlt($b, 2, $s2) . + $this->addlt($a, 3, $s1) . ' {u1} ' . + $this->addlt($a, 4, $s1) . + $this->addlt($a, 5, $s1) . + $this->addlt($a, 6, $s1) . ' ' . + $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 2) { + //u2 увернулся от u1 + $mas['text'] .= + $par['zona'] . '{u1} ' . + $this->addlt($a, 8, $s1) . + $this->addlt($a, 9, $s1) . ' {u2} ' . + $this->addlt($b, 11, $s2) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 3) { + //u2 заблокировал удар u1 + $mas['text'] .= $par['zona'] . '{u1} ' . + $this->addlt($a, 8, $s1) . + $this->addlt($a, 9, $s1) . ' {u2} ' . + $this->addlt($b, 10, $s2) . ' ' . + $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 4) { + //u1 пробил блок u2 критом + if (isset($at[$a]['atack'][$j]['yron']['t'])) { + $mas['text'] .= + $par['zona'] . '{u2} ' . + $this->addlt($b, 1, $s2) . + $this->addlt($b, 2, $s2) . + $this->addlt($a, 3, $s1) . ' {u1} ' . + $this->addlt($a, 4, $s1) . + $this->addlt($a, 5, $s1) . ', пробив блок, ' . + $this->addlt($a, 6, $s1) . ' ' . + $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } + } elseif ($at[$a]['atack'][$j][1] == 6) { + //u2 парировал удар u1 + $mas['text'] .= + $par['zona'] . '{u1} ' . + $this->addlt($a, 8, $s1) . + $this->addlt($a, 9, $s1) . ' {u2} неожиданно парировал ' . + $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 7) { + //u2 блокировал щитом удар u1 + $mas['text'] .= + $par['zona'] . '{u1} ' . + $this->addlt($a, 8, $s1) . + $this->addlt($a, 9, $s1) . ' {u2}, воспользовавшись своим щитом, ' . + $this->addlt($b, 10, $s2) . ' ' . + $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . '. '; + } elseif ($at[$a]['atack'][$j][1] == 8) { + //u2 увернулся от удара u1 и нанес по нему контрудар + $mas['text'] .= + $par['zona'] . '{u1} ' . + $this->addlt($a, 8, $s1) . + $this->addlt($a, 9, $s1) . ' {u2} ' . + $this->addlt($b, 11, $s2) . ' ' . + $par['chem'] . ' ' . $par['kyda'] . ' и нанес контрудар. '; + } + + $stat[$a]['type_a'] .= '' . $at[$a]['atack'][$j][1]; + if ( + (!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && + isset($at[$a]['atack'][$j]['yron']['travma']) && + $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && + floor($at[$a]['atack'][$j]['yron']['hp']) <= 0 + ) { + $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = ' . $u2 . ' AND `delete` = 0 ORDER BY `v1` DESC LIMIT 1')); + if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { + //263 + if (isset($tr_pl['id'])) { + $at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3); + } + $tr_pl2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = ' . $u2 . ' AND `delete` = 0 AND `name` LIKE "%Защита от травм%" limit 1')); + if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) { + $mas['text'] = rtrim($mas['text'], '. '); + $mas['text'] .= ', нанеся противнику '; + if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { + $mas['text'] .= 'Легкую'; + $this->addTravm($u2, 1, rand(3, 5)); + } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) { + $mas['text'] .= 'Среднюю'; + $this->addTravm($u2, 2, rand(3, 5)); + } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) { + $mas['text'] .= 'Тяжелую'; + $this->addTravm($u2, 3, rand(3, 5)); + } + $mas['text'] .= ' травму. '; + } + } + unset($tr_pl); + } + if ($at[$a]['atack'][$j]['yron']['pb'] == 1 && isset($at[$a]['atack'][$j]['yron']['hp'])) { + $mas['text'] = rtrim($mas['text'], '. '); + $mas['text'] .= ' пробив броню. '; + } + if ($at[$a]['atack'][$j][3] == 1) { + $mas['text'] .= '(контрудар) '; + } + if (isset($at[$a]['atack'][$j]['yron'])) { + if ($at[$a]['atack'][$j]['yron']['w'] == 3) { + $mas['textWP'] = '(правая рука)'; + } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { + $mas['textWP'] = '(левая рука)'; + } else { + $mas['textWP'] = '(непонятно чем)'; + } + if ( + ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 || $at[$a]['atack'][$j][1] == 1) && + $at[$a]['atack'][$j]['yron']['y'] < 1 + ) { + $at[$a]['atack'][$j]['yron']['r'] = '--'; + } + if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { + $stat[$a]['yrn_krit'] += -$at[$a]['atack'][$j]['yron']['r']; + $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; + } else { + $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; + } + $stat[$a]['yrn'] += -$at[$a]['atack'][$j]['yron']['r']; + } + if (isset($at[$a]['atack'][$j]['yron']['hp'])) { + if ($this->users[$this->uids[$u2]]['align'] == 9) { + $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hp'] / ($at[$a]['atack'][$j]['yron']['hpAll'] / 100); + $at[$a]['atack'][$j]['yron']['hpAll'] = '100%'; + } + $mas['text'] .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; + } + // + if ($mas['text'] != '') { + $mas['text'] = '{tm1} ' . $mas['text']; + } + + if (count($at[$a]['atack'][$j]['yron']['plog']) > 0) { + $il = 0; + while ($il <= count($at[$a]['atack'][$j]['yron']['plog'])) { + if (isset($at[$a]['atack'][$j]['yron']['plog'][$il])) { + eval($at[$a]['atack'][$j]['yron']['plog'][$il]); + } + $il++; + } + } + $this->add_log($mas); + $j++; + } + } + $i++; + } + + //Добавляем статистику + записываем в баттл_юзерс НР игроков + $this->addNewStat($stat); + + //Вывод в лог смерти персонажа + if (floor($this->stats[$this->uids[$u1]]['hpNow']) < 1) { + $dies[1] = 1; + } + if (floor($this->stats[$this->uids[$u2]]['hpNow']) < 1) { + $dies[2] = 1; + } + if ($dies[1] > 0 || $dies[2] > 0) { + $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; + $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; + + if ($this->info['typeBattle'] == 99) { + if ($btlstatus[0] == 0) { + //Кровавые бои обычные + $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; + if ($this->info['razdel'] == 5) { + //не хаот + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } else { + //хаот + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + } elseif ($btlstatus[0] == 25) { + //Кровавая битва + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 50) { + //Кровавая резня + $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 75) { + //Кровавая сеча + $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 100) { + //Кровавое побоище + $rtngwin = [6, 12, 24, 48, 98, 196, 392, 784, 1568]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 150) { + //Судный день + $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } + } else { + if ($btlstatus[0] == 0) { + //Обычный поединок + if ($this->info['razdel'] != 5) { + //хаот + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + } elseif ($btlstatus[0] == 25) { + //великая битва + $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 50) { + //величайшая битва + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 75) { + //историческая битва сеча + $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 100) { + //эпохальная битва + $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } elseif ($btlstatus[0] == 150) { + //судный день + $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; + $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; + } + } + + if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) { + //Пещерные бои не считаются и Изломы тоже, ну и Турниры + $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) { + //Клановая война + $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; + $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256]; + } + + if ($dies[1] == 1) { + if ($this->info['dn_id'] > 0) { + //не дается репутация + } else { + if ($this->users[$this->uids[$u1]]['level'] >= 4) { + $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; + $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; + } + } + //Персонаж 1 погиб от рук персонаж 2 + $this->spaCheck($this->users[$this->uids[$u1]]['id']); + } + if ($dies[2] == 1) { + if ($this->info['dn_id'] > 0) { + //не дается репутация + } else { + if ($this->users[$this->uids[$u1]]['level'] >= 4) { + $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; + $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; + } + } + //Персонаж 2 погиб от рук персонаж 1 + $this->spaCheck($this->stats[$this->uids[$u2]]['id']); + } + //Записываем рейтинг + // + if ( + $this->info['type'] != 564 && + $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && + $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && + $this->info['dn_id'] == 0 && + $this->info['izlom'] == 0 + ) { + // + if ($this->users[$this->uids[$u2]]['bot'] == 0) { + mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( + ' . $u1 . ', + unix_timestamp(), + ' . $rtng1 . ', + ' . $this->users[$this->uids[$u1]]['align'] . ', + ' . $this->users[$this->uids[$u1]]['clan'] . ') + '); + } + unset($rtng); + if ($this->users[$this->uids[$u1]]['bot'] == 0) { + mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( + ' . $u2 . ', + unix_timestamp(), + ' . $rtng2 . ', + ' . $this->users[$this->uids[$u2]]['align'] . ', + ' . $this->users[$this->uids[$u2]]['clan'] . ') + '); + } + } + unset($rtng1, $rtng2); + } + } + + //Добавляем в лог действия приема + public function priemAddLog($id, $a, $b, $u1, $u2, $prm, $text, $hodID, $tm1 = 0, $tm2 = 0) + { + if ($tm1 === 0) { + if (isset($this->atacks[$id])) { + $tm1 = $this->atacks[$id]['time']; + } else { + $tm1 = time(); + } + } + if ($tm2 === 0) { + if (isset($this->atacks[$id])) { + $tm2 = $this->atacks[$id]['time2']; + } else { + $tm2 = time(); + } + } + $vLog = + 'prm=' . $prm . + '||at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . + '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . + '||bl1=' . $this->atacks[$id]['b' . $a] . + '||bl2=' . $this->atacks[$id]['b' . $b] . + '||time1=' . $tm1 . + '||time2=' . $tm2 . + '||s' . $a . '=' . $this->users[$this->uids[$u1]]['sex'] . + '||s' . $b . '=' . $this->users[$this->uids[$u2]]['sex'] . + '||t2=' . $this->users[$this->uids[$u2]]['team'] . + '||t1=' . $this->users[$this->uids[$u1]]['team'] . + '||login1=' . $this->users[$this->uids[$u1]]['login2'] . + '||login2=' . $this->users[$this->uids[$u2]]['login2']; + $mas = [ + 'text' => $text, + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $hodID, + 'vars' => $vLog, + 'type' => 1, + ]; + $this->add_log($mas); + } + + //Добавляем в лог действия приема (без атаки) + public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm) + { + $vLog = + 'prm=' . $prm . + '||time1=' . $tm . + '||time2=' . $tm . + '||s1=' . $this->users[$this->uids[$u1]]['sex'] . + '||s2=' . $this->users[$this->uids[$u2]]['sex'] . + '||t2=' . $this->users[$this->uids[$u2]]['team'] . + '||t1=' . $this->users[$this->uids[$u1]]['team'] . + '||login1=' . $this->users[$this->uids[$u1]]['login2'] . + '||login2=' . $this->users[$this->uids[$u2]]['login2']; + $mas = [ + 'text' => $text, + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => ($this->hodID + $hodID), + 'vars' => $vLog, + 'type' => 1, + ]; + $this->add_log($mas); + } + + //Считаем контру + private function contrRestart($id, $at, $v, $rjd = 0) + { + //уворот + $at = $this->mf1Razmen($id, $at, $v, true, $rjd); + //парирование + $at = $this->mf3Razmen($id, $at, $v, true, $rjd); + //контрудар + //$at = $this->mf5Razmen($id,$at,$v,true,$rjd); + //блок щитом (если есть щит, конечно) + $at = $this->mf4Razmen($id, $at, $v, true, $rjd); + //Проверяем урон + //$at = $this->yronRazmen($id,$at); + //крит + $at = $this->mf2Razmen($id, $at, $v, true, $rjd); + + return $this->yronRazmen($id, $at, true, $rjd); + } + + //Расчитываем ед. урона + public function yronGetrazmen($uid1, $uid2, $wp, $zona) + { + global $u; + $r = ['r' => '--',]; + //Определяем тип урона + /* + Колющий + Рубящий + Режущий + Дробящий + */ + $witm = 0; + $witm_type = 0; + + if ($wp > 0) { + $witm = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp' . $wp . 'id']]; + $witm_data = $this->lookStats($witm['data']); + $witm_type = $this->weaponTx($witm); + } + + if ($witm_type == 0 || $witm_type == 12) { + $witm_type2 = ''; + } else { + $witm_type2 = $witm_type; + } + $r['t'] = $witm_type2; + //Расчет брони + /* + голова + грудь + живот + пояс + ноги + */ + $bron = [ + 1 => [$this->stats[$this->uids[$uid2]]['mib1'], $this->stats[$this->uids[$uid2]]['mab1']], + 2 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], + 3 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], + 4 => [$this->stats[$this->uids[$uid2]]['mib3'], $this->stats[$this->uids[$uid2]]['mab3']], + 5 => [$this->stats[$this->uids[$uid2]]['mib4'], $this->stats[$this->uids[$uid2]]['mab4']], + ]; + // + //Увеличиваем параметры от текущего оружия которым бьем + //$witm_data + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_a' . $iii]) && $witm_data['sv_a' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_a' . $iii]; + } + if (isset($witm_data['sv_mg' . $iii]) && $witm_data['sv_mg' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mg' . $iii]; + } + $iii++; + } + $iii = 1; + while ($iii <= 4) { + if (isset($witm_data['sv_aall']) && $witm_data['sv_aall'] != 0) { + $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_aall']; + } + $iii++; + } + $iii = 1; + while ($iii <= 4) { + if (isset($witm_data['sv_mall']) && $witm_data['sv_mall'] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mall']; + } + $iii++; + } + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_m2all']) && $witm_data['sv_m2all'] != 0) { + $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_m2all']; + } + $iii++; + } + + if (isset($witm_data['sv_m3']) && $witm_data['sv_m3'] != 0) { + $this->stats[$this->uids[$uid1]]['m3'] += $witm_data['sv_m3']; + } + + $iii = 1; + while ($iii <= 7) { + if (isset($witm_data['sv_pa' . $iii]) && $witm_data['sv_pa' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['pa' . $iii] += $witm_data['sv_pa' . $iii] + $witm_data['sv_m10']; + } + if (isset($witm_data['sv_pm' . $iii]) && $witm_data['sv_pm' . $iii] != 0) { + $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_pm' . $iii] + $witm_data['sv_m11a']; + if ($iii < 5) { + $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_m11']; + } + } + $iii++; + } + //мощность + подавление мощности противником + $wAp = 0; + + if ($witm_type == 12) { + //удар кулаком + $wAp += $this->stats[$this->uids[$uid1]]['m10']; + if ($this->users[$this->uids[$uid1]]['align'] == 7) { + $wAp += 15; + } + } elseif ($witm_type < 5) { + $wAp += $this->stats[$this->uids[$uid1]]['pa' . $witm_type]; + $wAp -= $this->stats[$this->uids[$uid2]]['antpa' . $witm_type]; + } else { + $wAp += $this->stats[$this->uids[$uid1]]['m10'] + $this->stats[$this->uids[$uid1]]['pm' . ($witm_type - 4)] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm' . ($witm_type - 4)]; + $wAp -= $this->stats[$this->uids[$uid2]]['antpm' . ($witm_type - 4)]; + } + + //Владение данным оружием + $vladenie = 0; + + //Пробой брони + $proboi = 0; + $witm_data['m9'] = $this->stats[$this->uids[$uid1]]['m9']; + if (rand(1, 100) < floor($witm_data['m9'] / 2)) { + $proboi = floor($witm_data['m9'] / 2); + $r['pb'] = 1; + } + + $y = $this->yrn( + $this->stats[$this->uids[$uid1]], + $this->stats[$this->uids[$uid2]], + $this->users[$this->uids[$uid1]], + $this->users[$this->uids[$uid2]], + $this->users[$this->uids[$uid1]]['level'], + $this->users[$this->uids[$uid2]]['level'], + // + $witm_type, + $this->stats[$this->uids[$uid1]]['minAtack'], //мин. урон (добавочный) + $this->stats[$this->uids[$uid1]]['maxAtack'], //макс. урон + $bron[$zona][0], //броня мин. + $bron[$zona][1], //броня макс + // + $vladenie, //владения + $wAp, //мощность урона + (round($this->stats[$this->uids[$uid1]]['m3'])), //мощность крита + (($this->stats[$this->uids[$uid2]]['za' . $witm_type2]) - $this->stats[$this->uids[$uid1]]['pza']), + //защита от урона + $this->stats[$this->uids[$uid1]]['ozash'], //подавление защиты + $proboi, //пробой брони + 0, //хз + ($witm_data['sv_yron_min'] + $this->stats[$this->uids[$uid1]]['yron_min']), + ($witm_data['sv_yron_max'] + $this->stats[$this->uids[$uid1]]['yron_max']), + $this->stats[$this->uids[$uid2]]['zaproc'], + $this->stats[$this->uids[$uid2]]['zmproc'], + (($this->stats[$this->uids[$uid2]]['zm' . ($witm_type2 - 4)]) - round($this->stats[$this->uids[$uid1]]['pzm'] * 0.8)), + //защита от урона + $this->stats[$this->uids[$uid1]]['omzash'], //подавление защиты + $witm['type'], + $witm + ); + + $r['y'] = round(rand($y['min'] + $proboi, $y['max'] + round($proboi / 2))); + $r['k'] = round(rand($y['Kmin'] + round($proboi / 4), $y['Kmax'] + round($proboi / 8))); + $r['m_y'] = $y['max']; + $r['m_k'] = $y['Kmax']; + $r['bRND'] = $y['bRND']; + $r['w_type'] = $witm_type; + + + //тип от оружия + if ($witm['type'] == 18) { + $tp = 1; + } elseif ($witm['type'] == 19) { + $tp = 2; + } elseif ($witm['type'] == 20) { + $tp = 3; + } elseif ($witm['type'] == 21) { + $tp = 4; + } + + if ($tp != $witm_type && $wp > 0) // ТУТ + { + $r['y'] = round($r['y'] / 3); + $r['r'] = round($r['r'] / 3); + $r['k'] = round($r['k'] / 3); + $r['m_k'] = round($r['m_k'] / 3); + $r['m_y'] = round($r['m_y'] / 3); + } + + if (isset($this->stats[$this->uids[$uid2]]['zaproc'])) { + $r['y'] = round($r['y'] - $r['y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['r'] = round($r['r'] - $r['r'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['k'] = round($r['k'] - $r['k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['m_k'] = round($r['m_k'] - $r['m_k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + $r['m_y'] = round($r['m_y'] - $r['m_y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + if ($r['k'] < 1) { + $r['k'] = 2; + } + } + + if ($r['y'] < 1) { + $r['y'] = 1; + } + if ($r['r'] >= 0) { + $r['r'] = -1; + } + if ($r['k'] < 1) { + $r['k'] = 1; + } + if ($r['m_k'] < 1) { + $r['m_k'] = 1; + } + if ($r['m_y'] < 1) { + $r['m_y'] = 1; + } + return $r; + } + + //Считаем урон + private function yronRazmen($id, $at, $pat = false, $rjd = 0) + { + if ($pat) { + $pat = $at; + $at = $pat['p']; + } else { + unset($pat); + } + + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $yhod = [1 => 1, 2 => 0]; + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $yhod = [1 => 0, 2 => 1]; + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $u1 = $uid2; + $u2 = $uid1; + } + + //Считаем свойства от предметов + + + //Расчет удара (u2) по (u1) + $j = 0; + $k = 0; + if ($rjd > 0) { + $j = $rjd - 1; + } + //ТУТ + + while ($j < count($at[$a]['atack']) && $j < 8) { + // КУДА БИЛ , ТИП УДАРА + if ($k == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { + //Левая рука + $wp = 3; + $k = 1; + } else { + //Правая рука + if ( + isset($this->stats[$this->uids[$u1]]['wp14id']) && + $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13 + ) { + $wp = 14; + } else { + $wp = 3; + } + $k = 0; + } + $witm = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp . 'id']]; + $witm_type = $this->weaponTx($witm); + $at[$a]['atack'][$j]['wt'] = $witm['type']; + // + $at[$a]['atack'][$j]['yhod'] = $yhod[$a]; + + if (!isset($at[$a]['atack'][$j]['yron']) && ( + $at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5) + ) { + $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0]); + + if ($at[$a]['atack'][$j][1] == 4) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k'] / 2); + } elseif ($at[$a]['atack'][$j][1] == 5) { + $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; + $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; + } + $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['yron']['w'] = $wp; + if ($at[$a]['atack'][$j]['yron']['y'] < 1) { + $at[$a]['atack'][$j]['yron']['r'] = '--'; + } else { + $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; + } + } else { + $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0]); + + if ($at[$a]['atack'][$j][1] == 4) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k'] / 2); + } elseif ($at[$a]['atack'][$j][1] == 5) { + $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; + $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; + } + $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; + $at[$a]['atack'][$j]['block']['w'] = $wp; + if ($at[$a]['atack'][$j]['block']['y'] < 1) { + $at[$a]['atack'][$j]['block']['r'] = '--'; + } else { + $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; + } + } + $j++; + } + $i++; + } + + if ($pat) { + $pat['p'] = $at; + $at = $pat; + } + return $at; + } + + //Обновление здоровья + private function updateHealth($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $a = 1; + $b = 2; + $u1 = $uid1; + $u2 = $uid2; + } else { + $a = 2; + $b = 1; + $u1 = $uid2; + $u2 = $uid1; + } + + //Рассчет дополнительных тактик + if ($this->atacks[$id]['out' . $b] > 0) { + //Игрок ${'u'.$a} получает тактики, возможно + //выдаем тактику контрудара + if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m6'] / 5), 20) && + $this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic3']++; + } + //выдаем тактику щита + if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m8'] / 4), 20) && + $this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic4']++; + } + } + + //Расчет удара Цели (u2) по Атакующему (u1) + $j = 0; + while ($j < count($at[$a]['atack']) && $j < 8) { + //Добавляем тактики + if ($at[$a]['atack'][$j][1] == 1) { + //u1 ударил обычным ударом u2 + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic1']++; + } + //Двуручка + if ( + $at[$a]['atack'][$j]['yron']['2h'] == 1 && + $this->stats[$this->uids[$u2]]['this_animal'] == 0 + ) { + $this->users[$this->uids[$u1]]['tactic1'] += 2; + } + } elseif ($at[$a]['atack'][$j][1] == 2) { + //u2 увернулся от u1 + } elseif ($at[$a]['atack'][$j][1] == 3) { + //u2 заблокировал удар u1 + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic4']++; + } + } elseif ($at[$a]['atack'][$j][1] == 4) { + //u1 пробил блок u2 критом + if ( + !isset($at[$a]['atack'][$j]['notactic2']) && + $this->stats[$this->uids[$u2]]['this_animal'] == 0 + ) { + $this->users[$this->uids[$u1]]['tactic2']++; + } + $this->users[$this->uids[$u2]]['tactic4']++; //тактика за пробив блок + } elseif ($at[$a]['atack'][$j][1] == 5) { + //u1 ударил критическим ударом u2 + if (!isset($at[$a]['atack'][$j]['notactic2'])) { + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic2'] += 2; + } + //Двуручка + if ( + $at[$a]['atack'][$j]['yron']['2h'] == 1 && + $this->stats[$this->uids[$u2]]['this_animal'] == 0 + ) { + $this->users[$this->uids[$u1]]['tactic2'] += 1; + } + } + } elseif ($at[$a]['atack'][$j][1] == 6) { + //u2 парировал удар u1 + if ( + !isset($at[$a]['atack'][$j]['notactic5']) && + $this->stats[$this->uids[$u1]]['this_animal'] == 0 + ) { + $this->users[$this->uids[$u2]]['tactic5']++; + } + } elseif ($at[$a]['atack'][$j][1] == 7) { + //u2 блокировал щитом удар u1 //ТУТ ЩИТ + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic4']++; + } + } elseif ($at[$a]['atack'][$j][1] == 8) { + //u2 увернулся от удара u1 и нанес по нему контрудар + if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { + $this->users[$this->uids[$u2]]['tactic3']++; + } + } + // КУДА БИЛ , ТИП УДАРА + if (isset($at[$a]['atack'][$j]['yron']) && ( + $at[$a]['atack'][$j][1] == 1 || + $at[$a]['atack'][$j][1] == 4 || + $at[$a]['atack'][$j][1] == 5)) { + if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['y']) { + $at[$a]['atack'][$j]['yron']['y'] = $this->stats[$this->uids[$u2]]['hpNow']; + } + if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['k']) { + $at[$a]['atack'][$j]['yron']['k'] = $this->stats[$this->uids[$u2]]['hpNow']; + } + + if ($at[$a]['atack'][$j]['yron']['y'] < 0) { + $at[$a]['atack'][$j]['yron']['y'] = 1; + $at[$a]['atack'][$j]['yron']['r'] = -1; + $at[$a]['atack'][$j]['yron']['k'] = 1; + } + if ($this->stats[$this->uids[$u2]]['hpNow'] < 1) { + $at[$a]['atack'][$j]['yron']['y'] = 0; + $at[$a]['atack'][$j]['yron']['r'] = -1; + $at[$a]['atack'][$j]['yron']['k'] = 0; + } + + //Добавляем нанесенный урон и опыт + $this->takeExp($u1, $at[$a]['atack'][$j]['yron']['y'], $u1, $u2); + //Отнимаем НР + $this->stats[$this->uids[$u2]]['hpNow'] -= $at[$a]['atack'][$j]['yron']['y']; + $this->users[$this->uids[$u2]]['last_hp'] = -$at[$a]['atack'][$j]['yron']['y']; + + $at[$a]['atack'][$j]['yron']['hp'] = $this->stats[$this->uids[$u2]]['hpNow']; + if ($at[$a]['atack'][$j]['yron']['hp'] < 1) { + $at[$a]['atack'][$j]['yron']['hp'] = 0; + } + $at[$a]['atack'][$j]['yron']['hpAll'] = $this->stats[$this->uids[$u2]]['hpAll']; + if ($at[$a]['atack'][$j]['yron']['hp'] > $at[$a]['atack'][$j]['yron']['hpAll']) { + $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hpAll']; + } + // + //Травмирование + if ( + rand(0, 100) <= 50 && + ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) && + !isset($at[$a]['atack'][$j]['yron']['travma']) && + rand(0, 1000) < 500 && + $this->users[$this->uids[$u2]]['level'] > 1 && + $this->stats[$this->uids[$u1]] > 1 + ) { + $trvm_chns = floor(rand(0, 200) / 10); + if ($trvm_chns > 3 || $trvm_chns < 1) { + $trvm_chns = 0; + } + $at[$a]['atack'][$j]['yron']['travma'] = [$trvm_chns, 'Обыкновенная травма']; + unset($trvm_chns); + } + } + $j++; + } + $i++; + } + return $at; + } + + //Добавляем новую статистику игрока + private function addstatuser($id) + { + if (!$id && !is_numeric($id)) { + return; + } + + mysql_query('INSERT INTO `battle_users` + ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` ) + VALUES + ( + ' . $this->info['id'] . ', + ' . $id . ', + unix_timestamp(), + ' . $this->users[$this->uids[$id]]['login'] . ', + ' . $this->users[$this->uids[$id]]['level'] . ', + ' . $this->users[$this->uids[$id]]['align'] . ', + ' . $this->users[$this->uids[$id]]['clan'] . ', + ' . $this->stats[$this->uids[$id]]['hpAll'] . ', + ' . $this->stats[$this->uids[$id]]['hp'] . ', + ' . $this->stats[$this->uids[$id]]['hpNow'] . ', + ' . $this->users[$this->uids[$id]]['team'] . ' + )'); + } + + //Проверяем приемы + public function priemsRazmen($id, $at) + { + if ($at == 'fast') { + $uid1 = $id[0]; + $uid2 = $id[1]; + } else { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + } + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = $uid1; + } else { + $u1 = $uid2; + } + + //Получаем приемы и смотрим когда какой действует + $eff = $this->stats[$this->uids[$u1]]['effects']; + $this->stats[$this->uids[$u1]]['u_priem'] = []; + $j = 0; + while ($j <= count($eff)) { + if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { + $this->stats[$this->uids[$u1]]['u_priem'][] = [ + $j, + $eff[$j]['v2'], + $this->prm[$eff[$j]['v2']]['act'], + $eff[$j]['id'], + $this->prm[$eff[$j]['v2']]['type_of'], + $this->prm[$eff[$j]['v2']]['moment'], + $this->prm[$eff[$j]['v2']]['moment_end'], + $this->prm[$eff[$j]['v2']]['type_sec'], + ]; + } + $j++; + } + $i++; + } + } + + //Приемы которые используются моментально + private function priemsRazmenMoment($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = $uid1; + $u2 = $uid2; + } else { + $u1 = $uid2; + $u2 = $uid1; + } + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + // + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + $i++; + } + //return $at; + } + + //Приемы которые используются моментально (в конце хода) + private function priemsRazmenMomentEnd($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = $uid1; + $u2 = $uid2; + } else { + $u1 = $uid2; + $u2 = $uid1; + } + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + // + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + $pr_moment = true; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + $i++; + } + //return $at; + } + + + //Используем приемы + private function priemsTestRazmen($id, $at) + { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = $uid1; + $u2 = $uid2; + } else { + $u1 = $uid2; + $u2 = $uid1; + } + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //ставка + + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 220 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 237 + || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 286 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 287 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 288 + || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 213) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_priem)) { + $at = $fx_priem($id, $at, $u1, $j); + } + unset(${'fx_priem'}); + } + } + $j++; + } + $i++; + } + + $i = 1; + while ($i <= 2) { + $u1 = $i == 1 ? $uid1 : $uid2; + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_used_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + $i++; + } + + return $at; + } + + //Повторная проверка приемов + private function priemsRestartRazmen($id, $at) + { + if (isset($at['p'])) { + // + //Проверка + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + /* + Если возникнут проблемы с приемами, придется переписать алгоритм, сейчас он выглядит так: + Цикл 1. Проверяем пользователя + Цикл 2 внутри Цикла 1. Проверяем приемы поторые пользователь использовал + Придется сделать: + Цикл 1. Проверяем пользователя + Цикл 2 внутри Цикла 1. Проверяем приемы уворота + Цикл 3. Проверяем пользователя + Цикл 4 внутри Цикла 3. Проверяем приемы крита + и т.д. + */ + $i = 1; + while ($i <= 2) { + if ($i == 1) { + $u1 = $uid1; + $u2 = $uid2; + } else { + $u1 = $uid2; + $u2 = $uid1; + } + + if (!isset($at['p']['p_cast'])) { + $at['p'] = $at; + $at['p']['p_cast'] = true; + } + + //Приемы ухода от удара + if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + $this->stats[$this->uids[$u2]]['nopryh']--; + } + } + $j++; + } + } + //Приемы крита + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Приемы атаки + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u1, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u2, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_tested_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $at = $fx_priem($id, $at, $u2, $j); + unset(${'fx_priem'}); + } + } + $j++; + } + + $i++; + } + } + return $at['p']; + } + + //Проверка урона приемов + public $um_priem = []; + + /** + * Трогать очень осторожно. Этот шайтан как-то проверяет приёмы на враге + * и рассчитывает урон учитывая и эти приёмы тоже. + * @param $uid1 + * @param $uid2 + * @param $priem + * @param $yron + * @param $profil + * @param $stabil [deprecated] + * @param $test [deprecated] + * @param $inlog + * @return float|int|mixed + */ + public function testYronPriem($uid1, $uid2, $priem, $yron, $profil, $stabil, $test = false, $inlog = 0) + { + /* + profil = { + -1 - урон оружием + -2 - урон магией + 0 - неизвестно + 1-4 - профильный оружия + 5-12 - профильный магия + } + stabil - урон не подвержен мощностям и т.д + */ + //Проверка + $u1 = $uid1; + $u2 = $uid2; + + //Проверяем приемы защиты игрока $u1 на урон игрока $u2 + //Получаем приемы и смотрим когда какой действует + if (!isset($this->stats[$this->uids[$u2]]['u_priem'])) { + $eff = $this->stats[$this->uids[$u2]]['effects']; + $j = 0; + while ($j <= count($eff)) { + if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { + $this->stats[$this->uids[$u2]]['u_priem'][] = [ + $j, + $eff[$j]['v2'], + $this->prm[$eff[$j]['v2']]['act'], + $eff[$j]['id'], + $this->prm[$eff[$j]['v2']]['type_of'], + $this->prm[$eff[$j]['v2']]['moment'], + ]; + } + $j++; + } + unset($eff); + } + //Приемы защиты + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + $yron = $fx_moment($u2, $u1, $j, $yron, $profil); + unset(${'fx_moment'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + $j++; + } + + //Прочие приемы (влияет на урон от моментальных приемов) + $j = 0; + while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { + if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][7] == 5) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this_seven = $u1; + require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment_seven)) { + $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment_seven'}); + } + } + $j++; + } + + //Прочие приемы + $j = 0; + while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { + if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { + $pr_momental_this = $u2; + require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); + if (isset($fx_moment)) { + $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); + } + unset(${'fx_moment'}); + } + } + $j++; + } + + if ($this->stats[$this->uids[$u2]]['zaproc'] > 0) { + $yron = round($yron - $yron * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); + if ($yron < 1) { + $yron = 1; + } + } + + return $yron; + } + + //Опыт + набитый урон за удар приемом\магией + + /** + * @param $u1 + * @param $u2 + * @param $yron + * @param $type [deprecated] + * @return void + */ + public function priemYronSave($u1, $u2, $yron, $type = 0) + { + //$type 0 - урон , 1 - хил + + $this->testUserInfoBattle($u1); + $this->testUserInfoBattle($u2); + + if (isset($this->uids[$u1])) { + if ($this->stats[$this->uids[$u2]]['hpAll'] <= 1000) { + $adt6 = round(0.1 * (floor($yron) / $this->stats[$this->uids[$u2]]['hpAll'] * 100), 10); + } else { + $adt6 = round(0.1 * (floor($yron) / 1000 * 100), 10); + } + + if ($yron > $this->stats[$this->uids[$u2]]['hpNow']) { + $yron = $this->stats[$this->uids[$u2]]['hpNow']; + } + + if ($yron > 0) { + $this->users[$this->uids[$u1]]['battle_yron'] += $yron; + $this->users[$this->uids[$u1]]['battle_exp'] += round($this->testExp($yron, + $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2)); + if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { + $this->users[$this->uids[$u1]]['tactic6'] += $adt6; + $this->stats[$this->uids[$u1]]['tactic6'] += $adt6; + } else { + $this->users[$this->uids[$u1]]['tactic6'] += $adt6 / 3; + $this->stats[$this->uids[$u1]]['tactic6'] += $adt6 / 3; + } + } else { + $adt6 = 0; + } + // + $this->users[$this->uids[$u2]]['last_hp'] = -$yron; + // + mysql_query('UPDATE `stats` SET + `tactic6` = `tactic6` + ' . $adt6 . ', + `battle_yron` = `battle_yron` + ' . $yron . ', + `battle_exp` = `battle_exp` + ' . round($this->testExp($yron, $this->stats[$this->uids[$u1]], + $this->stats[$this->uids[$u2]], $u1, $u2)) . ' + WHERE `id` = ' . $u1); + // + mysql_query('UPDATE `stats` SET + `last_hp` = ' . $this->users[$this->uids[$u2]]['last_hp'] . ' + WHERE `id` = ' . $u2); + } + + $this->addNewStat([ + 1 => [ + 'battle' => $this->info['id'], + 'uid1' => $this->users[$this->uids[$u1]]['id'], + 'uid2' => $this->users[$this->uids[$u2]]['id'], + 'time' => time(), + 'type' => 0, + 'a' => '10000', + 'b' => 0, + 'type_a' => 1, + 'type_b' => 0, + 'ma' => 1, + 'mb' => 1, + 'yrn' => $yron, + 'yrn_krit' => 0, + 'tm1' => $this->users[$this->uids[$u1]]['team'], + 'tm2' => $this->users[$this->uids[$u2]]['team'], + ], + ]); + } + + //Наносим удар между игроками + + public function startAtack($id) + { + global $c, $u, $priem; + + if (!isset($this->atacks[$id]) || $this->atacks[$id]['lock'] != 0) { + return; + }//Прием разгадать тактику + $i = 1; + $j = 2; + $k = 0; + + while ($i <= 2) { + $untac = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 217 AND `uid` = ' . $this->atacks[$id]['uid' . $i] . ' AND `delete` = 0')); + + $agrs = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 211 AND `uid` = ' . $this->atacks[$id]['uid' . $j] . ' AND `delete` = 0')); + + if (isset($untac['id']) && !isset($agrs['id'])) { + // AND `a`.`v2` != 235 // AND `a`.`v2` != 273 AND `a`.`v2` != 286 AND `a`.`v2` != 287 AND `a`.`v2` != 288 + + $pvr['sp'] = mysql_query('SELECT * FROM `eff_users` WHERE + `uid` = ' . $this->atacks[$id]['uid' . $j] . ' + AND `delete` = 0 + AND `v1` = "priem" + and `v2` not in (222, 238, 228, 229, 139, 188, 226, 211, 49, 233, 227, 220, 191, 332, 333, + 334, 335, 236, 201, 261, 262, 206, 207, 208, 209, 210, 284, 263, 258, 29, 30, 31, 32, 526, 249, + 248, 187, 245, 175, 176, 177, 178, 179, 285, 36, 85, 86, 87, 88, 89, 90, 269, 276, 277, 270, + 174, 324, 217) + AND `name` NOT LIKE "%Иммунитет%" + LIMIT 30'); + while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { + $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1')); + if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { + $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); + } + } + // + $k++; + } + $j--; + $i++; + } + + //Восстановление манны 1% за ход + if ($this->atacks[$id]['out1'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); + } + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; + } + // + if ($this->atacks[$id]['out2'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); + } + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; + } + + //Антистаты + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3']); + } + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3']); + } + + //Расчет количества блоков и противников + $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + + // Получаем приемы игроков + $this->priemsRazmen($id, $at); + $this->priemsRazmenMoment($id, $at); + $this->priemsRazmen($id, $at); + + $at = $this->newRazmen($id); + + // Тестируем какие еще могут быть варианты при ударе + // Уворот, парирование, крит, пробить блок, блок щитом + // Блок щитом (если есть щит, конечно) + $at = $this->mf2Razmen($id, $at, $v); //крит + $at = $this->mf3Razmen($id, $at, $v); //парирование + $at = $this->mf4Razmen($id, $at, $v); //блок щитом + + $at = $this->mf1Razmen($id, $at, $v); //уворот + $at = $this->mf5Razmen($id, $at, $v); //контрудар + + $at = $this->yronRazmen($id, $at); //расчет урона + + // Проверяем приемы + // Получаем приемы игроков + $at = $this->priemsTestRazmen($id, $at); + // Собираем размен (пересчитываем и расчитываем урон и т.д) + $at = $this->priemsRestartRazmen($id, $at); //Повторная проверка приемов (если требуется) + // + + //Минусуем поглощенный урон + if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); + } + if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); + } + + // Обновляем НР и добавляем тактики + $at = $this->updateHealth($id, $at); + + // Заносим в логи + записываем статистику боя + $this->addlogRazmen($id, $at); + // NEW BATTLE SYSTEM + + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + + // + //Возращаем зоны блока + $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + //обновляем задержки приемов + $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); + $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); + // + $prmos = []; + // + $i5 = 0; + + while ($i5 < 51) { + if (isset($zd1[$i5]) && $zd1[$i5] > 0) { + //Если приемы не требуют ход + $zd1[$i5] -= 1; + } else { + $zd1[$i5] = 0; + } + if (isset($zd2[$i5]) && $zd2[$i5] > 0) { + //Если приемы не требуют ход + $zd2[$i5] -= 1; + } else { + $zd2[$i5] = 0; + } + $i5++; + } + unset($prmos); + + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } + + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } + + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); + if ($this->atacks[$id]['uid1'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd1); + } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd2); + } + // + //Проверяем тактики + $i = 1; + while ($i <= 6) { + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; + } + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; + } + $i++; + } + // + //Обновляем задержки предметов + mysql_query('UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100'); + + mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2'); + + //Обновляем задержки пирожков + mysql_query('UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + mysql_query('UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + + //Тактики + mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + + //Обновляем задержки пирожков + mysql_query('UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); + mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + + + //Обновляем данные в battle_users + mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); + mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); + //Восстановление манны 25% от мудрости за ход + + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $this->save_stats($this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'])); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $this->save_stats($this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'])); + } + // + $this->save_stats($this->atacks[$id]['uid1']); + $this->save_stats($this->atacks[$id]['uid2']); + + $this->priemsRazmenMomentEnd($id, $at); + + //Минусуем заряд приема \ эффекта + $j = 1; + while ($j <= 2) { + $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; + $i = 0; + while ($i < count($eff)) { + if (isset($eff[$i])) { + if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { + $eff[$i]['hod']--; + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . $eff[$i]['v2'])); + if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana($eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; + } + } + if (strripos($eff[$i]['data'], 'minprocmanahod')) { + $pvr = [ + 'x1' => 0, + 'x2' => 0, + 'd' => explode('|', $eff[$i]['data']), + 'i' => 0, + 'uid' => $eff[$i]['uid'], + 'color' => '', + 'color2' => '', + 'effx' => '', + 'x' => $eff[$i]['name'], + ]; + + while ($pvr['i'] < count($pvr['d'])) { + if (isset($pvr['d'][$pvr['i']])) { + $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); + if ($pvr['d1'][0] == 'minprocmanahod') { + $pvr['d1'] = explode('x', $pvr['d1'][1]); + $pvr['x1'] = $pvr['d1'][0]; + $pvr['x2'] = $pvr['d1'][1]; + } + } + $pvr['i']++; + } + + $pvr['mp'] = round($this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand($pvr['x1'], + $pvr['x2'])); + $pvr['mpSee'] = 0; + $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); + $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; + $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; + + if ($pvr['mpTr'] > 0) { + //Требуется хилл + if ($pvr['mpTr'] < $pvr['mp']) { + $pvr['mp'] = $pvr['mpTr']; + } + $pvr['mpSee'] = '+' . $pvr['mp']; + $pvr['mpNow'] += $pvr['mp']; + } + if ($pvr['mpNow'] > $pvr['mpAll']) { + $pvr['mpNow'] = $pvr['mpAll']; + } elseif ($pvr['mpNow'] < 0) { + $pvr['mpNow'] = 0; + } + if ($pvr['mpSee'] == 0) { + $pvr['mpSee'] = '--'; + } + + + $this->stats[$this->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + $this->users[$this->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + mysql_query('UPDATE `stats` SET `mpNow` = ' . $this->stats[$this->uids[$pvr['uid']]]['mpNow'] . ' WHERE `id` = ' . $pvr['uid']); + + $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex']); + $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' на ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (Мана)'; + $this->priemAddLog($id, 1, 2, $pvr['uid'], 0, + '' . $pvr['x'] . '', + $pvr['text2'], + ($this->hodID) + ); + + unset($pvr); + } + + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['hod'] > 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; + mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); + } else { + //удаляем прием + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], + 3, $this->atacks[$id]['uid' . $jn]); + } + } + } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); + } else { + $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); + if (isset($eff[$i]['priem']['minmana']) && round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana($eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn]); + } + } + } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && $c['effz'] > 0) { + $eff[$i]['hod']--; + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['hod'] > 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; + mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); + } else { + //удаляем прием + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem($eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn]); + } + } + } + } + } + $i++; + } + $j++; + } + // + // + //Проверяем + if ($c['propsk_die'] > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + $cn1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1')); + $cn2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1')); + if ($cn1[0] > 3) { + // + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid1'], 0, '', + $pvr['text2'], + ($this->hodID) + ); + unset($pvr); + mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); + } + if ($cn2[0] > $c['propsk_die']) { + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid2'], 0, '', + $pvr['text2'], + ($this->hodID) + ); + unset($pvr); + mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); + } + } + // + //Обновляем текущего противника + if ($u->info['id'] == $this->atacks[$id]['uid1']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } + if ($u->info['id'] == $this->atacks[$id]['uid2']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } + //Удаляем размен из базы //ТУТ возможен лаг удаления + mysql_query('DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR + ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )'); + + unset($old_s1, $old_s2); + unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->atacks[$id]); + mysql_query('DELETE FROM `battle_act` WHERE `id` = ' . $id); + // + + unset($old_s1, $old_s2); + // + } + + //Сохранение данные + private function save_stats($uid) + { + mysql_query('UPDATE `stats` SET + `hpNow` = ' . $this->stats[$this->uids[$uid]]['hpNow'] . ', + `mpNow` = ' . $this->stats[$this->uids[$uid]]['mpNow'] . ', + `tactic1` = ' . $this->users[$this->uids[$uid]]['tactic1'] . ', + `tactic2` = ' . $this->users[$this->uids[$uid]]['tactic2'] . ', + `tactic3` = ' . $this->users[$this->uids[$uid]]['tactic3'] . ', + `tactic4` = ' . $this->users[$this->uids[$uid]]['tactic4'] . ', + `tactic5` = ' . $this->users[$this->uids[$uid]]['tactic5'] . ', + `tactic6` = ' . $this->users[$this->uids[$uid]]['tactic6'] . ', + `tactic7` = ' . $this->users[$this->uids[$uid]]['tactic7'] . ', + `enemy` = ' . $this->users[$this->uids[$uid]]['enemy'] . ', + `battle_yron` = ' . $this->users[$this->uids[$uid]]['battle_yron'] . ', + `last_hp` = ' . $this->users[$this->uids[$uid]]['last_hp'] . ', + `battle_exp` = ' . $this->users[$this->uids[$uid]]['battle_exp'] . ', + `priems_z` = ' . $this->users[$this->uids[$uid]]['priems_z'] . ' + WHERE `id` = ' . $uid); + } + + //Выводим лог боя + public function lookLog() + { + global $u; + $hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . ' ORDER BY `time`')); + if ($hodID['id_hod'] <= 1) { + $u->info['alog'] = 0; + } + + if ($_POST['idlog'] < 1) { + $_POST['idlog'] = 0; + } + $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = ' . $u->info['id'])); + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + if (isset($sp) && $this->info['team_win'] != -1) { + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + } + $jin = 0; + $forYou2 = 0; + $js = ''; + $pll = 0; + if ($_POST['idlog'] < 1) { + $_POST['idlog'] = 0; + } + $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = ' . $u->info['id'])); + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + if (isset($sp) && $this->info['team_win'] != -1) { + $sp = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); + } + $jin = 0; + $forYou2 = 0; + while ($pl = mysql_fetch_array($sp)) { + if ($jin == 0) { + $u->info['alog'] = $pl['id_hod']; + } + $jin++; + + $rt = $pl['text']; + $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); + $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm3}', + '' . date('d.m.Y H:i', $pl['time']) . '', $rt); + $rt = str_replace('{tm4}', + '' . date('d.m.Y H:i', $pl['time']) . '', $rt); + $pl['text'] = $rt; + + unset($rt); + if ($pll < $pl['id']) { + $pll = $pl['id']; + } + $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', + '"', $pl['vars']) . '");' . $js; + } + mysql_query('UPDATE `stats` SET `alog`=' . $u->info['alog'] . ' WHERE `id` =' . $u->info['id']); + $js .= 'id_log=' . $pll . ';'; + + return $js; + } + +//Новый лог Мой Лог + public function lookmLog() + { + $u = user::start(); + $js = ''; + $pll = 0; + + if ($this->info['type'] != 9) { + $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1')); + if ($hodID['id_hod'] <= 1) { + $u->info['mlog'] = 0; + } + if (isset($hodID['id']) && $this->info['team_win'] != -1) { + $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1')); + } + if (isset($hodID['id'])) { + $hodID = $hodID['id']; + } else { + $hodID = 0; + } + $tmlog = mysql_fetch_array(mysql_query('SELECT `mlog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); + $spm = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); + + if (isset($spm) && $this->info['team_win'] != -1) { + $spm = mysql_query('SELECT + `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` + FROM `battle_logs_save` + WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); + } + + $jin = 0; + $forYou2 = 0; + + while ($plm = mysql_fetch_array($spm)) { + if ($jin == 0) { + $u->info['mlog'] = $plm['id_hod']; + } + $jin++; + $rt = $plm['text']; + $plm['vars'] = str_replace('^^^^', 'rvnO', $plm['vars']); + $rt = str_replace('{tm1}', '' . date('H:i', $plm['time']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $plm['time']) . '', $rt); + $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $plm['time']) . '', + $rt); + $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $plm['time']) . '', + $rt); + $plm['text'] = $rt; + unset($rt); + if ($pll < $plm['id']) { + $pll = $plm['id']; + } + $js = 'add_mlog(' . $plm['id'] . ',' . $forYou2 . ',"' . $plm['text'] . '",' . $plm['id_hod'] . ',0,0,"' . str_replace('"', + '"', $plm['vars']) . '");' . $js; + } + $js .= 'id_mlog=' . $pll . ';'; + mysql_query('UPDATE `stats` SET `mlog`=' . $u->info['mlog'] . ' WHERE `id` =' . $u->info['id']); + } + return $js; + } +//====================== + + //Добавляем в лог + public function add_log($mass) + { + if ($mass['time'] != '' && $mass['text'] != '') { + mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES (' . $mass['time'] . ',' . $mass['battle'] . ',' . $mass['id_hod'] . ',' . $mass['text'] . ',' . $mass['vars'] . ',' . $mass['type'] . ')'); + if (rand(2, 10) == 10) { + $this->get_comment(); + } + } + } + + ///Комментатор + private function get_comment() + { + $boycom = [ + 'А танцуешь ты лучше.', + 'А мы что, в прятки тут играем?', + 'А вы разве пингвинов никогда не видели?', + 'А, ведь когда-то, вы были красивыми… А теперь? Ну и рожи! Жуть!', + 'А потом еще труп пинать будут.', + 'А я вчера ночью за соседями подглядывал. Они точно так же кувыркались', + 'А ведь вы живых людей дубасите...', + 'А вот я вчера в зоопарке был...', + 'А вы в стройбате не служили?', + 'А вы видели, чтобы так на улице делали!?', + 'А вы знали что ёжики размножаются в интернете?', + 'А жить-то, как хочется:', + 'А из-за чего вы собственно дерётесь?', + 'А чего ржёте, вы ещё остальных не видели', + 'А что произойдёт если ты испугаешся до полусмерти дважды?!', + 'Больше так не делай. Ты же не садист?', + 'Без комментариев...', + 'Больно ведь!', + 'Быстро ты за монитор спрятался!', + 'Все хотят попасть в рай, но никто не хочет умирать!', + 'Вчера с такой девчонкой познакомился.', + 'Всего 5 минут знакомы, а дерутся, словно супруги с 20-ти летним стажем...', + 'Все. Я так больше не могу.', + 'В конце концов, кто-то победит?', + 'Вы чего, с дерева упали?', + 'Возятся как сонные мухи... давайте я вам лучше анекдот расскажу: ...', + 'Вот видишь, как полезно чистить зубы на ночь?', + 'Вот вы все руками махаете, а за вами уже очередь', + 'Вот попадёте вы в плен и вас там будут долго бить. Но вы ничего не расскажете... и не потому, что вы такой стойкий, просто вы ничего не знаете', + 'Вы бы лучше пошли потренировались!', + 'Вы все еще разминаетесь? Позовите, когда кости в муку друг другу разминать будете.', + 'Вы же бойцы! Имейте совесть!', + 'Гаси недоумка!', + 'Да, если бы я смог это остановить, то получил бы нобелевскую премию `За мир` ', + 'Да куда они бьют?!', + 'Давайте быстрее! За вами уже очередь образовалась.', + 'Давайте обойдемся сегодня таймаутом. А? А то мне уже кошмары скоро будут сниться.', + 'Дерутся как девчонки!', + 'Дети, посмотрите налево... Ой!.. Нет, туда лучше не смотреть.', + 'Если так будет продолжаться, то скоро мы заснем!', + 'Если бы у меня было кресло-качалка, я бы в нём качался...', + 'Если вы что-то сказать хотите, то лучше молчите :)', + 'Жестокость не порок.', + 'Жизнь вне нашего клуба - это пустая трата кислорода!!!', + 'Жми! Дави! Кусай! Царапай!', + 'За такие бои надо в хаос отправлять!', + 'Знаете откуда в комиссионном магазине столько вещей? Это я после ваших гулянок собираю и сдаю туда. Иногда вместе с частями тела, застрявшими в них.', + 'Здесь люди так близки друг к другу. Просто иначе ударить нельзя.', + 'И пролитая кровь еще пульсирует...', + 'Инвалидов развелось...', + 'Какой бой!!!', + 'Кто!? Кто здесь?!', + 'Кто вас этому научил?', + 'Кузнечик, блин...', + 'Куплю импортный проигрыватель грампластинок.', + 'Лошадью ходи!', + 'Лучше враг, чем друг - враг.', + 'Ладно, вы тут пока друг друга за волосы таскайте, а я пойду, пообедаю.', + 'Мне ваш балет уже надоел!', + 'Может, начнется-таки настоящий бой???', + 'Мысли лезут в голову изнутри, а удары снаружи.', + 'Ну и где ваши коронные удары? Где живописные падения я спрашиваю!', + 'Ну, нельзя же так наотмашь лупить!', + 'Надо раньше было думать, теперь смертельно поздно...', + 'На такое зрелище билеты продавать можно. Народ ухохочется!', + 'Нет! Не надо драки! А... ладно деритесь, все равно не умеете.', + 'Нет, ну должен быть повод, должен же быть повод?', + 'Нет, я отказываюсь это комментировать!', + 'Не таких обламывали!', + 'Ну выпили вы рюмку, ну две... ну литр, ну два... так зачем же после этого драку затевать?!', + 'Ну и кто за этот погром платить будет?', + 'Ну и оскал у вас. Из вашей улыбки кастеты делать можно.', + 'Ну, что же ты..? Не печалься. Выше голову, так по ней удобней попасть.', + 'Ничего... Блок тоже удар.', + 'Обернись!!!.... Поздно...', + 'Ого! Научите меня так не делать.', + 'Осторожно! Сделаешь дырочку, уже не запломбируешь!', + 'Оно вам надо???', + 'Обычное дело...там что-то отклеилось.', + 'Ой, и заболтался я с вами...', + 'Он же не промахнётся если ты не отойдёшь!', + 'По-моему, кому-то светит инвалидность.', + 'Подкинь ему грабли, на которые он еще не наступал.', + 'Прав был кот Леопольд, давайте жить дружно?', + 'При ударе в живот нарушается кислотно-щелочной баланс.', + 'Проверь, не торчит ли у тебя нож из живота.', + 'Перестаньте мне орать!', + 'Подкинь ему грабли, на которые он еще не наступал.', + 'Прыгают тут как блохи... Все, я пошел за дихлофосом!', + 'Разбудите меня когда эта порнография закончится...', + 'Ребенок сильнее ударил бы!', + 'Славно вмазал!', + 'Славно они веселятся', + 'Смотрю вот на вас, и слезы наворачиваются.', + 'Сначала учатся ходить, а потом только в драку лезут.', + 'Так они друг другу что-нибудь сломают.', + 'Так ты ему все кости переломаешь!', + 'У меня в подъезде точно так же соседа отмудохали', + 'Убогих развелось...', + 'Ух ты, какой прыткий!', + 'Фашист!! Надо ж, так по больному месту врезать...', + 'Хватит бить его об угол моей кабинки! Мне же потом ее чинить.', + 'Хулиганы, прекратите немедленно!', + 'Хочешь, подскажу, куда он ударит?', + 'Хорошо, что у меня ловкости больше чем у вас всех, а то б вы и меня в инвалидную коляску посадили бы.', + 'Хороший бой!', + 'Хороший удар!', + 'Хиляк-разрядник!', + 'Что ты его за волосы схватил?! Отпусти немедленно!', + 'Щас я вас настигну, вот тогда мы и похохочем', + 'Это была какая-то неизвестная мне техника...', + 'Это же противник, а не глина! Хватит мяться!', + 'Это не бой, это издевательское избиение.', + 'Это поубавит спеси', + 'Это и был твой план `Б` ?', + 'Это была какая-то неизвестная мне техника...', + 'Я же предупреждал, - будет больно.', + 'Я не страдаю безумием. Я наслаждаюсь им каждую минуту :)', + 'Я красивый, я сильный, я умный, я добрый. А вот вы? Вы себя-то видели?!', + 'Я тоже умею драться, но не буду...', + '(тревожно озираясь) я вам по секрету скажу... за вами наблюдают!', + '<вырезано цензурой> после боя я этих <вырезано цензурой> обоих в <вырезано цензурой> и <вырезано цензурой>', + '<вырезано цензурой> каратисты фиговы', + ]; + if (rand(1, 12) !== 12) { + return; + } + shuffle($boycom); + $this->add_log([ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '{tm1} Комментатор: ' . current($boycom) . '', + 'vars' => 'time1=' . time(), + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]); + } + + //Расчет типа удара от оружия + public function weaponTx($item) + { + if (!isset($item['id'])) { + $i = 1; + while ($i <= 4) { + $itm['tya' . $i] = 1; + $i++; + } + } + $itm = $this->lookStats($item['data']); + $t[0]['z'] = 0; + $t[0]['t'] = 0; + //колящий урон + $t[1]['z'] = round(0 + $itm['tya1']); + $t[1]['t'] = 1; + //рубящий урон + $t[2]['z'] = round(0 + $itm['tya2']); + $t[2]['t'] = 2; + //дробящий урон + $t[3]['z'] = round(0 + $itm['tya3']); + $t[3]['t'] = 3; + //режущий урон + $t[4]['z'] = round(0 + $itm['tya4']); + $t[4]['t'] = 4; + //урон огня + $t[5]['z'] = round(0 + $itm['tym1']); + $t[5]['t'] = 5; + //урон воздуха + $t[6]['z'] = round(0 + $itm['tym2']); + $t[6]['t'] = 6; + //урон воды + $t[7]['z'] = round(0 + $itm['tym3']); + $t[7]['t'] = 7; + //урон земли + $t[8]['z'] = round(0 + $itm['tym4']); + $t[8]['t'] = 8; + //урон света + $t[9]['z'] = round(0 + $itm['tym5']); + $t[9]['t'] = 9; + //урон тьмы + $t[10]['z'] = round(0 + $itm['tym6']); + $t[10]['t'] = 10; + //урон серой магией + $t[11]['z'] = round(0 + $itm['tym7']); + $t[11]['t'] = 11; + + + $tpt = $t[0]['z']; + $tpmin = $t[0]; + $tpmax = $t[0]; + $i = 1; + + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmax = $t[$i]; + $ii = $i; + } + $i++; + } + $t[$ii]['z'] = 0; + + $tpt = $t[0]['z']; + $i = 1; + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmin = $t[$i]; + } + $i++; + } + + $setclass = rand(1, 100); + + if ($setclass > $tpmax['z']) { + $tp = $tpmin['t']; + } else { + $tp = $tpmax['t']; + } + + return $tp; + } + + //Расчет урона от оружия + public function weaponAt22($item, $st = 0) + { + if (empty($item['data'])) { + return []; + } + $itm = $this->lookStats($item['data']); + //начинаем расчет урона + $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; + $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; + + return [$min, $max]; + } + + //Гамс + //Расчет защиты + private function zago($v) + { + return round((1 - (pow(0.5, (max($v, 1700) / 399.51)))) * 100, 2); + } + + //Расчет защиты (магия) + public function zmgo($v) + { + return (1 - (pow(0.5, ($v / 250)))) * 100; + } + + + /** + * @param $st1 + * @param $st2 + * @param $u1 + * @param $u2 + * @param $level + * @param $level2 [not used?] + * @param $type + * @param $min_yron + * @param $max_yron + * @param $min_bron [not used?] + * @param $max_bron [not used?] + * @param $vladenie + * @param $power_yron + * @param $power_krit + * @param $zashita + * @param $ozashita [not used?] + * @param $proboi + * @param $weapom_damage [not used?] + * @param $weapom_min + * @param $weapom_max + * @param $za_proc [not used?] + * @param $zm_proc [not used?] + * @param $zashitam [not used?] + * @param $ozashitam [not used?] + * @param $wp_type + * @param $witm + * @return array + */ + public function yrn( + $st1, + $st2, + $u1, + $u2, + $level, + $level2 = null, + $type, + $min_yron, + $max_yron, + $min_bron = null, + $max_bron = null, + $vladenie, + $power_yron, + $power_krit, + $zashita, + $ozashita = null, + $proboi, + $weapom_damage = null, + $weapom_min, + $weapom_max, + $za_proc = null, + $zm_proc = null, + $zashitam = null, // pzm тут! + $ozashitam = null, + $wp_type, + $witm + ) { + global $u; + + //Поправка + if ($zashita < 1) { + $zashita = 1; + } + + if ($min_yron < 1) { + $min_yron = 1; + } + + if ($max_yron < 1) { + $max_yron = 1; + } + + if (!isset($type) || $type == '') { + $type = 12; + } + + //Параметры для возврвата + $p = [ + 'Y' => 0, + 'B' => [0 => 0, 1 => 0, 'rnd' => false], + 'L' => $level, + 'W' => [$weapom_min, $weapom_max, 'rnd' => false], //минимальный урон //максимальный урон добавочный + 'U' => $vladenie, //владение оружием + 'M' => $power_yron, //мощность урона + 'K' => $power_krit, //мощность крита + 'S' => 0, //влияние статов на проф.урон + 'T' => 1, //Кф. оружия + 'iT' => 1, //Итоговый доп. Кф. оружия + /* + (S) - влияние наших статов на профильный урон + Колющий: S = Сила * 0,3 + Ловкость * 0,7 + Рубящий: S = Сила * 0,5 + Ловкость * 0,25 + Интуиция * 0,25 + Дробящий: S = Сила * 1 + Режущий: S = Сила * 0,3 + Интуиция * 0,7 + */ + ]; + + //Умножитель 1.33 для двуручки и 1.00 для одной руки + + $witmdata = $this->lookStats($witm['data']); + + //Расчет типа урона + + if ($wp_type == 18) { + $r['type'] = 1; + } elseif ($wp_type == 19) { + $r['type'] = 2; + } elseif ($wp_type == 20) { + $r['type'] = 3; + } elseif ($wp_type == 21) { + $r['type'] = 4; + } else { + $r['type'] = 0; + } + //ТУТ Профильный урон + //колющий + if ($r['type'] == 1) { + $p['S'] = $st1['s1'] * 0.25 + $st1['s2'] * 0.75; + $p['U'] = $st1['a1'] * 1.00; //кинжалы + //рубящий + } elseif ($r['type'] == 2) { + $p['S'] = $st1['s1'] * 1.20; + $p['U'] = $st1['a2'] * 1.00; //топоры + //дробящий + } elseif ($r['type'] == 3) { + $p['S'] = $st1['s1'] * 0.5 + $st1['s4'] * 1.00; + $p['U'] = $st1['a3'] * 1.00; //дубины + //режущий + } elseif ($r['type'] == 4) { + $p['S'] = $st1['s3'] * 1.00; + $p['U'] = $st1['a4'] * 1.00; //мечи + //Магиечески + } elseif ($r['type'] >= 5 && $r['type'] < 12) { + $p['S'] = $st1['s1'] * 0.5 + $st1['s2'] * 0.5; + $p['U'] = $st1['mg' . ($r['type'] - 4)] * 1.00; //магией + $p['Mage'] = true; + } else { + $p['S'] = 0; + $p['U'] = 0; // для кулака(нужно переписывать + } + + $r['bron']['rnd'] = rand($r['bron'][0], $r['bron'][1]); + + //Остальные расчеты (коэфицент) + $p['B'][0] = 2 + $level + $st1['s1'] - round($st1['s1'] / 5); + $p['B'][1] = $p['B'][0] + 3; + + $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); + $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); + + //Обычный урон + if ($r['type'] == 12) { + $r['min'] = ($p['B'][0] + $weapom_min) * $p['T'] * (1 + $p['M'] / 100); + $r['max'] = ($p['B'][1] + $weapom_max) * $p['T'] * (1 + $p['M'] / 100); + } else { + $r['min'] = (($p['B'][0] + $p['S'] * 2 + $weapom_min * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); + $r['max'] = (($p['B'][1] + $p['S'] * 2 + $weapom_max * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); + } + + $r['bRND'] = $p['B']['rnd']; + + $r['Kmin'] = ceil((2 + ($p['K'] / 100)) * $r['min']); + $r['Kmax'] = ceil((2 + ($p['K'] / 100)) * $r['max']); + + //Расчет брони + //для обычного + if ($r['type'] < 5 || $r['type'] == 12) { + $r['min_abron'] = round($r['min'] * 0.05); + $r['max_abron'] = round($r['max'] * 0.05); + + if ($proboi != 0) { + $r['bron']['rndold'] = $r['bron']['rnd']; + } + + //Новые исправления в броне + $r['Kmin'] -= $r['bron']['rnd'] * 2; //было умножить на 2 + $r['Kmax'] -= $r['bron']['rnd'] * 2; //было умножить на 2 + + $r['min'] -= $r['bron']['rnd']; //не было деления ни на чо. + $r['max'] -= $r['bron']['rnd']; //не было деления ни на чо. + + } + + //Расчет защиты (не более 80%) + if ($r['type'] < 5 || $r['type'] == 12) { + $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); + $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); + $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); + } else { + $r['min'] = round($r['min'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['max'] = round($r['max'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zmgo($st2['zm']))); + $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zmgo($st2['zm']))); + } + + $r['min'] = round($r['min']); + $r['max'] = round($r['max']); + $r['Kmin'] = round($r['Kmin']); + $r['Kmax'] = round($r['Kmax']); + + $min_yrn = 0; //% + + if ($u1['clone'] > 0) { + $min_yrn = 75; + } + + $r['min'] -= floor($r['min'] / 100 * $min_yrn); + $r['max'] -= floor($r['max'] / 100 * $min_yrn); + $r['Kmin'] -= floor($r['Kmin'] / 100 * ($min_yrn)); + $r['Kmax'] -= floor($r['Kmax'] / 100 * ($min_yrn)); + $r['min_'] -= floor($r['min_'] / 100 * $min_yrn); + $r['max_'] -= floor($r['max_'] / 100 * $min_yrn); + $r['Kmin_'] -= floor($r['Kmin_'] / 100 * ($min_yrn)); + $r['Kmax_'] -= floor($r['Kmax_'] / 100 * ($min_yrn)); + + $defd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = ' . $this->info['id'] . ' AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1')); + if ($defd[0] > 100) { + $defd[0] = 100; + } + $defd = 0 + $defd[0]; + $powd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = ' . $this->info['id'] . ' AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1')); + if ($powd[0] > 100) { + $powd[0] = 100; + } + $powd = 0 + $powd[0]; + $defd = $defd - $powd; + + $r['min'] -= floor($defd); + $r['max'] -= floor($defd); + $r['Kmin'] -= floor($defd * 2); + $r['Kmax'] -= floor($defd * 2); + $r['min_'] -= floor($defd); + $r['max_'] -= floor($defd); + $r['Kmin_'] -= floor($defd * 2); + $r['Kmax_'] -= floor($defd * 2); + + $r['min'] += $st1['maxAtack']; + $r['max'] += $st1['maxAtack']; + $r['Kmin'] += $st1['maxAtack'] * 2; + $r['Kmin'] += $st1['maxAtack'] * 2; + + if ($r['min'] < 1) { + $r['min'] = 1; + } + if ($r['max'] < 1) { + $r['max'] = 1; + } + if ($r['Kmin'] < 2) { + $r['Kmin'] = 2; + } + if ($r['Kmax'] < 2) { + $r['Kmax'] = 2; + } + if ($r['Kmin_'] < 2) { + $r['Kmin_'] = 2; + } + if ($r['Kmin_'] < 2) { + $r['Kmax_'] = 2; + } + + $r['m_k'] = $r['Kmax']; + + return $r; + } + + //Завершение действия приема + // pl прием + // u1 инфа юзера + // t1 тип снятия + // 99 = очищение кровью + // u2 + //$this->delPriem($pd[$k2][1][$k],${'p'.$k2},1,${'p'.$k2jn}); + public $del_val = []; + + public function delPriem( + $pl, + $u1, + $t = 1, + $u2 = false, + $rznm = 'Очиститься Кровью' + ) { + global $u; + if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { + if ($pl['x'] > 1) { + $pl['name'] = $pl['name'] . ' x' . $pl['x']; + } + if ($pl['timeUse'] == 77) { + //завершаем прием + mysql_query('DELETE FROM `eff_users` WHERE `id` = ' . $pl['id']); + } + $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login']; + if (isset($u2['id'])) { + $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login']; + } + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($t == 4) { + $mas1['id_hod']++; + $t = 2; + } + if ($t == 1) { + $mas1['id_hod']++; + if ($pl['priem']['file'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { + require('priems/' . $pl['priem']['file'] . '.php'); + } + } elseif ($pl['priem']['file3'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { + require('priems/' . $pl['priem']['file3'] . '.php'); + } + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; + $this->del_val['eff'][$pl['priem']['id']] = true; + } + } elseif ($t == 2) { + $mas1['text'] = '{tm1} У персонажа {u1} закончилось действие магии "' . $pl['name'] . '".'; + } elseif ($t == 99) { + $mas1['text'] = '{u1} Снял эфект "' . $pl['name'] . '" с помощью ' . $rznm . ' .'; + } else { + if ($t == 100) { + $mas1['id_hod']++; + } + $mas1['text'] = '{tm1} Закончилось действие эффекта "' . $pl['name'] . '" для {u1}.'; + } + if ($pl['priem']['id'] != 24) { + $this->add_log($mas1); + } + $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); + } + } + + //Разбираем массив со статами + public function lookStats($m) + { + return json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $m . '}'), true); + } + + //Расчет МФ + + /** + * @param $type + * @param $mf + * @param $lvl1 [not used?] + * @param $lvl2 [not used?] + * @return int + */ + private function mfs($type, $mf, $lvl1 = null, $lvl2 = null) + { + $rval = 0; + switch ($type) { + case 1: + + //Крит + + if ($mf['amf'] < 0) { + $mf['amf'] = 0; + } + if ($mf['mf'] < 0) { + $mf['mf'] = 0; + } + if ($mf['mf'] > $mf['smf']) { + $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); + } + + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + if ($mf['amf'] >= 1) { + if ($mf['amf'] > 100) { + $mf['amf'] = 100; + } + if (($mf['amf'] * 100) >= mt_rand(1, 10000)) { + $rval = 100; + } + } + + break; + case 2: + + if ($mf['mf'] < 0) { + $mf['mf'] = 0; + } + if ($mf['amf'] < 0) { + $mf['amf'] = 0; + } + if ($mf['smf'] < 0) { + $mf['smf'] = 0; + } + if ($mf['asmf'] < 0) { + $mf['asmf'] = 0; + } + + if ($mf['mf'] > $mf['smf']) { + $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5 + } + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + if ($mf['asmf'] >= 0) // + { + if ($mf['asmf'] > 100) { + $mf['asmf'] = 100; + } + if ($mf['asmf'] >= rand(1, 100)) { + $rval = 0; + } + } + if ($mf['amf'] >= 0) { + if ($mf['amf'] > 100) { + $mf['amf'] = 100; + } + if ($mf['amf'] >= rand(1, 100)) { + $rval = 100; + } + } + break; + case 3: + if ($mf[1] < 1) { + $mf[1] = 1; + } + if ($mf[2] < 1) { + $mf[2] = 1; + } + + //Парирование + $rval = $mf[1] - $mf[2] / 2; + if ($rval > 75) { + $rval = 75; + } + if ($rval < 1) { + $rval = 1; + } + + break; + case 4: + $mf = round($mf * 0.6); + if ($mf < 1) { + $mf = 0; + } + if ($mf > 100) { + $mf = 100; + } + $rval = min($mf, 100); //пробой брони + break; + case 5: + if ($mf < 1) { + $mf = 0; + } + $rval = min($mf, 85); //блок щитом + break; + case 6: + //Контрудар + //$mf['a'] защита + //$mf['b'] атака + if ($mf['a'] > 0) { + if ($mf['b'] > 0) { + $rval = round($mf['a'] - ($mf['b'] / 2)); + } else { + $rval = $mf['a']; + } + } + + if ($rval < 1) { + $rval = 0; + } + if ($rval > 75) { + $rval = 75; + } + + break; + } + + return $this->get_chanse($rval) ? 1 : 0; + } + + public function get_chanse($percent) + { + if ($percent <= 0) { + return false; + } + return mt_rand(1, 100) <= max($percent, 100); + } + + //Смена противника + public function smena($uid, $auto = false, $lastdie = false) + { + global $u; + if (($auto || $u->info['smena'] <= 0) && !$auto) { + return 'У вас закончились смены противника'; + } + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] < 1) { + return 'Для вас поединок закончен, ожидайте пока завершат другие...'; + } + if ( + !isset($this->uids[$uid]) || + $uid == $u->info['id'] || + $this->users[$this->uids[$uid]]['team'] == $this->users[$this->uids[$u->info['id']]]['team'] + ) { + return 'Нельзя сменить на выбранную цель []'; + } + if (isset($this->ga[$u->info['id']][$uid]) && !$lastdie) { + return 'Нельзя сменить на выбранную цель!'; + } + if (ceil($this->stats[$this->uids[$uid]]['hpNow']) < 1) { + return 'Нельзя сменить, противник уже мертв'; + }//меняем противника + if (!$auto) { + $u->info['smena']--; + } + mysql_query('UPDATE `stats` SET `enemy` = ' . $uid . ',`smena` = ' . $u->info['smena'] . ' WHERE `id` = ' . $u->info['id']); + $u->info['enemy'] = $uid; + $this->users[$this->uids[$uid]]['smena'] = $u->info['smena']; + $this->users[$this->uids[$u->info['id']]]['enemy'] = $uid; + return 1; + } + + //авто-смена противника //ТУТ баг выбора + public function autoSmena() + { + global $u; + $ms = []; + $ms_all = []; + $ms_ansf = []; + $i = 0; + $j = 0; + $z = 0; + while ($i < count($this->users)) { + if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] > 0 && -($u->info['enemy']) != $this->users[$i]['id']) { + if (!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) { + $ms[$j] = $this->users[$i]['id']; + $j++; + } + if (!isset($this->uids[(-($u->info['enemy']))])) { + $ms_all[] = $this->users[$i]['id']; + } + if (isset($this->ga[$this->users[$i]['id']][$u->info['id']])) { + $ms_ansf[$z] = $this->users[$i]['id']; + $z++; + } + } + $i++; + } + $msh = []; + if ($j == 0 && $z == 0) { + $enemydie = 0; + + if (isset($this->stats[$this->uids[$u->info['enemy']]])) { + $u->info['enemy'] = 0; + $enemydie = 1; + } + + if ((!isset($this->uids[(-($u->info['enemy']))]) || $this->stats[$this->uids[(-($u->info['enemy']))]]['hpNow'] < 1) && ($u->info['enemy'] < 0 || $enemydie == 1)) { + $i = 0; + $j = 0; + while ($i < count($this->users)) { + if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] >= 1 && -($u->info['enemy']) != $this->users[$i]['id']) { + $ms[$j] = $this->users[$i]['id']; + $msh[$ms[$j]] = true; + $j++; + } + $i++; + } + } + } + + $ms = $ms[rand(0, $j - 1)]; + $ms_ansf = $ms_ansf[rand(0, $z - 1)]; + if ($z > 0) { + $this->smena($ms_ansf, true); + } elseif ($j > 0) { + if (isset($msh[$ms])) { + $this->smena($ms, true, true); + } else { + $this->smena($ms, true); + } + } else { + if ($u->info['enemy'] < 0) { + $smnr5 = $this->smena(-($u->info['enemy']), true); + unset($smnr5); + } + } + } + + //Действия бота (атака) + private function botAtack($uid, $pl, $tp) + { + $test_atack = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND (( + `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '" + ) OR ( + `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '" + )) LIMIT 1')); + + if ($tp == 1 && !isset($test_atack['id'])) { + $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); + $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { + $a = rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5); + $b = rand(1, 5); + mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")'); + } + } elseif ($tp == 2) { + //бот отвечает на удар + $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); + $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl['uid2'] . '" AND `hpNow` >= 1 LIMIT 1')); + if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { + $bot = $this->users[$this->uids[$pl['uid2']]]; + $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; + $a222 = rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5); + $a = explode('_', $a222); + $i = 1; + $na['id'] = time(); + while ($i <= 5) { + if (isset($a[$i - 1])) { + $a[$i - 1] = intval(round($a[$i - 1])); + if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { + $na['a'][$i] = $a[$i - 1]; + } else { + $na['a'][$i] = 0; + } + } + $i++; + } + $na['b'] = rand(1, 5); + //Проводим удар + + $this->atacks[$pl['id']]['a2'] = $a222; + $this->atacks[$pl['id']]['b2'] = $na['b']; + $this->startAtack($pl['id']); + } + } + //unset($test_uid,$test_pl,$test_atack); + } + + //Проверяем удары, приемы, свитки, зверей + public function testActions() + { + //проверяем удары + $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id`'); + $i = 0; + $botA = []; + $botR = []; + while ($pl = mysql_fetch_array($m)) { + //mysql_query('DELETE FROM `battle_act` WHERE `battle` = "'.$this->info['id'].'" AND `uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'"'); + $pluids = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl['uid1'] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl['uid2'] . '" AND `hpNow` <= 0) LIMIT 1')); + + $pltest = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1')); + if (isset($pltest['id'])) { + if (isset($pluids['hpNow'])) { + mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['time'] + $this->info['timeout'] > time()) { + //удар не пропущен по тайму, просто заносим данные + $this->atacks[$pl['id']] = $pl; + $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id']; + $this->ag[$pl['uid2']][$pl['uid1']] = $pl['id']; + if (isset($this->iBots[$pl['uid1']])) { + //ударил бот и нет ответа + $botA[$pl['uid1']] = $pl['id']; + } elseif (isset($this->iBots[$pl['uid2']])) { + //ударили бота и он не ответил + $botR[$pl['uid2']] = $pl['id']; + if ($this->users[$this->uids[$pl['uid2']]]['timeGo'] < time()) { + $this->botAtack($pl['uid1'], $pl, 2); + } + } + } else { + //пропуск по тайму + $pl['time'] = time(); + if ($pl['a1'] == 0 && $pl['a2'] == 0) { + //игрок 1 пропустил по тайму + $pl['out1'] = time(); + $pl['tout1'] = 1; + //игрок 2 пропустил по тайму + $pl['out2'] = time(); + $pl['tout2'] = 1; + } elseif ($pl['a1'] == 0) { + //игрок 1 пропустил по тайму + $pl['out1'] = time(); + $pl['tout1'] = 1; + } elseif ($pl['a2'] == 0) { + //игрок 2 пропустил по тайму + $pl['out2'] = time(); + $pl['tout2'] = 1; + } + //наносим удар по пропуску + $this->atacks[$pl['id']] = $pl; + $this->startAtack($pl['id']); + mysql_query('DELETE FROM `battle_act` WHERE `id` = ' . $pl['id']); + } + } + } + //тест удара + if ($this->uAtc['id'] > 0 && $this->na == 1) { + if ($pl['out1'] == 0 && $pl['out2'] == 0) { + //Может разменяться только тот кто бил + if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) { + $this->addNewAtack(); + } + } else { + $this->addNewAtack(); + } + } + //тест использования заклятий + + //тест использования приемов + + //тест, бот делает удары + while ($i < count($this->bots)) { + $bot = $this->bots[$i]; + if (isset($bot) && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['pass'] != 'saintlucia') //Тут проверка на бота saintlucia + { + $j = 0; + while ($j < count($this->users)) { + if ($this->info['razdel'] == 0) { + $tnbot = time() + rand(1, 1); + } else { + $tnbot = time() + rand(1, 2); + } + if ($this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']) { + if (isset($this->users[$j]) && $this->stats[$j]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && !isset($this->ga[$bot][$this->users[$j]['id']]) && !isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['id'] != $bot && $this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $this->botAtack($this->users[$j]['id'], $bot, 1); + mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); + } + } elseif (isset($this->users[$i]) && $this->users[$i]['bot'] > 0 && $this->stats[$i]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$i]['id'] != $bot && $this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->botAct($bot)) { + if (!isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time() && !isset($this->ag[$bot][$this->users[$i]['id']])) { + $this->botAtack($this->users[$i]['id'], $bot, 1); + mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']); + } elseif (isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $this->botAtack($bot, $this->users[$i]['id'], 1); + mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']); + } + } + } else { + //Удары между ботами + // + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1) { + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] = + rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] = + rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5); + $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] = + rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] = + rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5); + $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); + if (isset($this->ga[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { + if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { + $tnbot = time() + rand(3, 7); + if ($this->info['type'] == 329) { // тестовый бой + $tnbot = time() - 1; + } + $this->startAtack($this->ga[$bot][$this->users[$j]['id']]); + $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; + mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']); + } + } elseif (isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { + if ($this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['timeGo'] < time()) { + $this->startAtack($this->ag[$bot][$this->users[$j]['id']]); + $tnbot = time() + rand(3, 7); + if ($this->info['type'] == 329) { // тестовый бой + $tnbot = time() - 1; + } + $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; + mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']); + } + } + } + } + } + $j++; + } + } + $i++; + } + } + + //Действия бота + private function botAct($uid) + { + if ($this->users[$this->uids[$uid]]['bot'] > 0) { + if ($this->users[$this->uids[$uid]]['online'] < time() - 3) { + $this->users[$this->uids[$uid]]['online'] = time(); + mysql_query('UPDATE `users` SET `online` = unix_timestamp() WHERE `id` = ' . (int)$uid); + return true; + } elseif (rand(0, 2) == 1) { + return true; + } + } + return false; + } + + //получаем данные о поединке + public function battleInfo($id) + { + $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . (int)$id)); + if (isset($b['id'])) { + $this->hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = ' . $b['id'] . ' ORDER BY `id` DESC LIMIT 1')); + if (isset($this->hodID['id_hod'])) { + $this->hodID = $this->hodID['id_hod']; + } else { + $this->hodID = 0; + } + return $b; + } else { + return false; + } + } + + //наносим удар противнику + public function addAtack() + { + global $js; + if (isset($_POST['atack'], $_POST['block'])) { + $na = [ + 'id' => time(), + 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], + 'b' => intval(round($_POST['block'])), + ]; + + $a = explode('_', $_POST['atack']); + $i = 1; + + while ($i <= 5) { + if (isset($a[$i - 1])) { + $a[$i - 1] = intval(round($a[$i - 1])); + if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { + $na['a'][$i] = $a[$i - 1]; + } else { + $na['a'][$i] = 0; + } + } + $i++; + } + + if ($na['b'] < 1 || $na['b'] > 5) { + $na['b'] = 0; + } + + $this->uAtc = $na; + $js .= 'testClearZone();'; + } else { + $this->e = 'Выберите зоны удара и блока'; + } + } + + //выделяем пользователей + public function teamsTake() + { + global $u; + $rs = ''; + $ts = []; + $tsi = 0; + if ($this->info['id'] > 0) { + //данные о игроках в бою + $nxtlg = []; + $t = mysql_query('SELECT `u`.`room`,`u`.`no_ip`,`u`.`twink`,`u`.`stopexp`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); + $i = 0; + $bi = 0; + $up = ''; + if ($this->info['start2'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = ' . $this->info['id'] . ' AND `start2` = 0 LIMIT 1')); + if (isset($tststrt['id'])) { + mysql_query('UPDATE `battle` SET `start2` = unix_timestamp() WHERE `id` = ' . $this->info['id'] . ' LIMIT 1'); + } else { + $this->info['start2'] = time(); + } + } + while ($pl = mysql_fetch_array($t)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$i] = $pl; + $this->uids[$pl['id']] = $i; + + if ($this->info['start2'] == 0) { + mysql_query('UPDATE `users` SET `notrhod` = -1 WHERE `id` = ' . $this->users[$i]['id'] . ' LIMIT 1'); + $this->users[$i]['notrhod'] = -1; + } + + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$i] = $u->getStats($pl, 0, 0, false, $this->cached, true); + //Заносим старт + if ($this->info['start2'] == 0) { + if (!isset($ts[$this->users[$i]['team']])) { + $tsi++; + $ts[$this->users[$i]['team']] = $tsi; + } + + if ($this->users[$i]['level'] <= 7) { + $this->users[$i]['tactic7'] = floor(10 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] == 8) { + $this->users[$i]['tactic7'] = floor(20 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] == 9) { + $this->users[$i]['tactic7'] = floor(30 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($this->users[$i]['level'] >= 10) { + $this->users[$i]['tactic7'] = floor((40 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } + + if ($this->stats[$i]['s7'] > 49) { + mysql_query('UPDATE `eff_users` SET `delete`= unix_timestamp() WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `overType` = 101 AND `delete` = 0'); + mysql_query(" + INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + ( 22, '" . $this->stats[$i]['id'] . "', 'Спасение', 'add_spasenie=1', 101, 77, 0, '" . $this->stats[$i]['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); + "); + } + + + ##### + // Бафф Зверя animal_bonus + if ($this->users[$i]['animal'] > 0) { + $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); + if (isset($a['id']) && $a['eda'] >= 1) { + $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); + $anl = $anl['bonus']; + + $tpa = [ + 1 => 'cat', + 2 => 'owl', + 3 => 'wisp', + 4 => 'demon', + 5 => 'dog', + 6 => 'pig', + 7 => 'dragon', + ]; + $tpa2 = [ + 1 => 'Кота', + 2 => 'Совы', + 3 => 'Светляка', + 4 => 'Чертяки', + 5 => 'Пса', + 6 => 'Свина', + 7 => 'Дракона', + ]; + $tpa3 = [ + 1 => 'Кошачья Ловкость', + 2 => 'Интуиция Совы', + 3 => 'Сила Стихий', + 4 => 'Демоническая Сила', + 5 => 'Друг', + 6 => 'Полная Броня', + 7 => 'Инферно', + ]; + + mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 100 AND `delete` = 0'); + + mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $this->users[$i]['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $this->users[$i]['id'] . '")'); + + //добавление духа от дракона + if ($a['type'] == 7) { + if ($a['level'] == 10) { + $this->users[$i]['tactic7'] = floor((50 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($a['level'] == 11) { + $this->users[$i]['tactic7'] = floor((65 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } elseif ($a['level'] == 12) { + $this->users[$i]['tactic7'] = floor((90 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); + } + } + // + $anl = $this->lookStats($anl); + + $vLog = + 'time1=' . time() . + '||s1=' . $this->users[$i]['sex'] . + '||t1=' . $this->users[$i]['team'] . + '||login1=' . $this->users[$i]['login']; + $vLog .= + '||s2=1||t2=' . $this->users[$i]['team'] . + '||login2=' . $a['name'] . ' (Зверь ' . $this->users[$i]['login'] . ')'; + + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => 1, + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + + $ba = ''; + $i6 = 0; + while ($i6 < count($u->items['add'])) { + if (isset($anl['add_' . $u->items['add'][$i6]]) && $anl['add_' . $u->items['add'][$i6]] > 0) { + if ($u->items['add'][$i6] == 'mib1') { + $ba .= 'Броня головы: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib2') { + $ba .= 'Броня корпуса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib3') { + $ba .= 'Броня пояса: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ($u->items['add'][$i6] == 'mib4') { + $ba .= 'Броня ног: +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } elseif ( + $u->items['add'][$i6] != 'mab1' && + $u->items['add'][$i6] != 'mab2' && + $u->items['add'][$i6] != 'mab3' && + $u->items['add'][$i6] != 'mab4' + ) { + $ba .= $u->is[$u->items['add'][$i6]] . ': +' . $anl['add_' . $u->items['add'][$i6]] . ', '; + } + } + $i6++; + } + $ba = trim($ba, ', '); + if ($ba == '') { + $ba = 'Эффект отсутсвует'; + } + + $mas1['text'] = '{tm1} {u2} очнулся от медитации, и призвал заклятье "' . $tpa3[$a['type']] . ' [' . $a['level'] . ']" на {u1}. (' . $ba . ')'; + $nxtlg[] = $mas1; + mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "' . $a['id'] . '" LIMIT 1'); + $this->get_comment(); + } + } + + mysql_query('UPDATE `stats` SET `last_hp` = "0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7` = "' . ($this->users[$i]['tactic7']) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); + + $rs[$this->users[$i]['team']] .= $u->microLogin($this->users[$i], 2) . ', '; + } + $up .= '`uid` = "' . $pl['id'] . '" OR'; + //battle-user (статистика, начальная) + $mybu = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . mysql_real_escape_string($pl['id']) . '" LIMIT 1')); + if (!isset($mybu['id'])) { + //Пустое значение статистики для данного персонажа за текущий бой + $this->addstatuser($pl['id']); + } + $i++; + } + + $up = rtrim($up, ' OR'); + + //Заносим в лог начало поединка + + if ($this->info['start1'] == 0) { + $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start1` = "0" LIMIT 1')); + if (isset($tststrt['id'])) { + $upd = mysql_query('UPDATE `battle` SET `start1` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); + if ($upd) { + $i = 0; + $r = ''; + while ($i <= $tsi) { + if (isset($rs[$i]) && $rs[$i] != '') { + $r .= rtrim($rs[$i], ', ') . ' и '; + } + $i++; + } + $r = rtrim($r, ' и'); + $r = str_replace('"', '\\\\\"', $r); + $this->hodID++; + $time = time(); + $mass = [ + 'time' => $time, + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'vars' => "time1=$time||", + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $r = 'Часы показывали ' . date('d.m.Y H:i', + $this->info['time_start']) . ', когда ' . $r . ' бросили вызов друг другу.'; + mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $r . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); + + $this->info['start1'] = time(); + } + } + + if (!empty($nxtlg)) { + foreach ($nxtlg as $item) { + $this->add_log($item); + } + } + } + } + } + + //Возращаем зоны блока по умолчанию + private function restZonb($uid1, $uid2) + { + if ($this->stnZbVs[$uid1] > 0) { + $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid1]; + } + if ($this->stnZbVs[$uid2] > 0) { + $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid2]; + } + } + + //проверка блока (Визуальная) + public function testZonbVis() + { + global $u; + if ($this->stnZbVs == 0) { + $zb = $this->stats[$this->uids[$u->info['id']]]['zonb']; + $this->stnZbVs = $zb; + } else { + $zb = $this->stnZb; + } + $eu = $this->users[$this->uids[$u->info['id']]]['enemy']; + if ($zb > 3) { + $zb = 3; + } + if ( + !empty($eu) && + ($this->stats[$this->uids[$eu]]['weapon1'] == 1 || $this->stats[$this->uids[$eu]]['weapon2'] == 1) && + $this->stats[$this->uids[$u->info['id']]]['weapon1'] != 1 && $this->stats[$this->uids[$u->info['id']]]['weapon2'] != 1 + ) { + $zb -= 1; + } + if ($zb < 1) { + $zb = 1; + } + return $zb; + } + + //проверка блока + private function testZonb($uid, $uid2) + { + $zba = []; + + if ($this->stnZb[$uid] == 0) { + $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; + $this->stnZb[$uid] = $zba[1]; + } else { + $zba[1] = $this->stnZb[$uid]; + } + + if ($this->stnZb[$uid2] == 0) { + $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; + $this->stnZb[$uid] = $zba[2]; + } else { + $zba[2] = $this->stnZb[$uid2]; + } + + if ($zba[1] > 3) { + $zba[1] = 3; + } + if ($zba[2] > 3) { + $zba[2] = 3; + } + + //Блоки игрока 1 + if ( + ($this->stats[$this->uids[$uid2]]['weapon1'] == 1 || $this->stats[$this->uids[$uid2]]['weapon2'] == 1) && + $this->stats[$this->uids[$uid]]['weapon1'] != 1 && $this->stats[$this->uids[$uid]]['weapon2'] != 1 + ) { + $zba[1] -= 1; + } + + //Блоки игрока 2 + if ( + ($this->stats[$this->uids[$uid]]['weapon1'] == 1 || $this->stats[$this->uids[$uid]]['weapon2'] == 1) && + $this->stats[$this->uids[$uid2]]['weapon1'] != 1 && $this->stats[$this->uids[$uid2]]['weapon2'] != 1 + ) { + $zba[2] -= 1; + } + + if ($zba[1] < 1) { + $zba[1] = 1; + } + if ($zba[2] < 1) { + $zba[2] = 1; + } + + $this->stats[$this->uids[$uid]]['zonb'] = $zba[1]; + $this->stats[$this->uids[$uid2]]['zonb'] = $zba[2]; + if ( + $this->stats[$this->uids[$uid]]['min_zonb'] > 0 && + $this->stats[$this->uids[$uid]]['zonb'] < $this->stats[$this->uids[$uid]]['min_zonb'] + ) { + $this->stats[$this->uids[$uid]]['zonb'] = $this->stats[$this->uids[$uid]]['min_zonb']; + } + if ( + $this->stats[$this->uids[$uid2]]['min_zonb'] > 0 && + $this->stats[$this->uids[$uid2]]['zonb'] < $this->stats[$this->uids[$uid2]]['min_zonb'] + ) { + $this->stats[$this->uids[$uid2]]['zonb'] = $this->stats[$this->uids[$uid2]]['min_zonb']; + } + } + + //генерируем команды + public function genTeams($you) + { + $ret = ''; + $teams = []; + //выделяем пользователей + $i = 0; + $j = 1; + $tms = []; + + $teams[$this->users[$this->uids[$you]]['team']] = ''; + $tms[0] = $this->users[$this->uids[$you]]['team']; + + while ($i < count($this->uids)) { + if ($this->stats[$i]['hpNow'] > 0) { + if (!isset($teams[$this->users[$i]['team']])) { + $tms[$j] = $this->users[$i]['team']; + $j++; + } + if ($this->stats[$i]['hpNow'] < 0) { + $this->stats[$i]['hpNow'] = 0; + } + if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) { + $this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll']; + } + $a1ms = ''; + if ($this->ga[$this->users[$i]['id']][$you]) { + $a1mc = ''; + $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1')); + if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + $a1mc = 'color:red;'; + } + $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"'; + } elseif ($this->ag[$this->users[$i]['id']][$you]) { + $a1mc = ''; + $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1')); + if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + $a1mc = 'color:green;'; + } + $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"'; + } + if ($this->users[$i]['login2'] == '') { + $this->users[$i]['login2'] = $this->users[$i]['login']; + } + if ($this->users[$i]['align'] == 9) { + $this->stats[$i]['hpNow'] = $this->stats[$i]['hpNow'] / ($this->stats[$i]['hpAll'] / 100); + $this->stats[$i]['hpAll'] = '100%'; + } + $ldr = ''; + if ($this->users[$i]['lider'] == $this->info['id']) { + $ldr = 'users[$i]['team'] . '.gif \>'; + } + $teams[$this->users[$i]['team']] .= ', ' . $ldr . 'users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']'; + } + $i++; + } + + //генерируем команды + $i = 0; + while ($i < count($tms)) { + $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', '); + if ($teams[$tms[$i]] != '') { + $teams[$tms[$i]] = ' ' . $teams[$tms[$i]]; + $ret .= $teams[$tms[$i]]; + if (count($tms) > $i + 1) { + $ret .= '   против   '; + } + } + $i++; + } + return "genteam($ret);"; + } + + public function addTravm($uid, $type, $lvl) + { + $timeEnd = 0; + if ($type == 1) { + $name = 'Легкая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов + $data = 'add_s' . $stat . '=-' . $lvl; + $img = 'eff_travma1.gif'; + $v1 = 1; + } elseif ($type == 2) { + $name = 'Средняя травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(3, 5);// время травмы от 6 до 12 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 2); + $v1 = 2; + $img = 'eff_travma2.gif'; + } elseif ($type == 3) { + $name = 'Тяжелая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = rand(5, 7);// время травмы от 12 до 6 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 3); + $v1 = 3; + $img = 'eff_travma3.gif'; + } elseif ($type == 4) { + $name = 'Неизлечимая травма'; + $stat = rand(1, 3); // пока без духовности + $timeEnd = 24;// время травмы от 24 часа + $data = 'add_s' . $stat . '=-' . ($lvl * 50); + $v1 = 4; + $img = 'eff_travma4.gif'; + } + $timeEnd *= 3600; + + mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (0,unix_timestamp(), -1, ' . $name . ',' . $data . ',' . $uid . ', 4, ' . $img . ',' . $timeEnd . ', ' . $v1 . ')'); + mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (0,unix_timestamp(), -1, "Иммунитет: Защита от травм","add_notravma=1",' . $uid . ', 263, "cure1.gif",21600, "")'); + } + + public function testUserInfoBattle($uid) + { + global $u; + if (!isset($this->uids[$uid])) { + //Заносим данные об игроке снова (видимо он погиб и его стерло с инфо) + if (!isset($this->uids[$uid])) { + $this->uids[$uid] = count($this->users); + } + $this->users[$this->uids[$uid]] = mysql_fetch_array(mysql_query('SELECT + + `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, + `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, + `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, + `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, + + `st`.* + + FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $uid . '" LIMIT 1')); + $this->stats[$this->uids[$uid]] = $u->getStats($this->users[$this->uids[$uid]], 0, 0, false, false, true); + } + } + + ///----Спасение функция + public function spaCheck($u1) + { + if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { + mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"'); + if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) // + { + //Свиток спасения + // + if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) { + //Даем призрачку + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Призрачная защита', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5); + } elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) { + //Абсолютная защита + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Абсолютная защита', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75); + } elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) { + //Абсолютная защита x2 + mysql_query("INSERT INTO `eff_users` + (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (22, '" . $u1 . "', 'Защита Мироздателя', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);"); + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); + } + + if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { + $this->stats[$this->uids[$u1]]['hpNow'] = 1; + } + if ($this->stats[$this->uids[$u1]]['mpNow'] < 1) { + $this->stats[$this->uids[$u1]]['mpNow'] = 1; + } + if ($this->stats[$this->uids[$u1]]['hpNow'] > $this->stats[$this->uids[$u1]]['hpAll']) { + $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); + } + if ($this->stats[$this->uids[$u1]]['mpNow'] > $this->stats[$this->uids[$u1]]['mpAll']) { + $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); + } + + mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $u1 . ' AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'); + mysql_query('UPDATE `stats` SET `hpNow` = ' . $this->stats[$this->uids[$u1]]['hpNow'] . ',`mpNow` = ' . $this->stats[$this->uids[$u1]]['mpNow'] . ', `tactic7` = `tactic7` - 25 WHERE `id` = ' . $u1 . ' LIMIT 1'); + $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' убит...' . $this->stats[$this->uids[$u1]]['login'] . ' был спасен. '; + $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, + ' ', + $mas['text'], + ($this->hodID + 0) + ); + + + } else { + if (isset($this->stats[$this->uids[$u1]]['login'])) { + mysql_query('UPDATE `stats` SET `hpNow` = 0,`mpNow` = 0 WHERE `id` = ' . $u1 . ' LIMIT 1'); + $this->stats[$this->uids[$u1]]['hpNow'] = 0; + $this->users[$this->uids[$u1]]['hpNow'] = 0; + $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' погиб.'; + $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, + ' ', + $mas['text'], + ($this->hodID + 1) + //Удаляем размен из базы //ТУТ возможен лаг удаления + ); + mysql_query('DELETE FROM `battle_act` WHERE `uid1` = ' . $this->stats[$this->uids[$u1]]['id'] . ' OR `uid2` = ' . $this->stats[$this->uids[$u1]]['id'] . ' OR `uid2` = -' . $this->stats[$this->uids[$u1]]['id']); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $this->stats[$this->uids[$u1]]['id'] . ' AND `v1` = "priem" AND `delete` = 0'); + // v1 priem + } + } + } + } + //Конец спасения + + +} + +if (!defined('GAME')) { + die(); +} +ignore_user_abort(true); +ini_set('memory_limit', '512M'); + +$btl = new battleClass(new Db()); diff --git a/_incl_data/class/__chat_class.php b/_incl_data/class/__chat_class.php deleted file mode 100644 index 571470a1..00000000 --- a/_incl_data/class/__chat_class.php +++ /dev/null @@ -1,189 +0,0 @@ - array(0 => 'смеется',1 => 'посмеялся над [*%l*]'), - 'fingal' => array(0 => 'трет фингал',1 => 'щупает фингал у [*%l*]'), - 'eek' => array(0 => 'ошарашен',1 => 'ошарашен действиями [*%l*]'), - 'smoke' => array(0 => 'закуривает',1 => 'предлагает [*%l*] пойти покурить'), - 'hi' => array(0 => 'приветствует всех вокруг',1 => 'приветствует [*%l*]'), - 'bye' => array(0 => 'прощается со всеми и уходит',1 => 'прощается с [*%l*]'), - 'king' => array(0 => 'коронует себя :-)',1 => 'объявляет [*%l*] своим королем!'), - 'king2' => array(0 => 'коронует себя :-)',1 => 'объявляет [*%l*] своей королевой!'), - 'boks2' => array(0 => 'вызывает всех на поединок',1 => 'предлагает [*%l*] дружеский матч'), - 'boks' => array(0 => 'обещает побить любого, кто примет вызов!',1 => 'намекает [*%l*] на поединок'), - 'gent' => array(0 => 'предлагает считать себя благородным сэром',1 => 'считает [*%l*] джельтельменом'), - 'lady' => array(0 => 'предлагает считать себя благородной леди',1 => 'считает, что [*%l*] настоящая Леди'), - 'tongue' => array(0 => 'показывает окружающим язык',1 => 'показывает язык [*%l*]'), - 'smil' => array(0 => 'болтает без умолку',1 => 'считает, что [*%l*] говорит откровенную ерунду!'), - 'ponder' => array(0 => 'кое-что усиленно обдумывает',1 => 'обещает обмозговать предложение [*%l*]'), - 'bow' => array(0 => 'сохраняя достоинство, кивает окружающим',1 => 'сохраняя достоинство кивает [*%l*]'), - 'angel' => array(0 => 'считает себя Ангелом',1 => 'считает [*%l*] своим Ангелом'), - 'angel2' => array(0 => 'грезит об Ангелах',1 => 'думает что [*%l*] Ангел'), - 'hello' => array(0 => 'желает здравствовать окружающим',1 => 'желает здравствовать [*%l*]'), - 'dont' => array(0 => 'рекомендует окружающим не делать этого',1 => 'рекомендует [*%l*] не делать этого'), - 'idea' => array(0 => 'озарен свежей идеей!',1 => 'предлагает [*%l*] обсудить пару идей'), - 'mol' => array(0 => 'преклоняется перед окружающими',1 => 'преклоняется перед [*%l*]'), - 'super' => array(0 => 'считает, что мир хорош, все дамы - Леди, а Солнце - шар дающий свет!',1 => 'фанатеет от [*%l*]'), - 'beer' => array(0 => 'вспоминает про припрятаный в заначке эликсир...',1 => 'готов поделиться с [*%l*] припрятанным эликсиром!'), - 'drink' => array(0 => 'считает, что пора пить различные эликсиры',1 => 'предлагает [*%l*] пойти пропустить по стаканчику эликсира'), - 'baby' => array(0 => 'изображает малыша',1 => ' считает, что [*%l*] еще мал и неопытен для обоснованной критики'), - 'tongue2' => array(0 => ' показывает всяким врединам язык',1 => 'показывает [*%l*] язык, проявляя недовольство'), - 'sword' => array(0 => 'готов сразиться в честном поединке',1 => 'вызывает [*%l*] на честный поединок!'), - 'agree' => array(0 => 'пожимает руку собеседникам',1 => 'пожимает руку [*%l*]'), - 'loveya' => array(0 => 'преисполнен чувства любви',1 => 'преисполнен чувства любви к [*%l*]'), - 'kiss' => array(0 => 'целует всех',1 => 'целует [*%l*]'), - 'kiss2' => array(0 => 'хочет нежно поцеловать кого-то...',1 => 'нежно целует [*%l*]'), - 'kiss3' => array(0 => 'кое-кого целует...',1 => 'нежно целует [*%l*]'), - 'kiss4' => array(0 => 'кое-кого целует...',1 => 'хочет уединиться с [*%l*] и целоваться...'), - 'rose' => array(0 => 'хочет кому-то подарить розу, но стесняется...',1 => 'дарит [*%l*] ароматную розу...'), - 'love' => array(0 => 'думает только о любви...',1 => 'думает, что [loginfrom] + [*%l*]= любовь!'), - 'love2' => array(0 => 'мечтает о свадьбе...',1 => 'мечтает о свадьбе с [*%l*]'), - 'confused' => array(0 => 'в недоумении...',1 => 'недоумевает от [*%l*]'), - 'yes' => array(0 => 'кивает в знак согласия',1 => 'кивает [*%l*] в знак согласия'), - 'no' => array(0 => 'мотает головой в знак протеста',1 => 'мотает головой [*%l*] в знак протеста'), - 'shuffle' => array(0 => 'в смущении от таких обстоятельств',1 => 'в смущении от [*%l*]'), - 'nono' => array(0 => 'выражает категорическое несогласие!',1 => 'выражает категорическое несогласение с [*%l*]'), - 'maniac' => array(0 => 'знает точно наперед - сегодня кто-нибудь умрет...',1 => 'считает, что [*%l*] пора бы уже стать жертвой маньяка...'), - 'privet' => array(0 => 'почтительно приветствует окружающих',1 => 'почтительно приветствует [*%l*]'), - 'ok' => array(0 => 'считает, что это замечательная идея',1 => 'считает, что [*%l*] движется в правильном направлении'), - 'ninja' => array(0 => 'угрожает окружающим тайным мастерством!',1 => 'угрожает [*%l*] мастерством древних'), - 'pif' => array(0 => 'ищет подходящую мишень',1 => 'думает, что сложно промахнуться по [*%l*]'), - 'smash' => array(0 => 'собирается крушить и ломать',1 => 'хочет сломать пару-тройку костей у [*%l*]'), - 'alien' => array(0 => 'считает, что мир захватили мутанты!',1 => ' считает, что [*%l*] еще тот мутант!'), - 'pirate' => array(0 => 'подумывает, кого бы ограбить!...',1 => 'считает, что лучшей жертвы чем [*%l*], не найти!'), - 'gun' => array(0 => 'хочет повысить кое-кому уровень железа в организме... :gun:',1 => 'считает, что у [*%l*] маловато железа в организме! :gun:'), - 'trup' => array(0 => 'падает замертво',1 => 'считает, что [*%l*], живет слишком долго, и пора бы это исправить!'), - 'mdr' => array(0 => 'считает, что у него есть отличный способ решения разногласий... :mdr:',1 => 'предлагает [*%l*] культурно отдохнуть :mdr:'), - 'sneeze' => array(0 => 'громко чихает',1 => 'чихает на [*%l*], обрызгивая его слюнями с ног до головы!'), - 'mad' => array(0 => 'просто в бешенстве!!!',1 => 'в бешенстве от [*%l*]!!!'), - 'friday' => array(0 => 'культурно отдыхает...',1 => 'предлагает [*%l*] культурно отдохнуть'), - 'cry' => array(0 => 'безудержно рыдает',1 => 'рыдает на плече у [*%l*]'), - 'grust' => array(0 => 'грустит...',1 => 'грустит о [*%l*]'), - 'rupor' => array(0 => 'пытается докричаться до окружающих',1 => 'пытается докричаться до [*%l*]'), - 'fie' => array(0 => 'умоляет: НЕТ, только не ЭТО!!!',1 => 'умоляет [*%l*] о пощаде!'), - 'nnn' => array(0 => 'ничего не видит, не слышит, и никому не скажет...',1 => 'ничего не видел, не слышал и не помнит о [*%l*]'), - 'row' => array(0 => 'находится в бешенстве и ищет с кем бы пообщаться...',1 => 'собирается выяснить отношения с [*%l*]'), - 'red' => array(0 => 'смущаясь краснеет...',1 => 'краснеет от [*%l*]'), - 'lick' => array(0 => 'облизнулся, в предвкушении',1 => 'облизывается при виде [*%l*]'), - 'help' => array(0 => 'нуждается в срочной помощи!',1 => 'просит помощи у [*%l*]'), - 'wink' => array(0 => 'подмигивает окружающим',1 => 'подмигивает [*%l*]'), - 'jeer' => array(0 => 'посмеивается над ситуацией...',1 => 'посмеивается над [*%l*]'), - 'tease' => array(0 => 'дразнится',1 => 'дразнит [*%l*]'), - 'nunu' => array(0 => 'недоволен окружающими...',1 => 'недоволен [*%l*]'), - 'inv' => array(0 => 'хочет найти свои зубы...',1 => 'жалуется [*%l*] на трудности жизни инвалида...'), - 'duel' => array(0 => 'собирается проткнуть кое-кого...',1 => 'вызывает [*%l*] на дуэль!'), - 'susel' => array(0 => 'Напевая: "эээххх ухнеееемм, да ещеее ууухнеем.." высматривает в толпе подходящий пондер...',1 => 'предлагает [*%l*] отхватить прямо по пондеру!'), - 'nun' => array(0 => 'угрожает окружающим палочками для риса',1 => 'показывает [*%l*] как надо пользоваться палочками для риса'), - 'kruger' => array(0 => 'ненавязчиво объясняет окружающим кого тут надо бояться :kruger:',1 => 'демонстрирует [*%l*] нестриженные когти'), - 'flowers' => array(0 => 'учится выхватывать букет Ромашек-21 из-за спины одним движением',1 => 'целует [*%l*] и дарит букет ромашек'), - 'horse' => array(0 => 'патрулирует границы Бойцовского Клуба',1 => 'предлагает [*%l*] порубать всех врагов в капусту! :horse:'), - 'hug' => array(0 => 'готов обнять всех в комнате!',1 => 'крепко обнимает [*%l*]'), - 'str' => array(0 => 'в ужасе покрывается ледяным потом!',1 => 'в ужасе прячется от [*%l*]'), - 'alch' => array(0 => 'напоминает окружающим о вечных ценностях :alch:',1 => 'предлагает [*%l*] приобщиться к вечным ценностям :alch:'), - 'pal' => array(0 => ' напоминает, что из под робы выпирает крест, а не что-то там! :-)',1 => 'требует от [*%l*] предъявить документы в развернутом виде!'), - 'mag' => array(0 => 'читает заклинания. Вслух. По слогам.',1 => 'произносит страшное колдунство на [*%l*]'), - 'sniper' => array(0 => 'изображает из себя Вильгельма Теля',1 => 'предлагает [*%l*] поиграть в Вильгельма Теля'), - 'fuck' => array(0 => 'повторяет позы камасутры',1 => 'предлагает [*%l*] повторить позы камасутры вместе'), - 'rotate' => array(0 => 'катается от смеха по полу',1 => 'катается по полу от смеха над [*%l*]') - ); - - public function expworld($txt,$vl) - { - $words = explode(' ',$txt); $j = 0; $i = -1; - while($i < count($words)) - { - $i++; - if(isset($words[$i])) - { - if(strlen($words[$i]) > $vl){ $words[$i] = substr($words[$i],0,$vl).' '.substr($words[$i],$vl); $i = 0; $j++; $txt = implode(' ', $words); $words = explode(' ',$txt); } - } - } - $txt = implode(' ',$words); - return $txt; - } - - public function str_count($str,$col) - { - if (strlen($str) > $col) - { - $str = substr($str,0,$col); - } - return ($str); - } - - public function smileText($text,$tol,$room,$city) - { - $retxt = ''; $j = 0; - $txt = str_replace('/','⁄',$text).' '; - - if(preg_match("/⁄(.*?) /", $txt, $retxt)) - { - if(isset($this->smilesWorld[$retxt[1]])) - { - if($tol == '') - { - $tol = str_replace('⁄'.$retxt[1].' ','',$txt); - $tol = trim($tol,' '); - } - if($tol == '') - { - $txt = ''.$this->smilesWorld[$retxt[1]][0].''; - }else{ - $mbl = mysql_fetch_array(mysql_query('SELECT `online`,`id`,`login`,`room`,`city` FROM `users` WHERE `room`="'.$room.'" AND `online` > '.(time()-520).' AND `city` = "'.$city.'" AND `login`="'.mysql_real_escape_string($tol).'" LIMIT 1')); - if(isset($mbl['id'])) - { - $txt = ''.$this->smilesWorld[$retxt[1]][1].''; - $txt = str_replace('[*%l*]','[login:'.$tol.']',$txt); - }else{ - $txt = 'USER IS FALSE'; - } - } - $j = 1; - } - } - - if($j == 1) - { - $text = $txt; - }else{ - $text = false; - } - - return $text; - } - - public function send($color,$room,$city,$from,$to,$text,$time,$type,$toChat,$spam,$sound,$new = 0) - { - //mysql_query('LOCK TABLES chat WRITE'); - - mysql_query("INSERT INTO `chat` (`new`,`sound`,`color`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`spam`) VALUES ('".$new."','".$sound."','".$color."','".$city."','".$room."','".$from."','".$to."','".$text."','".$time."','".$type."','".$toChat."','".$spam."')"); - - //mysql_query('UNLOCK TABLES'); - - $msg_id = mysql_insert_id(); - return $msg_id; - } - - public function jsmsg($id,$time,$to,$from,$type,$ch,$e,$see,$js = 0,$cl = '#000000',$typeTime = NULL) - { - $tm = date('H:i',$time); - if($typeTime==1) - { - $tm = date('d.m.Y H:i',$time); - } - $rt = 'top.addMessage(\''.$id.'\',\''.$tm.'\',\''.$to.' \',\''.$from.'\',\''.$type.'\',\''.$ch.'\'," '.$e.' ",\''.$see.'\',\''.$cl.'\');'; - if($js==1) - { - $rt = ''; - } - return $rt; - } -} -$chat = new Chat(); -?> \ No newline at end of file diff --git a/_incl_data/class/__db_connect.php b/_incl_data/class/__db_connect.php index cfdf0366..d2eb0076 100644 --- a/_incl_data/class/__db_connect.php +++ b/_incl_data/class/__db_connect.php @@ -1,28 +1,38 @@ 'localhost', // server + 'd' => 'newcom1_abk', // database + 'u' => 'newcom1_abk', // user + 'p' => '4nWYsIM[c?}P' // password +]; +$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d']; + +if (function_exists('date_default_timezone_set')) { + date_default_timezone_set('Europe/Moscow'); } -$dbgo = mysql_pconnect('localhost','newcom1_abk','4nWYsIM[c?}P'); -mysql_select_db('newcom1_abk',$dbgo); +$dbgo = mysql_pconnect($db['s'], $db['u'], $db['p']); +mysql_select_db($db['d'], $dbgo); mysql_query('SET NAMES cp1251'); -if(!function_exists('GetRealIp')) { - function GetRealIpTest(){ - if (!empty($_SERVER['HTTP_CLIENT_IP'])) - return $_SERVER['HTTP_CLIENT_IP']; - else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - return $_SERVER['HTTP_X_FORWARDED_FOR']; - return $_SERVER['REMOTE_ADDR']; - } - $ipban = GetRealIpTest(); -}else{ - $ipban = GetRealIp(); +if (!function_exists('GetRealIp')) { + function GetRealIpTest() + { + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { + return $_SERVER['HTTP_CLIENT_IP']; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + return $_SERVER['HTTP_X_FORWARDED_FOR']; + } + return $_SERVER['REMOTE_ADDR']; + } + + $ipban = GetRealIpTest(); +} else { + $ipban = GetRealIp(); } -$pdo = new PDO('mysql:host=localhost;dbname=newcom1_abk', 'newcom1_abk', '4nWYsIM[c?}P'); \ No newline at end of file +$pdo = new PDO($dsn, $db['u'], $db['p'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES cp1251"]); \ No newline at end of file diff --git a/_incl_data/class/__dungeon.php b/_incl_data/class/__dungeon.php deleted file mode 100644 index 87d254dc..00000000 --- a/_incl_data/class/__dungeon.php +++ /dev/null @@ -1,1956 +0,0 @@ - array() //карта - ) ,$id_dng,$cord = array('x' => 0),$sg = array(1 => array(1=>1,2=>2,3=>3,4=>4),2 => array(1=>2,2=>3,3=>4,4=>1),3 => array(1=>3,2=>4,3=>1,4=>2),4 => array(1=>4,2=>1,3=>2,4=>3)); - public function start() - { - global $u,$c,$code; - $this->info = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "'.$u->info['dnow'].'" LIMIT 1')); - $this->id_dng = $this->info['id2']; - $this->gs = $u->info['s']; - if($this->gs<1 || $this->gs>4) - { - $this->gs = 1; - } - - - if($this->info['bsid']>0) - { - $this->bs = mysql_fetch_assoc(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "'.$u->info['city'].'" AND `id` = "'.$this->info['bsid'].'" AND `time_start` = "'.$this->info['time_start'].'" LIMIT 1')); - if(isset($this->bs['id'])) - { - //Если БС закончена - /*if($this->bs['users']-$this->bs['users_finish'] < 2) - { - $u->bsfinish($this->bs,false,NULL); - }*/ - } - } - - - - if(isset($_GET['itm_luck']) && $this->info['bsid'] == 0) { - $this->itm_luck((int)$_GET['itm_luck']); - }elseif(isset($_GET['itm_unluck']) && $this->info['bsid'] == 0) { - $this->itm_unluck((int)$_GET['itm_unluck']); - }elseif(isset($_GET['atack'])){ - $this->atack((int)$_GET['atack']); - }elseif(isset($_GET['take'])){ - $this->takeinv((int)$_GET['take']); - }elseif(isset($_GET['take_obj'])){ - $this->takeit((int)$_GET['take_obj']); - }elseif(isset($_GET['look'])){ - if((int)$_GET['look']==1){ - if($this->gs==1) - { - $this->gs = 2; - }elseif($this->gs==2) - { - $this->gs = 3; - }elseif($this->gs==3) - { - $this->gs = 4; - }elseif($this->gs==4) - { - $this->gs = 1; - } - }elseif((int)$_GET['look']==2) - { - if($this->gs==1) - { - $this->gs = 4; - }elseif($this->gs==2) - { - $this->gs = 1; - }elseif($this->gs==3) - { - $this->gs = 2; - }elseif($this->gs==4) - { - $this->gs = 3; - } - } - mysql_query('UPDATE `stats` SET `s` = "'.((int)$this->gs).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['s'] = $this->gs; - }elseif(isset($_GET['go'])) - { - //перемещение - $this->testGo((int)$_GET['go']); - } - - /* генерируем вид персонажа (только карта) - $this->gs = 1; //смотрим прямо - 2; //смотрим лево - 3; //смотрим вниз - 4; //смотрим право - ( ( ( `y` >= '.$u->info['y'].' && `y` <= '.($u->info['y']+4).' ) && ( `x` >= '.($u->info['x']-1).' && `x` <= '.($u->info['x']+1).' ) ) || ( (`x` = '.($u->info['x']+2).' || `x` = '.($u->info['x']-2).') && ( `y` = '.($u->info['y']+3).' || `y` = '.($u->info['y']+4).' ) ) ) - */ - - $whr = array( - 1 => ' ((`x` <= '.($u->info['x']+2).' && `x` >= '.($u->info['x']-2).') && (`y` >= '.$u->info['y'].' && `y` <= '.($u->info['y']+4).')) ', //прямо - 3 => ' ((`x` <= '.($u->info['x']+2).' && `x` >= '.($u->info['x']-2).') && (`y` <= '.$u->info['y'].' && `y` >= '.($u->info['y']-4).')) ', //вниз - 2 => ' ((`x` <= '.$u->info['x'].' && `x` >= '.($u->info['x']-4).') && (`y` <= '.($u->info['y']+2).' && `y` >= '.($u->info['y']-2).')) ', //лево - 4 => ' ((`x` >= '.$u->info['x'].' && `x` <= '.($u->info['x']+4).') && (`y` <= '.($u->info['y']+2).' && `y` >= '.($u->info['y']-2).')) ' //право - ); - - $i = 1; - $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$this->id_dng.'" AND '.$whr[$this->gs].' ORDER BY `y` ASC , `x` ASC LIMIT 25'); - while($pl = mysql_fetch_assoc($sp)) - { - $this->map[0][$pl['y'].'_'.$pl['x']] = $pl; - $i++; - } - $this->map['good'] = $i; //целых клеток - $this->map[1] = $this->genMatix(); - $this->lookDungeon(); - } - - public function pickitem($obj,$itm,$for, $data = '',$dn_delete = false, $chat = 0) { - global $u; - $itm = mysql_fetch_assoc(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$itm.'" LIMIT 1')); - if( isset($itm['id']) ) { - $tou = 0; //какому юзеру предназначено - /* выделяем случайного юзера из команды */ - $itmnm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$itmz[0].'" 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'].'", и вы решили разыграть его'; - } - if($dn_delete == true) { $dn_delete = 1; } else { $dn_delete = 0; } - if($chat == 0) { - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1','1')"); - } - $ins = 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 $ins; - } - } -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($d->info['id2']==3){ - $rb = 293; // Вход в Катакомбы - }elseif($d->info['id2']==1){ - $rb = 188; // Вход в Канализацию - }elseif($d->info['id2']==13){ - $rb = 275; // Гора Легиона - }elseif($d->info['id2']==12){ - $rb = 372; // Вход в Пещеру Тысячи Проклятий - }elseif($d->info['id2']==444){ - $rb = 321; // Вход в пещеру инкв - }elseif($d->info['id2']==31){ - $rb = 321; // Вход в пещеру инкв - }elseif($d->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 = array(); - 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 .= '
    ' . $witm[53] . '
    - -
      '.$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'] && $d->info['id2'] != 15) { - $r .= ' '; - $r .= ' '; - } -$r .= '

    '; -$r .= ''; - } - unset($stt,$ph,$pm); - return $r; - } - - public function atack($id) { - global $u,$c,$code; - $bot = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_bots` WHERE `id2` = "'.$id.'" AND `for_dn` = "0" AND `dn` = "'.$this->info['id'].'" AND `delete` = "0" LIMIT 1')); - if(isset($bot['id2'])){ - if( ($u->info['x'] != $bot['x'] || $bot['y'] != $u->info['y']) && $this->testLike($u->info['x'],$u->info['y'],$bot['x'],$bot['y']) == 1 ){ - //Создаем подеинок - $tbtl = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle` WHERE `dn_id` = "'.$this->info['id'].'" AND `team_win` = "-1" AND `x` = "'.$bot['x'].'" AND `y` = "'.$bot['y'].'" LIMIT 1')); - if(isset($tbtl['id'])) { - //вступаем в поединок - mysql_query('UPDATE `users` SET `battle` = "'.$tbtl['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - /*#$this->error = 'Нападаем ... '; // */ - //header('location: main.php'); - die(''); - } else { - $btl_id = 0; - //$expB = -77.77; - $expB = 0; - $btl = array( - 'players'=>'', - 'timeout'=>120, - 'type'=>0, - 'invis'=>0, - 'noinc'=>0, - 'travmChance'=>0, - 'typeBattle'=>0, - 'addExp'=>$expB, - 'money'=>0 - ); - - $ins = 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'].'")'); - $btl_id = mysql_insert_id(); - - if($btl_id>0) { - //Добавляем ботов - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `dn` = "'.$this->info['id'].'" AND `x` = "'.$bot['x'].'" AND `y` = "'.$bot['y'].'" AND `delete` = "0" LIMIT 1001'); - $j = 0; $logins_bot = array(); - while($pl = mysql_fetch_assoc($sp)){ - $jui = 1; - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$btl_id.'" WHERE `id2` = "'.$pl['id2'].'" LIMIT 1'); - while($jui<=$pl['colvo']){ - $k = $u->addNewbot($pl['id_bot'],NULL,NULL,$logins_bot); - $logins_bot = $k['logins_bot']; - if($k!=false){ - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $upd = mysql_query('UPDATE `stats` SET `x`="'.$bot['x'].'",`y`="'.$bot['y'].'",`team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $j++; - } - } - } - $jui++; - } - } - unset($logins_bot); - if($j>0){ - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - /*#$this->error = 'Нападаем ...';// */ - // - //header('location: main.php'); - die(''); - }else{ - $this->error = 'Не удалось напасть, ошибка обьекта нападения ...'; - } - }else{ - $this->error = 'Не удалось создать поединок ...'; - } - } - }else{ - $this->error = 'Не удалось напасть ...'; - } - } else { - if(isset($this->bs['id']) || $this->info['id2'] == 15) { - $bot = mysql_fetch_assoc(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(($u->info['x']!=$bot['x'] || $bot['y']!=$u->info['y']) && $this->testLike($u->info['x'],$u->info['y'],$bot['x'],$bot['y'])==1){ - //Создаем подеинок - $tbtl = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle` WHERE `dn_id` = "'.$this->info['id'].'" AND `team_win` = "-1" AND `x` = "'.$bot['x'].'" AND `y` = "'.$bot['y'].'" LIMIT 1')); - //die('Нападения временно запрещены. ['.$tbtl['id'].'] 5-10 мин.'); - if(isset($tbtl['id'])){ - //вступаем в поединок - $lstm = mysql_fetch_assoc(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle`="'.$tbtl['id'].'" ORDER BY `st`.`team` DESC LIMIT 1')); - mysql_query('UPDATE `users` SET `battle` = "'.$tbtl['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $nextteam = $lstm['team']+1; - mysql_query('UPDATE `stats` SET `team` = "'.$nextteam.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `x` = "'.$bot['x'].'", `y` = "'.$bot['y'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - if( $this->info['bsid'] > 0 ) { - - $me_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); - $usr_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$bot['id'].'" AND `login` = "'.$bot['login'].'" LIMIT 1')); - mysql_query('UPDATE `stats` SET `tactic7`= 20.000 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Заносим в лог БС - if( $u->info['sex'] == 0 ) { - $text = '{u1} вмешался в поединок напав на {u2} »»'; - }else{ - $text = '{u1} вмешалася в поединок напав на {u2} »»'; - } - if( isset($usr_real['id'])) { - $usrreal = ''; - if( $usr_real['align'] > 0 ) { - $usrreal .= ''; - } - if( $usr_real['clan'] > 0 ) { - $usrreal .= ''; - } - $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - if( isset($me_real['id']) ) { - $mereal = ''; - if( $me_real['align'] > 0 ) { - $mereal .= ''; - } - if( $me_real['clan'] > 0 ) { - $mereal .= ''; - } - $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}',$mereal,$text); - $text = str_replace('{u2}',$usrreal,$text); - //Добавляем в лог БС - 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'].'", - "'.round($this->bs['money']*0.85,2).'","'.$i.'" - )'); - // - } - // - $this->error = 'Нападаем ... '; - }else{ - $btl_id = 0; - //$expB = -77.77; - if($this->info['id2'] == 1) { - $expB = 200; - } - $btl = array( - 'players'=>'', - 'timeout'=>40, - 'type'=>0, - 'invis'=>0, - 'noinc'=>0, - 'travmChance'=>0, - 'typeBattle'=>0, - 'addExp'=>$expB, - 'money'=>0, - 'inTurnir' => 0 - ); - - if( $this->info['bsid'] > 0 ) { - $btl['inTurnir'] = $this->info['bsid']; - } - - $ins = mysql_query('INSERT INTO `battle` (`inTurnir`,`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( - "'.$btl['inTurnir'].'", - "'.$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(); - mysql_query('UPDATE `stats` SET `x` = "'.$bot['x'].'", `y` = "'.$bot['y'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `x` = "'.$bot['x'].'", `y` = "'.$bot['y'].'" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - - if($btl_id>0) - { - //Добавляем ботов - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - - if($u->stats['hpNow'] < 1) { - $u->stats['hpNow'] = 1; - mysql_query('UPDATE `stats` SET `hpNow` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `lose` = `lose` + 1 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - if($bot['hpNow'] < 1) { - $bot['hpNow'] = 1; - mysql_query('UPDATE `stats` SET `hpNow` = "1" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `lose` = `lose` + 1 WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - } - - if( $this->info['bsid'] > 0 ) { - - $me_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); - $usr_real = mysql_fetch_assoc(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$bot['id'].'" AND `login` = "'.$bot['login'].'" LIMIT 1')); - - //Заносим в лог БС - if( $u->info['sex'] == 0 ) { - $text = '{u1} напал на {u2} завязался бой »»'; - }else{ - $text = '{u1} напала на {u2} завязался бой »»'; - } - if( isset($usr_real['id'])) { - $usrreal = ''; - if( $usr_real['align'] > 0 ) { - $usrreal .= ''; - } - if( $usr_real['clan'] > 0 ) { - $usrreal .= ''; - } - $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - if( isset($me_real['id']) ) { - $mereal = ''; - if( $me_real['align'] > 0 ) { - $mereal .= ''; - } - if( $me_real['clan'] > 0 ) { - $mereal .= ''; - } - $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}',$mereal,$text); - $text = str_replace('{u2}',$usrreal,$text); - //Добавляем в лог БС - 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'].'", - "'.round($this->bs['money']*0.85,2).'","'.$i.'" - )'); - // - } - - $this->error = 'Нападаем ... '; - }else{ - $this->error = 'Не удалось создать поединок ...'; - } - } - }else{ - $this->error = 'Не удалось напасть ...'; - } - }else{ - $this->error = 'Не удалось напасть, слишком далеко (id'.$id.') ...'; - } - } - } - - 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 $itbs = array( - 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) { - global $u; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1','1')"); - } - - public function takeit($id) { - global $u,$c,$code,$magic; - $obj = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_obj` WHERE `id` = "'.$id.'" AND `for_dn` = "0" AND `dn` = "'.$this->info['id'].'" LIMIT 1')); - if(isset($obj['id'])) { - $tbot = mysql_fetch_assoc(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "'.$obj['x'].'" AND `y` = "'.$obj['y'].'" AND `dn` = "'.$this->info['id'].'" AND `for_dn` = "0" AND `delete` = "0" LIMIT 1')); - - - $i = 0; - # Создаем МАССИВ { $act_sl['save_pos'] = "save_pos" }или { $act_sl['port'] = "10:20" } - $act_sl = array(); - $act_sm = explode('|',$obj['action']); - while( $i < count($act_sm) ) { - $s = explode(':',$act_sm[$i]); - if(isset($s[1]) && $s[1] !='' ){ - $act_sl[$s[0]] = $s[1]; - } else { - $act_sl[$s[0]] = $s[0]; - } - $i++; - } - - if( isset($tbot['id2']) ) { - $this->error = 'Не удалось, что-то или кто-то мешает ...'; - } elseif($this->testLike($u->info['x'],$u->info['y'],$obj['x'],$obj['y'])!=1) { - $this->error = 'Не удалось, слишком далеко ...!'; - } else { - $a = explode('|',$obj['action']); - $r = ''; - $i = 0; - while( $i < count($a) ) { - $s = explode(':',$a[$i]); - - if( $s[0] == 'kill_bot' ) { - //Требуется убить ботов - $t = explode(',',$s[1]); - $tr_gd = 0; - - //Проверяем кого нужно убить и убили-ли - $j = 1; $jn = 0; - while($j < count($t)) { - $itm = explode('.',$t[$j]); - //[0] - x , [1] - y - $bot_itm = mysql_fetch_assoc(mysql_query('SELECT `u`.`id2`,`st`.`login` 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`.`x` = "'.$itm[0].'" AND `u`.`y` = "'.$itm[1].'" AND `u`.`delete` = "0" LIMIT 10')); - if(isset($bot_itm['id2'])){ - $jn++; - } - $j++; - } - - if($jn == 0) { - $tr_gd = 1; - } - - unset($itm,$bot_itm,$jn); - if($tr_gd == 0) { - if($t[0]=='0'){ - $r .= 'Не удалось, что-то или кто-то мешает ...'; - }else{ - $r .= $t[0]; - } - $i = count($a); - } - }elseif($s[0]=='kill_bot_d') { - //Требуется убить ботов (все боты нападают , если что-то не так ) - $t = explode(',',$s[1]); - $tr_gd = 0; - - //Проверяем кого нужно убить и убили-ли - $j = 1; $jn = 0; - $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')); - while($j < count($t)) { - $itm = explode('.',$t[$j]); - //[0] - x , [1] - y - $bot_itm_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`.`x` = "'.$itm[0].'" AND `u`.`y` = "'.$itm[1].'" AND `u`.`delete` = "0" LIMIT 50'); - while( $bot_itm = mysql_fetch_assoc($bot_itm_sp) ) { - $jn++; - $this->botAtack($bot_itm,$u->info,1); - } - $j++; - } - - if($jn == 0) { - $tr_gd = 1; - } - - unset($itm,$bot_itm,$jn); - if($tr_gd == 0) { - if($t[0]=='0'){ - $r .= 'Не удалось, что-то или кто-то мешает ...'; - }else{ - $r .= $t[0]; - } - $r .= ' Монстры начали атаковать вас!'; - $i = count($a); - } - }elseif($s[0]=='ditm') { - //требует предмет для действия - $j = 0; - $t = explode(',',$s[1]); - $tr_gd = 1; - while($j" (x'.$itm[1].') был утрачен...
    '; - $j++; - } - }elseif($s[0]=='tritm') { - //требует предмет для действия - $j = 0; - $t = explode(',',$s[1]); - $j = 0; - $tr_gd = 1; - while($j" (x'.$itm[1].')
    '; - } - $j++; - } - if(rand(0,10000)>$itm[2]*100) { - $tr_gd = 0; - $r .= 'Странно, но ничего не произошло...
    '; - } - if($tr_gd == 1) { - //все отлично - }else{ - $i = count($a); - } - } elseif($s[0] == 'repl_ptp') { - require_once('dnaction/_dungeon_replace.php'); - die(); - //header('Location: ../../modules_data/location/_dungeon_replace.php'); - }elseif($s[0]=='add_eff') { - //Кастуем эффект - $t = explode(',',$s[1]); - $j = 0; - while($jtestAction('`vars` = "add_eff_'.$this->info['id'].'_'.$obj['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT '.(1+(int)$itm[2]).'',2); //кол-во прошлых попыток - $ch = $ch[0]; - $ch2 = $u->testAction(' `vars` = "add_eff_'.$this->info['id'].'_'.$obj['id'].'" LIMIT '.(1+(int)$itm[4]).'',2); //кол-во прошлых попыток (все юзеры) - $ch2 = $ch2[0]; - if(($ch2 < $itm[4] || $itm[4]==0) && $ch < $itm[2]) { - if($itm[1]*100 >= rand(0,10000)) { - //удачно - $eff_d = mysql_fetch_assoc(mysql_query('SELECT `id2`,`mname` FROM `eff_main` WHERE `id2` = "'.$itm[0].'" LIMIT 1')); - if(isset($eff_d['id2'])) { - //добавляем эффект - $us = $magic->add_eff($u->info['id'],$itm[0],1); - if($us[0]==1) { - $r .= '
    На Вас наложили заклятие "'.$eff_d['mname'].'".
    '; - }else{ - $r .= '
    Что-то пошло не так... Ощущается чье-то присутствие...
    '; - } - }else{ - $r .= '
    Что-то пошло не так... Слышен чей-то вой...
    '; - } - unset($eff_d,$us); - }else{ - //не удачно - $r .= '
    Не удалось...
    '; - } - $u->addAction(time(),'add_eff_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - }else{ - //уже нельзя юзать - $r .= '
    Что-то пошло не так...
    '; - } - - unset($ch,$ch2); - $j++; - } - }elseif($s[0]=='mfast') { - //Добавляем баф //Ловушки и бафы - $j = 0; - $t = explode(',',$s[1]); - while($jtestAction('`vars` = "bafit_'.$this->info['id'].'_'.$obj['id'].'" LIMIT '.(1+(int)$itm[2]).'',2); //кол-во прошлых попыток - $ch = $ch[0]; - if($ch<$itm[3]) - { - if($itm[2]*1000>=rand(1,100000)) - { - if($itm[0] == 'hpNow') { - $mm = explode('r',$itm[1]); - if($mm[1]!=0) { - $itm[1] = rand($mm[0],$mm[1]); - } - if($itm[1]<0) { - $r .= '
    Вы попали в ловушку... Здоровье: '.$itm[1].' HP
    '; - }elseif($itm[1]>0){ - $r .= '
    Вы прикоснулись к магии... Здоровье: +'.$itm[1].' HP
    '; - } - $u->info['hpNow'] += $itm[1]; - if($u->info['hpNow']<1) { - $r .= '
    Вы перемещены в точку возрождения...
    '; - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'",`x` = "'.$u->info['res_x'].'",`y` = "'.$u->info['res_y'].'",`s` = "'.$u->info['res_s'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - } - $u->addAction(time(),'bafit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - } - //записываем попытку - $j++; - } - }elseif($s[0]=='save_pos') { - if( isset($act_sl['port']) ) { - $itm = explode('=',$act_sl['port']); - $obj['x'] = $itm[0]; - $obj['y'] = $itm[1]; - } - #$r .= 'Позиция сохранена. Теперь после смерти вы оживете здесь.'; - mysql_query('UPDATE `stats` SET `res_x` = "'.$obj['x'].'",`res_y` = "'.$obj['y'].'",`res_s` = "'.$u->info['s'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif($s[0]=='look_text') { - $itm = explode('=',$s[1]); - $r .= $itm[rand(0,count($itm)-1)]; - }elseif($s[0]=='save_pos_xy'){ - $itm = explode('=',$s[1]); - $u->info['res_x'] = $itm[0]; - $u->info['res_y'] = $itm[1]; - $upd = mysql_query('UPDATE `stats` SET `res_x` = "'.$u->info['x'].'",`res_y` = "'.$u->info['y'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($upd){ - $r .= 'Вы куда-то переместились... на этот раз удачно...
    '; - }else{ - $r .= 'Что-то здесь не так ...'; - } - }elseif($s[0]=='port'){ - //телепортирует пользователя - $itm = explode('=',$s[1]); - $u->info['x'] = $itm[0]; - $u->info['y'] = $itm[1]; - $upd = mysql_query('UPDATE `stats` SET - `x` = "'.$u->info['x'].'",`y` = "'.$u->info['y'].'" - WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($upd) - { - $r .= 'Вы куда-то переместились... на этот раз удачно...
    '; - }else{ - $r .= 'Что-то здесь не так ...'; - } - } elseif($s[0] == 'save_port') { - $itm = explode('=', $s[1]); - $u->info['res_x'] = $itm[0]; - $u->info['res_y'] = $itm[1]; - $upd = mysql_query('UPDATE `stats` SET `res_x` = "'.$u->info['res_x'].'", `res_y` = "'.$u->info['res_y'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } elseif($s[0]=='itm') - { - //Добавляем предмет - $j = 0; - $t = explode(',',$s[1]); - while($jtestAction('`uid` = "'.$u->info['id'].'" AND `vars` = "takeit_'.$this->info['id'].'_'.$obj['id'].'" LIMIT '.(1+(int)$itm[2]).'',2); //кол-во прошлых попыток - $ch = $ch[0]; - if($ch>=$itm[2]) - { - //закончились попытки - $r = 'ничего не произошло...
    '; - }else{ - if($itm[1]*1000>=rand(1,100000)) - { - - //Случайный предмет (Башня смерти) - if($itm[0] == 'random1') { - $itm[0] = $this->itbs[rand(0,count($this->itbs))]; - } - - //удачная попытка - $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="'.((int)$itm[0]).'" LIMIT 1')); - if(isset($it['id'])) - { - $r .= 'Вы обнаружили предмет "'.$it['name'].'".
    '; - $this->addItem(array('uid'=>$u->info['id'],'iid'=>$it['id'],'time'=>time(),'x'=>$u->info['x'],'y'=>$u->info['y'],'bid'=>0,'del'=>(int)$itm[4])); - } - }else{ - //неудачная попытка - $r .= 'Вы ничего не нашли ...
    '; - } - $u->addAction(time(),'takeit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - } - //записываем попытку - $j++; - } - }elseif($s[0]=='itm1') - { - //Добавляем предмет , только 1 предмет из всех и все юзеры могут тоже - $nj = 0; - $t = explode(',',$s[1]); - $j = rand(0,count($t)); - if($nj == 0) { - $itm = explode('=',$t[$j]); - $ch = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "takeit_'.$this->info['id'].'_'.$obj['id'].'" LIMIT '.(1+(int)$itm[2]).'',2); //кол-во прошлых попыток - $ch = $ch[0]; - if($ch>=$itm[2]) - { - //закончились попытки - $r .= 'Странно, но ничего не произошло...
    '; - }else{ - if($itm[1]*1000>=rand(1,100000)) - { - - //Случайный предмет (Башня смерти) - if($itm[0] == 'random1') { - $itm[0] = $this->itbs[rand(0,count($this->itbs))]; - } - - //удачная попытка - $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="'.((int)$itm[0]).'" LIMIT 1')); - if(isset($it['id'])) - { - $r .= 'Вы обнаружили предмет "'.$it['name'].'".
    '; - $u->addAction(time(),'takeit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - $this->addItem(array('uid'=>$u->info['id'],'iid'=>$it['id'],'time'=>time(),'x'=>$u->info['x'],'y'=>$u->info['y'],'bid'=>0,'del'=>(int)$itm[4])); - $nj++; - } - }else{ - //неудачная попытка - $u->addAction(time(),'takeit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - $r .= 'Вы ничего не нашли ...
    '; - } - } - } - }elseif($s[0]=='itm2') - { - //Добавляем предмет , только 1 предмет из всех и только 1 юзер может поднять - $nj = 0; - $t = explode(',',$s[1]); - $j = rand(0,count($t)-1); - if($nj == 0) { - $itm = explode('=',$t[$j]); - $ch = $u->testAction('`vars` = "takeit_'.$this->info['id'].'_'.$obj['id'].'" LIMIT '.(1+(int)$itm[2]).'',2); //кол-во прошлых попыток - $ch = $ch[0]; - if($ch>=$itm[2]) - { - //закончились попытки - $r .= 'Ничего не произошло...
    '; - }else{ - if($itm[1]*1000>=rand(1,100000)) - { - - //Случайный предмет (Башня смерти) - if($itm[0] == 'random1') { - $itm[0] = $this->itbs[rand(0,count($this->itbs))]; - } - - //удачная попытка - $it = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id`="'.((int)$itm[0]).'" LIMIT 1')); - if(isset($it['id'])) - { - $r .= 'Вы обнаружили предмет "'.$it['name'].'".
    '; - $u->addAction(time(),'takeit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - $this->addItem(array('uid'=>$u->info['id'],'iid'=>$it['id'],'time'=>time(),'x'=>$u->info['x'],'y'=>$u->info['y'],'bid'=>0,'del'=>(int)$itm[4])); - $nj++; - } - }else{ - //неудачная попытка - $u->addAction(time(),'takeit_'.$this->info['id'].'_'.$obj['id'],$u->info['city']); - $r .= 'Вы ничего не нашли ...
    '; - } - } - } - }elseif($s[0]=='fileact') { - require('dnaction/'.$s[1].'.php'); - } - $i++; - } - $r = rtrim($r,'\'); - if($r=='') - { - $r = 'В этот раз не удалось найти что-либо еще'; - } - $this->error = $r; - } - }else{ - $this->error = 'Предмет не найден ...'; - } - } - - public function addItem($i) - { - //добавляем предмет в пещеру (возможно выпал из бота или из сундука) - $ins = 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']).'")'); - return $ins; - } - - 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 = array( - '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 = $u->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 .= ' (Квест)'; - } - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1','1')"); - } - - $this->error = 'Вы подняли "'.$it['name'].'"'; - }else{ - $this->error = 'Не удалось найти предмет ...'; - } - }else{ - $this->error = 'Не удалось добавить предмет в инвентарь ...'; - } - } - } - } - } - } - - - //Розыгрыш предмета - public function test_luck($id) { - global $u; - $fxv = array( - '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['itm']['user'] > 0 ) { - - }elseif( $fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time']+300 < time() ) { - $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'] = array(); - $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 = array( - '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 = array( - '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']) ) { - //Розыгрыш - if( $this->info['bsid'] == 0 ) { - $action = 'javascript: top.fartgame(\''.$pl['id'].'\',\''.$pl['img'].'\',\''.$pl['name'].'\',1,\'\');'; - $tk = 1; - } - }else{ - //$action = 'javascript:alert(\'Вы уже учавствуете в розыгрыше данного предмета\');'; - } - } - //href="'.$action.'" - 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 = array( - 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 = array(); - 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 = array(); - $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'].'}'; - } else if( $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 = array(); - $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'].'}'; - } - } - } - $r = 'count:'.$i.$r; - return $r; - } - - public function botAtack($bot,$uid,$bs) { - global $u,$c,$code; - $user = mysql_fetch_assoc(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "'.$uid['id'].'" LIMIT 1')); - - if($user['battle']>0){ - $btli = mysql_fetch_assoc(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['battle'].'" AND `team_win` = "-1" LIMIT 1')); - } - - if( !isset($btli['id']) ) { //Создаем поединок - $btl_id = 0; - $expB = 0; - $btl = array('players'=>'', 'timeout'=>120, 'type'=>0, 'invis'=>0, 'noinc'=>0, 'travmChance'=>0, 'typeBattle'=>0, 'addExp'=>$expB, 'money'=>0 ); - - $ins = 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'].'")'); - - $btl_id = mysql_insert_id(); - - if( $btl_id > 0 ) { //Добавляем ботов - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `delete` = "0" AND `dn` = "'.$this->info['id'].'" AND `id2` = "'.$bot['id2'].'" LIMIT 1'); // Только тот, который напал и жив ли он? - $j = 0; - $logins_bot = array(); - while($pl = mysql_fetch_assoc($sp)) { - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$btl_id.'" WHERE `id2` = "'.$bot['id2'].'" LIMIT 1'); - $jui = 1; - while($jui<=$pl['colvo']) { - $k = $u->addNewbot($pl['id_bot'],NULL,NULL,$logins_bot); - $logins_bot = $k['logins_bot']; - if( $k!=false ) { - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) { - $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) { - $j++; - } - } - } - $jui++; - } - } - unset($logins_bot); - if( $j>0 ) { - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - } - } - } else { - $btl_id = $btli['id']; - //Добавляем ботов - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `delete` = "0" AND `dn` = "'.$this->info['id'].'" AND `id2` = "'.$bot['id2'].'" LIMIT 1'); - $j = 0; $logins_bot = array(); - $logins_bot_text =array(); - $logins_bot_vars =array('time1='.time().''); - while( $pl = mysql_fetch_assoc($sp) ) { - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$btl_id.'" WHERE `id2` = "'.$bot['id2'].'" LIMIT 1'); - $jui = 1; - while($jui<=$pl['colvo']){ - $k = $u->addNewbot($pl['id_bot'],NULL,NULL,$logins_bot); - $logins_bot = $k['logins_bot']; - $logins_bot_text[] = ' '.$k['login'].''; - if($k!=false){ - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $j++; - } - } - } - $jui++; - } - if( $j>0 ){ - $logins_bot_text = '{tm1} В поединок вмешались: '.implode(', ',$logins_bot_text).'.'; - $logins_bot_vars = implode('||',$logins_bot_vars); - $battle_log = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle_logs` WHERE `battle`='.$btl_id.' ORDER BY `id_hod` DESC LIMIT 1')); - 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)'); - } - } - } - unset($logins_bot); - if( $j > 0 ) { - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - } - } - } - - 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 = array( - 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 = array(); - 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.'}'; - } - - $r = 'count:'.$i.$r; - //$wd = $this->cord['2_0']; - return $r; - } - - public function testGo($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 = array( - 4=>1, - 2=>2, - 1=>3, - 3=>4 - ); - if(isset($thp['id']) && $thp['go_'.$ng[$go]]==0) - { - $go = 0; - } - $tgo = array(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; - } - - $tmap = 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')); - //наличие предмета - if($tmap['tr_items']!='') - { - $ti = explode(',',$tmap['tr_items']); - $i = 0; $trnit = ''; - while($i0 && $ti2[1]>0) - { - $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "'.((int)$ti2[0]).'" LIMIT '.((int)$ti2[1]).'')); - if($num_rows < (int)$ti2[1]) - { - $tgo = $ti2[2]; - if($tgo!='0000') - { - if($tgo[$ng[$go]-1]==1) - { - $go = 0; - $trm = mysql_fetch_assoc(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.((int)$ti2[0]).'" LIMIT 1')); - $trnit .= '"'.$trm['name'].'", '; - } - } - } - } - $i++; - } - if($trnit!='') - { - $trnit = rtrim($trnit,', '); - $this->error = 'У вас нет подходящего предмета. Требуется '.$trnit; - } - } - - $tmGo = $u->info['timeGo']-time(); //сколько секунд осталось - if($tmGo>0) - { - $go = 0; - $this->error = 'Не так быстро...'; - } - - if($u->aves['now']>=$u->aves['max']) - { - $go = 0; - $this->error = 'Вы не можете перемещаться, рюкзак переполнен ...'; - } - - if($go>0) - { - if($go==1) - { - $u->info['y'] += 1; - }elseif($go==2) - { - $u->info['x'] -= 1; - }elseif($go==3) - { - $u->info['y'] -= 1; - }elseif($go==4) - { - $u->info['x'] += 1; - } - if( $u->stats['speed_dungeon'] > 0 ) { - $tmap['timeGO'] = round($tmap['timeGO']/100*(100-$u->stats['speed_dungeon'])); - if( $tmap['timeGO'] < 2 ) { - $tmap['timeGO'] = 1; - } - } - $u->info['timeGo'] = time()+$tmap['timeGO']; - $u->info['timeGoL'] = time(); - $tmap0 = mysql_fetch_assoc(mysql_query('SELECT `id`,`teleport` FROM `dungeon_map` WHERE `id_dng` = "'.$tmap['id_dng'].'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'" LIMIT 1')); - if( $tmap0['teleport'] > 0 ){ - $tmap1 = mysql_fetch_assoc(mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id` = "'.$tmap0['teleport'].'" LIMIT 1')); - if( isset($tmap1['id']) ) { - $u->info['x'] = $tmap1['x']; - $u->info['y'] = $tmap1['y']; - $this->error = 'Вы переместились в другую комнату...'; - } - } - $upd = mysql_query('UPDATE `stats` SET `x` = "'.$u->info['x'].'",`y` = "'.$u->info['y'].'",`timeGo` = "'.$u->info['timeGo'].'",`timeGoL` = "'.$u->info['timeGoL'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - unset($id); - } - } - - 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 = array( - 4=>1, - 2=>2, - 1=>3, - 3=>4 - ); - if(isset($thp['id']) && $thp['go_'.$ng[$go]]==0) - { - $go = 0; - } - $tgo = array(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; - } - - $tmap = 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')); - //наличие предмета - /* - if($tmap['tr_items']!='') - { - $ti = explode(',',$tmap['tr_items']); - $i = 0; $trnit = ''; - while($i0 && $ti2[1]>0) - { - $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "'.((int)$ti2[0]).'" LIMIT '.((int)$ti2[1]).'')); - if($num_rows < (int)$ti2[1]) - { - $tgo = $ti2[2]; - if($tgo!='0000') - { - if($tgo[$ng[$go]-1]==1) - { - $go = 0; - } - } - } - } - $i++; - } - } - */ - - 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)]; - } - return $r; - } - - public function lookDungeon() - { - global $u,$c,$code,$pd; - /* Генерируем изображение карты */ - /* LEVEL 1 */ - - // Исправления от 29/10/2014 относительно D5, 2 этаж, ПТП. Покрутиться и все гуд. и от 22/11/2014 для обратных стен. Если стена к нам задницей, мы её не видим. - if($this->testSt(2,4)>0 /* || $this->testSt(3,2)>0 */){ $pd[28] = 1; } - if(/*$this->testSt(1,4)>0 ||*/ $this->testSt(2,2)>0){ $pd[27] = 1; } - if($this->testSt(2,1)>0 /*|| $this->testSt(5,3)>0*/){ $pd[26] = 1; } - if($this->testSt(3,1)>0/* || $this->testSt(6,3)>0*/){ $pd[25] = 1; } - if($this->testSt(1,1)>0 /*|| $this->testSt(4,3)>0*/){ $pd[24] = 1; } - /* LEVEL 2 */ - if($this->testSt(5,4)>0 /*|| $this->testSt(6,2)>0*/){ $pd[23] = 1; } - if(/*$this->testSt(4,4)>0 || */$this->testSt(5,2)>0){ $pd[22] = 1; } - if($this->testSt(5,1)>0 /*|| $this->testSt(8,3)>0*/){ $pd[21] = 1; } - if($this->testSt(6,1)>0 /*|| $this->testSt(7,3)>0*/){ $pd[20] = 1; } - if($this->testSt(4,1)>0/* || $this->testSt(9,3)>0*/){ $pd[19] = 1; } - - /* LEVEL 3 */ - if($this->testSt(8,4)>0 /*|| $this->testSt(7,2)>0*/){ $pd[18] = 1; } - if(/*$this->testSt(9,4)>0 || */$this->testSt(8,2)>0){ $pd[17] = 1; } - if($this->testSt(8,1)>0 /* || $this->testSt(12,3)>0*/){ $pd[16] = 1; } - if($this->testSt(7,1)>0 /* || $this->testSt(13,3)>0*/){ $pd[15] = 1; } - if($this->testSt(9,1)>0 /*|| $this->testSt(11,3)>0*/){ $pd[14] = 1; } - - /* LEVEL 4 */ - - if($this->testSt(12,4)>0 || $this->testSt(13,2)>0){ $pd[13] = 1; } - if($this->testSt(12,2)>0 || $this->testSt(11,4)>0){ $pd[12] = 1; } - if($this->testSt(13,1)>0 || $this->testSt(17,3)>0){ $pd[11] = 1; } //8 - if($this->testSt(11,1)>0 || $this->testSt(16,3)>0){ $pd[10] = 1; } //7 - if($this->testSt(12,1)>0/* || $this->testSt(15,3)>0*/){ $pd[9] = 1; } - if($this->testSt(14,1)>0 || $this->testSt(18,3)>0){ $pd[6] = 1; } //2 - if($this->testSt(10,1)>0 || $this->testSt(19,3)>0){ $pd[5] = 1; } //1 - if($this->testSt(16,4)>0 || $this->testSt(15,2)>0){ $pd[4] = 1; } - if($this->testSt(15,4)>0 || $this->testSt(17,2)>0){ $pd[3] = 1; } - - /* Генерируем предметы на карте */ - - /* Генерируем персонажей и ботов на карте */ - - } - - 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 genMatix() - { - $r = array(); - 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); - } - return $r; - } -} - -$d = new dungeon; -$d->start(); -?> \ No newline at end of file diff --git a/_incl_data/class/__magic.php.bac b/_incl_data/class/__magic.php.bac deleted file mode 100644 index 6935600f..00000000 --- a/_incl_data/class/__magic.php.bac +++ /dev/null @@ -1,2482 +0,0 @@ - 1, //Зелье Могущества - //264 => 1, //Снадобье Великана - //306 => 1, //Нектар Великана - //383 => 1, //Големский - - //Пристрастие на ловкость - //8 => 2, - //265 => 2, - //308 => 2, //Нектар Змеи - //385 => 2, //Големский - - //Пристрастие на интуицию - //7 => 3, - //266 => 3, - //307 => 3, //Нектар Предчувствия - //384 => 3, //Големский - - //Пристрастие на Интеллект - //9 => 4, - //267 => 4, - //309 => 4, //Нектар Разума - //333 => 4, - //405 => 4, //Големский - - //Пристрастие на Защиту от урона - //14 => 5, - //27 => 5, - //37 => 5, - //361 => 5, - - //Пристрастие на Защиту от колющего урона - //10 => 6, - //Пристрастие на Защиту от рубящего урона - //12 => 7, - //Пристрастие на Защиту от дробящего урона - //13 => 8, - //Пристрастие на Защиту от режущего урона - //11 => 9, - - //Пристрастие на Защиту от магии - //28 => 10, - //38 => 10, - //362 => 10, - //369 => 10, - - //Пристрастие на Защиту от огня - 272 => 11, - 370 => 11, - //Пристрастие на Защиту от воды - 334 => 12, - 275 => 12, - 372 => 12, - //Пристрастие на Защиту от воздуха - 274 => 13, - 373 => 13, - //Пристрастие на Защиту от земли - 273 => 14, - 374 => 14, - - //Восстановление здоровья - 268 => 15, - //Восстановление маны - 300 => 16, - - 10000000000000 => 0 - );*/ - - /*Пристрастия (Снимается эффект) - public $pgtype_second = array( - //Пристрастие на Защиту от урона - 14 => array(6,7,8,9), - 27 => array(6,7,8,9), - 37 => array(6,7,8,9), - 361 => array(6,7,8,9), - - //Пристрастие на Защиту от колющего урона - 10 => array(5,7,8,9), - //Пристрастие на Защиту от рубящего урона - 12 => array(6,5,8,9), - //Пристрастие на Защиту от дробящего урона - 13 => array(6,7,5,9), - //Пристрастие на Защиту от режущего урона - 11 => array(6,7,8,5), - - //Пристрастие на Защиту от магии - //28 => 10, - //38 => 10, - - //Пристрастие на Защиту от огня - 272 => array( 10 , 11 , 12 , 13 , 14 ), - 370 => array( 10 , 11 , 12 , 13 , 14 ), - //Пристрастие на Защиту от воды - 334 => array( 10 , 11 , 12 , 13 , 14 ), - 275 => array( 10 , 11 , 12 , 13 , 14 ), - 372 => array( 10 , 11 , 12 , 13 , 14 ), - //Пристрастие на Защиту от воздуха - 274 => array( 10 , 11 , 12 , 13 , 14 ), - 373 => array( 10 , 11 , 12 , 13 , 14 ), - //Пристрастие на Защиту от земли - 273 => array( 10 , 11 , 12 , 13 , 14 ), - 374 => array( 10 , 11 , 12 , 13 , 14 ), - - //Восстановление здоровья - //268 => 15, - //Восстановление маны - //300 => 16, - - 10000000000000 => 0 - ); - - //Параметры пристрастия - //Название , максимальный уровень , негативный эффект , сколько времени длится каждый уровень в сутках , имя негативного параметра - public $pgpar = array( - 1 => array('Сила', 25, 29, 1.2, 's1', 301), - 2 => array('Ловкость', 25, 29, 1.2, 's2', 302), - 3 => array('Интуиция', 25, 29, 1.2, 's3', 303), - 4 => array('Интеллект', 25, 29, 1.2, 's5', 304), - - 5 => array('Защита от урона', 25, 175, 1.2, 'za', 321), - 6 => array('Защита от колющего урона', 25, 98, 1.2, 'za1', 322), - 7 => array('Защита от рубящего урона', 25, 98, 1.2, 'za2', 323), - 8 => array('Защита от дробящего урона', 25, 98, 1.2, 'za3', 324), - 9 => array('Защита от режущего урона', 25, 98, 1.2, 'za4', 325), - - 10 => array('Защита от магии', 25, 175, 1.2, 'zm', 326), - 11 => array('Защита от магии огня', 25, 98, 1.2, 'zm1', 327), - 12 => array('Защита от магии воды', 25, 98, 1.2, 'zm3', 328), - 13 => array('Защита от магии воздуха', 25, 98, 1.2, 'zm2', 329), - 14 => array('Защита от магии земли', 25, 98, 1.2, 'zm4', 330), - - 15 => array('Восстановление HP', 25, 294, 1.2, 'speedhp', 331), - 16 => array('Восстановление MP', 25, 294, 1.2, 'speedmp', 332) - ); - - //Действия элика под пристрастием - public $pgel = array( - //сила - 1 => array(5), //Зелье Могущества - 264 => array(7), //Снадобье Великана - 306 => array(7), - 383 => array(6), - //ловкость - 8 => array(5), - 265 => array(7), - 308 => array(7), - 385 => array(6), - //интуиция - 7 => array(5), - 266 => array(7), - 307 => array(7), - 384 => array(6), - //Интеллект - 9 => array(5), - 267 => array(7), - 309 => array(7), - 333 => array(5), - 405 => array(6), - //Защита от урона - 14 => array(12), - 27 => array(18), - 37 => array(25), - 361 => array(45), - //Защита от колющего урона - 10 => array(12), - //Защита от режущего урона - 11 => array(12), - //Защита от рубящего урона - 12 => array(12), - //Защита от дробящего урона - 13 => array(12), - //Защита от магии - 369 => array(8), - 28 => array(18), - 38 => array(25), - 362 => array(45), - - //Защита от магии воды - 334 => array(18), //Снадобье Океанов - // - 272 => array(12), - 273 => array(12), - 274 => array(12), - 275 => array(12), - // - 370 => array(20), - 372 => array(20), - 373 => array(20), - 374 => array(20), - // - //Восстановление НР - 268 => array(75), - //Восстановление МР - 300 => array(75) - ); - - //Эликсиры разгона пристрастий - public $elrazgon = array( 405 => true , 383 => true , 384 => true , 385 => true ); - - public function paguba( $eff ) { - //global $u; - if(isset($this->pgtype[$eff['id2']])) { - global $u; - $re = ''; - - $tp = $this->pgtype[$eff['id2']]; - $tp_sec = $this->pgtype_second[$eff['id2']]; - $v = $this->pgpar[$tp]; - $el = $this->pgel[$eff['id2']]; - $pgb = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp.'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); - if( is_array($tp_sec) ) { - $i = 0; - while( $i < count($tp_sec) ) { - if( $tp_sec[$i] > 0 ) { - $pgb_ref = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp_sec[$i].'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); - if( isset($pgb_ref['id']) ) { - $lvl = explode('[',$pgb['name']); - $lvl = explode(']',$lvl[1]); - $lvl = $lvl[0]; - mysql_query('UPDATE `eff_users` SET `deactiveTime` = "'.(time()+$eff['actionTime']).'", `timeUse` = "'.(time()+floor($lvl*$this->pgpar[$tp_sec[$i]][3]*86400)).'" WHERE `id` = "'.$pgb_ref['id'].'" LIMIT 1'); - } - } - $i++; - } - unset($pgb_ref,$i); - } - if(!isset($pgb['id'])) { - //Пристрастия нет, но оно может появиться, шанс 10% - $prc11 = 5; - if( $this->elrazgon[$eff['id2']] == true ) { - $prc11 = 101; - } - if(rand(0,100) < $prc11) { - //Добавляем пристрастие - $d = 'add_'.$v[4].'=-'.ceil($v[2]/$v[1]*1); - mysql_query('INSERT INTO `eff_users` (`v1`,`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`,`deactiveTime`) VALUES ("pgb'.$tp.'","0","'.$v[5].'","'.$u->info['id'].'","Пагубное пристрастие [1]","'.(time()+floor($v[3]*86400)).'","'.$d.'","0","'.(time()+$eff['actionTime']).'")'); - } - }else{ - $lvl = explode('[',$pgb['name']); - $lvl = explode(']',$lvl[1]); - $lvl = $lvl[0]; - $prc11 = 7; - if( $this->elrazgon[$eff['id2']] == true ) { - $prc11 = 101; - } - //Пристрастия есть и возможно повысить его уровень 5% , если прошло 75% времени эликсира - if(rand(0,100) < $prc11 && $lvl < $v[1]) { - //Добавляем новое пристрастие - $lvl++; - $d = 'add_'.$v[4].'=-'.ceil($v[2]/$v[1]*$lvl); - mysql_query('DELETE FROM `eff_users` WHERE `id` = "'.$pgb['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `eff_users` (`v1`,`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`,`deactiveTime`) VALUES ("pgb'.$tp.'","0","'.$v[5].'","'.$u->info['id'].'","Пагубное пристрастие ['.$lvl.']","'.(time()+floor($lvl*$v[3]*86400)).'","'.$d.'","0","'.(time()+$eff['actionTime']).'")'); - $pgb = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp.'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" RODER BY `id` DESC LIMIT 1')); - }else{ - //Обновляем заряд пристрастия - mysql_query('UPDATE `eff_users` SET `deactiveTime` = "'.(time()+$eff['actionTime']).'", `timeUse` = "'.(time()+floor($lvl*$v[3]*86400)).'" WHERE `id` = "'.$pgb['id'].'" LIMIT 1'); - } - - - //Перезаписываем эффект пристрастия - $eff['mdata'] = $u->lookStats($eff['mdata']); - $eff['mdata']['add_'.$v[4]] += floor($el[0]/$v[1]*$lvl); - $eff['mdata'] = $u->impStats($eff['mdata']); - } - } - return $eff; - }*/ - - - - - - public function inBattleLog($txt,$usr=NULL) { - global $u; - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1')); - if(isset($lastHOD['id'])) { - $id_hod = $lastHOD['id_hod']; - if($lastHOD['type']!=6) { - $id_hod++; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")'); - } - } - - - - //Использование предмета - public function useItems($id) - { - global $u, $c, $code, $btl, $e_magic, $c_magic; - - $itm = mysql_fetch_array(mysql_query('SELECT `iu`.`id` AS `iuid`,`im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`inShop`="0" AND `iu`.`delete`="0" AND `iu`.`id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1')); - $bs_is = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1')); - if(isset($itm['id'])) - { - - if($itm['group'] == 1) { - //Группа предметов - if($u->itemsX($itm['id'])>1) { - //вытаскиваем предмет из группы - $u->unstack($itm['id'],1); - /*$itm = mysql_fetch_array(mysql_query('SELECT `iu`.`id` AS `iuid`,`im`.*, `iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`delete`="1000" AND `iu`.`inGroup` = "'.$itm['id'].'" LIMIT 1')); - if(!isset($itm['id'])) { - $this->error = 'Группа предметов ошибочна...'; - }else{ - $itm['delete'] = 0; - }*/ - } - } - - $st = $u->lookStats($itm['data']); - - if($itm['magic_chance'] > 0 && $itm['magic_chance'] < 100) { - $itm['magic_chance'] += floor($u->stats['s5']*3); - if($itm['magic_chance'] >= 99) { $itm['magic_chance'] = 99; } - } - if(isset($bs_is['id'])) { - if(in_array($itm['item_id'], $e_magic) || in_array($itm['item_id'], $c_magic)) { - $itm['magic_chance'] += $bs_is['users']; - if($itm['magic_chance'] >= 99) { $itm['magic_chance'] = 99; } - } - } - - if($itm['iznosNOW'] >= $itm['iznosMAX']) { - $u->error = 'Не осталось зарядов...'; - }elseif( $st['useOnlyInBattle'] == 1 && $u->info['battle'] == 0 ) { - //Можно использовать только в поединке - $u->error = 'Можно использовать только в поединке'; - }elseif( $u->info['battle'] > 0 && $itm['btl_zd'] > 0 ) { - //Можно использовать только в поединке - $u->error = 'Задержка использования еще '.$itm['btl_zd'].' ходов'; - }elseif( $st['useOnlyInBattle'] == 1 && $u->info['battle'] > 0 && $u->stats['hpNow'] < 1 ) { - //Можно использовать только в поединке - $u->error = 'Вы погибли, нельзя пользоваться свитками и магией'; - } elseif($itm['magic_chance'] > 0 && rand(0, 100) > $itm['magic_chance']) { - - - $u->error = 'Каст "'.$itm['name'].'" сгорел'; - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = 0, `delete` = 0 WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addDelo(1, $u->info['id'],'"System.inventory":(КАСТ СГОРЕЛ) Персонаж использовал "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - - } elseif(isset($st['usefromfile'])) { - - //используем заклятие - $st = $u->lookStats($itm['data']); - if( isset($st['zazuby']) && $_GET['login'] != $u->info['login'] ) { - //unset($st['useOnLogin']); - $_GET['login'] = $u->info['login']; - } - $jl = $_GET['login']; - $_GET['login'] = urlencode($_GET['login']); - //используем на персонажа (все кроме себя) - $_GET['login'] = str_replace('%',' ',$_GET['login']); - $_GET['login'] = str_replace('25','',$_GET['login']); - $jl = str_replace('%',' ',$jl); - $jl = str_replace('25','',$jl); - - if(isset($st['useOnLogin']) && $st['useOnLogin']==1) { - if( $u->info['inTurnir'] == 0 ) { - if( $u->info['battle'] > 0 ) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1')); - }else{ - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1')); - } - }else{ - if( $u->info['battle'] > 0 ) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1')); - }else{ - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1')); - } - } - } - - if($st['usefromfile']==1) { - if($u->info['battle'] > 0) { - if(file_exists('../../_incl_data/class/magic/'.$itm['magic_inci'].'.php')) - { - require('../../_incl_data/class/magic/'.$itm['magic_inci'].'.php'); - }else{ - $u->error = 'Не удалось использовать ('.$itm['magic_inci'].'.b)'; - } - }else{ - if(file_exists('_incl_data/class/magic/'.$itm['magic_inci'].'.php')) - { - require('_incl_data/class/magic/'.$itm['magic_inci'].'.php'); - }else{ - $u->error = 'Не удалось использовать ('.$itm['magic_inci'].')'; - } - } - }else{ - if($itm['useInBattle'] > 0) { - if(file_exists('../../_incl_data/class/priems/'.$st['usefromfile'].'.php')) - { - require('../../_incl_data/class/priems/'.$st['usefromfile'].'.php'); - }else{ - $u->error = 'Не удалось использовать ('.$st['usefromfile'].'.)'; - } - }else{ - $u->error = 'Не удалось использовать ('.$st['usefromfile'].'!)'; - } - } - }elseif($itm['type']==30) - { - //Эликсиры - $goodUse = 0; $use = array(); - if(isset($st['moment'])) - { - //Эликсир используется моментально (Восстановление НР или МР) - if(isset($st['moment_hp'])) { - //Восстанавливаем здоровье - if($u->stats['hpNow']<$u->stats['hpAll']) { - $goodUse = 1; - $use['moment_hp'] = $st['moment_hp']; - - if($u->stats['hpNow']+$use['moment_hp']>$u->stats['hpAll']) { - $use['moment_hp'] = ceil($u->stats['hpAll']-$u->stats['hpNow']); - } - - $u->error .= 'Вы восстановили '.($use['moment_hp']).' HP.
    '; - }else{ - $u->error = 'Ваше здоровье и так полностью восстановлено
    '; - $goodUse = 0; - } - } - - if(isset($st['moment_mp'])) { - //Восстанавливаем здоровье - if($u->stats['mpNow'] < $u->stats['mpAll']) { - $goodUse = 1; - $use['moment_mp'] = $st['moment_mp']; - if($u->stats['mpNow']+$use['moment_mp'] > $u->stats['mpAll']) { - $use['moment_mp'] = ceil($u->stats['mpAll']-$u->stats['mpNow']); - } - $u->error .= 'Вы восстановили '.($use['moment_mp']).' MP.
    '; - } else { - $u->error = 'Ваша манна и так полностью восстановлена'; - $goodUse = 0; - } - } - - if($itm['iznosNOW']>=$itm['iznosMAX']) - { - $u->error = 'Эликсир был испорчен...'; - $goodUse = 0; - } - - if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos'])) - { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данный эликсир'; - } - - //Заносим данные в БД - if($goodUse==1) - { - $itm['iznosNOW']++; - $upd = mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($upd) { - $u->stats['hpNow'] += $use['moment_hp']; - $u->info['hpNow'] += $use['moment_hp']; - $u->stats['mpNow'] += $use['moment_mp']; - $u->info['mpNow'] += $use['moment_mp']; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'", `mpNow` = "'.$u->info['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал эликсир "'.$itm['name'].'" (+'.$use['moment_hp'].' HP) [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - $this->youuse++; - $u->error = 'Вы успешно использовали эликсир "'.$itm['name'].'"
    '.$u->error.''; - }else{ - $u->error = 'Не удалось использовать эликсир...'; - } - } - }else{ - //Эликсиры с продолжительным эффектом - $goodUse = 1; - if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos'])) - { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данный эликсир'; - } - if($goodUse==1) - { - $upd1 = 1; - $upd2 = 1; - //добавляем эффект персонажу - if(isset($st['onlyOne'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - if(isset($st['oneType'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - if($goodUse == 1) - { - $us = $this->add_eff($u->info['id'],$itm['magic_inc']); - if($us[0]==1) - { - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал эликсир "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - $this->youuse++; - $u->error = 'Вы успешно использовали эликсир "'.$itm['name'].'"
    '.$us[1].''; - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'"'; - } - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'"'; - } - } - } - //--------------- - }elseif($itm['type']==29) - { - //используем заклятие - $st = $u->lookStats($itm['data']); - if( isset($st['zazuby']) && $_GET['login'] != $u->info['login'] ) { - //unset($st['useOnLogin']); - $_GET['login'] = $u->info['login']; - } - $jl = $_GET['login']; - $_GET['login'] = urlencode($_GET['login']); - //используем на персонажа (все кроме себя) - $_GET['login'] = str_replace('%',' ',$_GET['login']); - $_GET['login'] = str_replace('25','',$_GET['login']); - $jl = str_replace('%',' ',$jl); - $jl = str_replace('25','',$jl); - if($itm['magic_inci']=='nextuplvl') { - if($itm['iznosNOW']>=$itm['iznosMAX']) { - $u->error = 'Свиток был исполчен...'; - }elseif( $u->info['battle'] > 0 ) { - // - $u->error = 'Вы не можете использовать свиток в бою'; - }else{ - if( $u->info['twink'] > 0 ) { - $u->error = 'Используйте свиток на основном персонаже'; - }else{ - mysql_query('UPDATE `users` SET `stopexp` = 0 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `users_twink` SET `stopexp` = 0 WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - } - } - }elseif(isset($st['useOnLogin']) && $st['useOnLogin']==1) - { - if( $u->info['inTurnir'] == 0 ) { - if( $u->info['battle'] > 0 ) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1')); - }else{ - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1')); - } - }else{ - if( $u->info['battle'] > 0 ) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1')); - }else{ - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1')); - } - } - if(isset($usr['id'])) - { - //заклятье нападения - if($itm['iznosNOW']>=$itm['iznosMAX']) - { - $u->error = 'Свиток был исполчен...'; - }elseif($itm['magic_inci']=='snowball') - { - if( $u->info['battle'] == 0 ) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`battle` = 0 OR `u`.`battle` = "'.$u->info['battle'].'") AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1')); - }else{ - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`battle` = 0 OR `u`.`battle` = "'.$u->info['battle'].'") AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`battle` = "'.$u->info['battle'].'" LIMIT 1')); - } - if($usr['battle']>0 && $u->info['battle']!=$usr['battle']) - { - $u->error = 'Персонаж находится в бою'; - }elseif($usr['battle']>0) { - //Кидаемся в поединке - if($usr['team'] != $u->info['team'] && $usr['hpNow'] > 0) { - $txt = 1; - - //Отморозки - if($usr['bot_id'] >= 439 && $usr['bot_id'] <= 460) { - $txt = 500; - }elseif($usr['bot_id'] == 291 ) { - if($usr['hpNow'] < 961) { - $txt = 1982; - }elseif($usr['hpNow'] > 980 && $usr['hpNow'] < 1981) { - $txt = 1982; - } - }elseif($usr['id'] == 1008 ) { - $txt = $u->info['level']*250; - } - - $usr['hpNow'] -= $txt; - if($txt<0) { - $txt = '+'.$txt; - }elseif($txt==0) { - $txt = '--'; - }else{ - $txt = '-'.$txt; - } - if($usr['hpNow']<0) - { - $usr['hpNow'] = 0; - } - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $usr['hpNow']; - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1')); - if(isset($lastHOD['id'])) - { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['hpNow']); - if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll']; - } - if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if($lastHOD['type']!=6) - { - $id_hod++; - } - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $txt = ''.$txt.''; - if($u->info['sex']==1) { - $txt = 'Хитрая {u1} бросила кусок снега в {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - }else{ - $txt = 'Хитрый {u1} бросил кусок снега в {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")'); - } - - unset($txt); - }else{ - $u->error = 'Нельзя использовать на данного персонажа'; - } - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['id']==$u->info['id']) - { - $u->error = 'Нельзя кидаться в самого себя'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире ;)'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['admin']>0 && $u->info['admin']==0) - { - $u->error = 'Нельзя кидаться в Ангелов'; - }else{ - $usr['hpNow'] -= 1000; - if($usr['hpNow']<0) - { - $usr['hpNow'] = 0; - } - $upd = mysql_query('UPDATE `stats` SET `hpNow` = "'.$usr['hpNow'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - if($upd) - { - $sx = 'ый'; $sx2 = ''; - if($u->info['sex']==1) - { - $sx = 'ая'; $sx2 = 'а'; - } - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $urs_st = $u->getStats($usr['id']); - $rtxt = '[img[items/snowball1.gif]] Хитр'.$sx.' "'.$u->info['login'].'" бросил'.$sx2.' кусок снега в "'.$usr['login'].'". -1000 ['.floor($urs_st['hpNow']).'/'.$urs_st['hpAll'].']'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - unset($sx,$sx2); - }else{ - $u->error = 'Не удалось кинуть снежок...'; - } - } - }elseif($itm['magic_inci']=='atack') - { - //заклятье нападения - $usta = $u->getStats($usr['id'],0); // статы цели - $rgd = $u->regen($usr['id'],$usta,1); - $usta['hpNow'] = $rgd['hpNow']; - $usta['mpNow'] = $rgd['mpNow']; - $minHp = floor($usta['hpAll']/100*33); // минимальный запас здоровья цели при котором можно напасть - $batlatest = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$usr['battle'].'" AND `team_win` = -1 LIMIT 1')); - $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_last` WHERE `uid` = "'.$u->info['id'].'" AND `battle_id` = "'.$usr['battle'].'" LIMIT 1')); - if(isset($test['id'])) { - echo 'Нельзя вмешаться, вы уже были в этом поединке.'; - }elseif( time() - $usr['timereg'] < 86400*10 ) - { - $u->error = 'Нападать на новичков запрещается! Сейчас придет Мироздатель и превратит тебя в лягушку...'; - }elseif($usr['atack']==1 || $usr['atack'] > time()) - { - $u->error = 'На персонаже метка нападения, нападайте через неё...'; - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате (пещере)'; - }elseif($usr['inTurnirnew'] > 0) - { - $u->error = 'Персонаж принимает участие в турнире'; - }elseif($u->info['battle']>0) - { - $u->error = 'Вы уже находитесь в бою'; - }elseif($usr['id']==$u->info['id']) - { - $u->error = 'Нельзя нападать на самого себя'; - }elseif($usr['bot']==2) { - $u->error = 'Не удалость напасть на бота '.$usr['login'].''; - }elseif($usr['online']error = 'Персонаж не в сети'; - }elseif($usr['admin']==1) - { - $u->error = 'Уважайте хранителей...'; - }elseif($usr['room']!=$u->info['room'] && $u->info['battle'] != $usr['battle'] && $u->info['battle'] > 0) - { - $u->error = 'Персонаж находится в другой комнате!'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($batlatest['noatack']==1) - { - $u->error = 'Поединок защищен магией! Вы не можете вмешаться!'; - }elseif($minHp>$usta['hpNow'] && !isset($batlatest['id'])) - { - //мало хп - $u->error = 'Персонаж слишком слаб ('.floor($usta['hpNow']).'HP)'; - }elseif($u->info['noatack']!=0) - { - //мало хп - $u->error = 'В этой комнате нападения запрещены.'; - }else{ - - if($usr['type_pers'] > 0) { - $kroww=$usr['type_pers']; - }elseif($itm['item_id']=='2391'){ - $kroww=99; - }elseif($itm['item_id']=='11117'){ - $kroww=222; - }else{ - $kroww=0; - } - - $kulak = 0; - if( $itm['item_id'] == 4404 ) { - $kulak = 1; - } - if($u->info['inTurnir'] > 0) { $bsi = $u->info['inTurnir']; } else { $bsi = 0; } - $atc = $this->atackUser($u->info['id'],$usr['id'],$usr['team'],$usr['battle'], 0, $kroww, $kulak, $bsi); - if($atc > 0) - { - //отправляем системку в чат - $sx = ''; - if($u->info['sex']==1) - { - $sx = 'а'; - } - $itm['iznosNOW']++; - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $rtxt = '[img[items/pal_button8.gif]] "'.$u->info['login'].'" использовал'.$sx.' магию нападения на персонажа "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')"); - //напали, обновляем экран - - die(''); - }else{ - if( $u->error == '' ) { - $u->error = 'Не удалось напасть на персонажа...'; - } - } - } - }elseif($itm['magic_inci']=='cureHP') { - //Реген НР,MP - $po = $u->lookStats($itm['data']); - if($u->info['battle'] > 0) { - //используем свиток в поединке - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `spells` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); - if(isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - }elseif( $usr['battle']!=$u->info['battle'] ) { - $u->error = 'Неудалось использовать, персонаж в другом поединке...'; - }elseif( $usr['team']!=$u->info['team'] ) { - $u->error = 'Неудалось использовать на противника...'; - }elseif( $usr['hpNow'] < 1 ) { - $u->error = 'Неудалось использовать на мертвых...'; - }elseif( $u->info['hpNow'] < 1 ) { - $u->error = 'Неудалось использовать, вы погибли...'; - }elseif($btl->info['noeff'] > 0 ) { - $u->error = 'Запрет на использования свитков восстановления'; - }elseif( $po['magic_hpNow'] < 1 && $po['magic_mpNow'] < 1 ) { - $u->error = 'Неудалось использовать, в магическом свитке нет магии...'; - }elseif(($usr['battle']==$u->info['battle'] && ($u->info['team']==$usr['team'] && ($po['magic_hpNow']>0 || $po['magic_mpNow']>0))) && $usr['hpNow']>=1 && $u->info['hpNow']>=1) { - //кастуем - if(isset($po['magic_hpNow'])) { - - mysql_query('INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( - "'.$u->info['battle'].'","'.$u->info['id'].'","'.time().'","'.$itm['item_id'].'","'.$itm['name'].'","1" - )'); - - $txt = $po['magic_hpNow']; - - if($btl->stats[$btl->uids[$usr['id']]]['hpAll']-$btl->stats[$btl->uids[$usr['id']]]['hpNow'] < $txt) { - $txt = floor($btl->stats[$btl->uids[$usr['id']]]['hpAll']-$btl->stats[$btl->uids[$usr['id']]]['hpNow']); - } - //653 - 400 - //253 - //453 1306 - $gdhh = round($txt/$btl->stats[$btl->uids[$usr['id']]]['hpAll']*5,2); - $gdhd = round($gdhh/$btl->users[$btl->uids[$usr['id']]]['tactic7']*100); - if($gdhd > 100) { - $txt = floor($txt/100*$gdhd); - } - - if($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) { - if($txt > 0) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] += $txt; - $btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh; - if($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) { - $btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0; - } - } - mysql_query('UPDATE `stats` SET `last_hp` = "'.$txt.'", `hpNow` = `hpNow` + '.$po['magic_hpNow'].', `tactic7` = "'.$btl->users[$btl->uids[$usr['id']]]['tactic7'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - if($txt > 0) { - $txt = '+'.$txt; - } elseif($txt == 0){ - $txt = '--'; - } - } else { - $txt = '--'; - } - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1')); - if(isset($lastHOD['id'])) - { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['hpNow']); - if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll']; - } - if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if($lastHOD['type'] != 6) - { - $id_hod++; - } - $txt = ''.$txt.''; - if($u->info['id']==$usr['id']) { - if($u->info['sex']==1) { - $txt = '{u1} использовала "'.$itm['name'].'" на себя. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - }else{ - $txt = '{u1} использовал "'.$itm['name'].'" на себя. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - } - }else{ - if($u->info['sex']==1) { - $txt = '{u1} использовала "'.$itm['name'].'" на {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - }else{ - $txt = '{u1} использовал "'.$itm['name'].'" на {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']'; - } - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")'); - } - } - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - - // сообщение в лог боя - $sx = 'ый'; $sx2 = ''; - if($u->info['sex']==1) - { - $sx = 'ая'; $sx2 = 'а'; - } - $u->error = 'Свиток "'.$itm['name'].'" был успешно использован.'; - }else{ - $u->error = 'Нельзя использовать на данного персонажа'; - } - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['battle']!=$u->info['battle']) - { - $u->error = 'Персонаж находится в поединке'; - }else{ - //кастуем - if(isset($po['magic_hpNow'])) { - mysql_query('UPDATE `stats` SET `hpNow` = `hpNow` + '.$po['magic_hpNow'].' WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - } - - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - - // сообщение в чат - $sx = 'ый'; $sx2 = ''; - if($u->info['sex']==1) - { - $sx = 'ая'; $sx2 = 'а'; - } - $u->error = 'Свиток "'.$itm['name'].'" был успешно использован.'; - $rtxt = '[img[items/'.$itm['img'].']] Персонаж "'.$u->info['login'].'" использовал'.$sx2.' "'.$itm['name'].'" на "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - } - }elseif($itm['magic_inci']=='cureMP') { - //Реген НР,MP - $po = $u->lookStats($itm['data']); - if($u->info['battle'] > 0) { - //используем свиток в поединке - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `spells` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); - if(isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - }elseif($btl->info['noeff'] > 0 ) { - $u->error = 'Запрет на использования свитков восстановления'; - }elseif(($usr['battle']==$u->info['battle'] && ($u->info['team']==$usr['team'] && ($po['magic_hpNow']>0 || $po['magic_mpNow']>0))) && $usr['hpNow']>1 && $u->info['hpNow']>=1) { - //кастуем - if(isset($po['magic_mpNow'])) { - - mysql_query('INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( - "'.$u->info['battle'].'","'.$u->info['id'].'","'.time().'","'.$itm['item_id'].'","'.$itm['name'].'","1" - )'); - - $txt = $po['magic_mpNow']; - - if($btl->stats[$btl->uids[$usr['id']]]['mpAll']-$btl->stats[$btl->uids[$usr['id']]]['mpNow'] < $txt) { - $txt = floor($btl->stats[$btl->uids[$usr['id']]]['mpAll']-$btl->stats[$btl->uids[$usr['id']]]['mpNow']); - } - - $gdhh = round($txt/$btl->stats[$btl->uids[$usr['id']]]['mpAll']*5); - $gdhd = round($gdhh/$btl->users[$btl->uids[$usr['id']]]['tactic7']*100); - if( $gdhd > 100 ) { - $txt = floor($txt/100*$gdhd); - } - - if($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) { // поставить >= 1 , если требует дух - if($txt > 0) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] += $txt; - $btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh; - if($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) { - $btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0; - } - } - mysql_query('UPDATE `stats` SET `mpNow` = `mpNow` + '.$txt.', `tactic7` = "'.$btl->users[$btl->uids[$usr['id']]]['tactic7'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - if($txt>0) { - $txt = '+'.$txt; - }elseif($txt==0){ - $txt = '--'; - } - } else { - $txt = '--'; - } - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1')); - if(isset($lastHOD['id'])) - { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['mpNow']); - if($btl->stats[$btl->uids[$usr['id']]]['mpNow'] > $btl->stats[$btl->uids[$usr['id']]]['mpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = $btl->stats[$btl->uids[$usr['id']]]['mpAll']; - } - if($btl->stats[$btl->uids[$usr['id']]]['mpNow']<1) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if($lastHOD['type']!=6) - { - $id_hod++; - } - $txt = ''.$txt.''; - if($u->info['id']==$usr['id']) { - if($u->info['sex']==1) { - $txt = '{u1} использовала "'.$itm['name'].'" на себя. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['mpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['mpAll'].'] (Мана)'; - }else{ - $txt = '{u1} использовал "'.$itm['name'].'" на себя. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['mpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['mpAll'].'] (Мана)'; - } - }else{ - if($u->info['sex']==1) { - $txt = '{u1} использовала "'.$itm['name'].'" на {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['mpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['mpAll'].'] (Мана)'; - }else{ - $txt = '{u1} использовал "'.$itm['name'].'" на {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['mpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['mpAll'].'] (Мана)'; - } - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")'); - } - } - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - - // сообщение в лог боя - $sx = 'ый'; $sx2 = ''; - if($u->info['sex']==1) - { - $sx = 'ая'; $sx2 = 'а'; - } - $u->error = 'Свиток "'.$itm['name'].'" был успешно использован.'; - }else{ - $u->error = 'Нельзя использовать на данного персонажа'; - } - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['battle']!=$u->info['battle']) - { - $u->error = 'Персонаж находится в поединке'; - }else{ - //кастуем - if(isset($po['magic_mpNow'])) { - mysql_query('UPDATE `stats` SET `mpNow` = `mpNow` + '.$po['magic_mpNow'].' WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - } - - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - - // сообщение в чат - $sx = 'ый'; $sx2 = ''; - if($u->info['sex']==1) - { - $sx = 'ая'; $sx2 = 'а'; - } - $u->error = 'Свиток "'.$itm['name'].'" был успешно использован.'; - $rtxt = '[img[items/'.$itm['img'].']] Персонаж "'.$u->info['login'].'" использовал'.$sx2.' "'.$itm['name'].'" на "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - } - }elseif($itm['magic_inci']=='lech_1' or $itm['magic_inci']=='lech_2' or $itm['magic_inci']=='lech_3'){ - - if($u->info['battle'] > 0) { - //используем свиток в поединке - - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['battle']!=$u->info['battle']) - { - $u->error = 'Персонаж находится в поединке'; - }else{ - - $travm = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="'.$usr['id'].'" and `id_eff`="4" and `delete`="0" ORDER BY `v1` DESC LIMIT 1')); - //$type_lechenie = $travm['v1']; - $itm['magic_inci'] = 'lech_'.$travm['v1']; - if($itm['magic_inci']=='lech_1'){ - $type_lechenie=1; // тип травмы котору лечим - $text_msg='"Легкой травмы"'; - $text_msg2 = 'легких'; - }elseif($itm['magic_inci']=='lech_2'){ - $type_lechenie=2; // тип травмы котору лечим - $text_msg='"Средней травмы"'; - $text_msg2 = 'средних'; - }elseif($itm['magic_inci']=='lech_3'){ - $type_lechenie=3; // тип травмы котору лечим - $text_msg='"Тяжелой травмы"'; - $text_msg2 = 'тяжелых'; - } - if($travm){ - $lech_aa = array( 0 , 2 , 3 , 4 ); - $travm_cep = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="'.$usr['id'].'" and `id_eff`="335" and `delete`="0" and `v1`="'.$type_lechenie.'" LIMIT 1')); - if( $travm_cep['timeUse'] < time() - 360 ) { - unset($travm_cep); - } - - $cep_users = explode(',',$travm_cep['data']); - $it_i = 0; - $it_no = 0; - $it_users = ''; - while( $it_i < count($cep_users) ) { - $it_u = $cep_users[$it_i]; - if( $it_u == $u->info['id'] ) { - $it_no = 1; - } - $it_u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`align`,`clan`,`room` FROM `users` WHERE `id` = "'.$it_u.'" LIMIT 1')); - if( isset($it_u['id']) ) { - $it_users .= ', '.$it_u['login'].''; - } - $it_i++; - } - $it_u = ltrim($it_u,', '); - - $lech_co = round($travm_cep['x']+1); - if( $it_no == 1 ) { - $u->error = 'Вы уже один из лекарей'; - }elseif( $lech_co >= $lech_aa[$type_lechenie] ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - - $rtxt = '[img[items/cure_g1.gif]] Лекарь "'.$u->info['login'].'" кинул цепь исцеления на игрока "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'); - - // сообщение в чат - $u->error = 'Персонаж излечен от '.$text_msg.'.'; - $rtxt = '[img[items/cure'.$type_lechenie.'.gif]] Лекари "'.$u->info['login'].$it_users.'" вылечили от '.$text_msg.' игрока "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - }else{ - if( isset($travm_cep['id']) ) { - $travm_cep['x']++; - $u->error = 'Вы присоединились к цепи исцеления для "'.$text_msg.'" (исцеление '.$text_msg2.' травм)'; - mysql_query('UPDATE `eff_users` SET `x` = "'.$travm_cep['x'].'" - ,`data` = "'.$travm_cep['data'].','.$u->info['id'].'" - WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); - }else{ - $u->error = 'Вы создали цепь исцеления для "'.$text_msg.'" (исцеление '.$text_msg2.' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание'; - mysql_query('INSERT INTO `eff_users` - ( - `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` - ) VALUES ( - "335","'.$usr['id'].'","Цепь исцеления","'.$u->info['id'].'","28","'.time().'","'.$u->info['id'].'","'.$type_lechenie.'","1" - )'); - } - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - // сообщение в чат - $rtxt = '[img[items/cure_g1.gif]] Лекарь "'.$u->info['login'].'" кинул цепь исцеления на игрока "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - } - }else{ - $u->error = 'Персонаж не имеет данной травмы.'; - } - - } - - - }elseif($itm['magic_inci']=='lech_free_1' or $itm['magic_inci']=='lech_free_2' or $itm['magic_inci']=='lech_free_3'){ - - if($u->info['battle'] > 0) { - //используем свиток в поединке - - }elseif($u->info['dnow']!=$usr['dnow']) - { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире'; - }elseif($usr['room']!=$u->info['room']) - { - $u->error = 'Персонаж находится в другой комнате'; - }elseif($usr['battle']!=$u->info['battle']) - { - $u->error = 'Персонаж находится в поединке'; - }else{ - - $travm = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="'.$usr['id'].'" and `id_eff`="4" and `delete`="0" ORDER BY `v1` DESC LIMIT 1')); - //$type_lechenie = $travm['v1']; - //$itm['magic_inci'] = 'lech_free_'.$travm['v1']; - if($itm['magic_inci']=='lech_free_1'){ - $type_lechenie=1; // тип травмы котору лечим - $text_msg='"Легкой травмы"'; - $text_msg2 = 'легких'; - }elseif($itm['magic_inci']=='lech_free_2'){ - $type_lechenie=2; // тип травмы котору лечим - $text_msg='"Средней травмы"'; - $text_msg2 = 'средних'; - }elseif($itm['magic_inci']=='lech_free_3'){ - $type_lechenie=3; // тип травмы котору лечим - $text_msg='"Тяжелой травмы"'; - $text_msg2 = 'тяжелых'; - } - if($travm['v1'] != $type_lechenie) { - $u->error = 'Неподходящий свиток для данной травмы.'; - }elseif($travm['id']){ - $lech_aa = array( 0 , 0 , 0 , 0 ); - $travm_cep = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="'.$usr['id'].'" and `id_eff`="335" and `delete`="0" and `v1`="'.$type_lechenie.'" LIMIT 1')); - if( $travm_cep['timeUse'] < time() - 360 ) { - unset($travm_cep); - } - - $cep_users = explode(',',$travm_cep['data']); - $it_i = 0; - $it_no = 0; - $it_users = ''; - while( $it_i < count($cep_users) ) { - $it_u = $cep_users[$it_i]; - if( $it_u == $u->info['id'] ) { - $it_no = 1; - } - $it_u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`align`,`clan`,`room` FROM `users` WHERE `id` = "'.$it_u.'" LIMIT 1')); - if( isset($it_u['id']) ) { - $it_users .= ', '.$it_u['login'].''; - } - $it_i++; - } - $it_u = ltrim($it_u,', '); - - $lech_co = round($travm_cep['x']+1); - if( $it_no == 1 ) { - $u->error = 'Вы уже один из лекарей'; - }elseif( $lech_co >= $lech_aa[$type_lechenie] ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - - //$rtxt = '[img[items/cure_g1.gif]] Лекарь "'.$u->info['login'].'" кинул цепь исцеления на игрока "'.$usr['login'].'".'; - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'); - - // сообщение в чат - $u->error = 'Персонаж излечен от '.$text_msg.'.'; - $rtxt = '[img[items/cure'.$type_lechenie.'.gif]] Лекари "'.$u->info['login'].$it_users.'" вылечили от '.$text_msg.' игрока "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - }else{ - if( isset($travm_cep['id']) ) { - $travm_cep['x']++; - $u->error = 'Вы присоединились к цепи исцеления для "'.$text_msg.'" (исцеление '.$text_msg2.' травм)'; - mysql_query('UPDATE `eff_users` SET `x` = "'.$travm_cep['x'].'" - ,`data` = "'.$travm_cep['data'].','.$u->info['id'].'" - WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); - }else{ - $u->error = 'Вы создали цепь исцеления для "'.$text_msg.'" (исцеление '.$text_msg2.' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание'; - mysql_query('INSERT INTO `eff_users` - ( - `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` - ) VALUES ( - "335","'.$usr['id'].'","Цепь исцеления","'.$u->info['id'].'","28","'.time().'","'.$u->info['id'].'","'.$type_lechenie.'","1" - )'); - } - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - // сообщение в чат - $rtxt = '[img[items/cure_g1.gif]] Лекарь "'.$u->info['login'].'" кинул цепь исцеления на игрока "'.$usr['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - } - }else{ - $u->error = 'Персонаж не имеет данной травмы.'; - } - - } - - - }else{ - if( $u->info['id'] != $usr['id'] ) { - $lsct = mysql_fetch_array(mysql_query('SELECT `id_eff` FROM `eff_users` WHERE `uid` = "'.$usr['id'].'" AND `delete` = "0" AND (`overType` = "'.$itm['overType'].'" OR (`id_eff` = "'.$itm['magic_inc'].'" AND "'.(0+$st['onlyOne']).'" != "0")) LIMIT 1')); - $lsct['good'] = 1; - //Касты - if( $lsct['id_eff'] >= 291 && $lsct['id_eff'] <= 296 && $itm['magic_inc'] >= 291 && $itm['magic_inc'] <= 296 ) { - if( $lsct['id_eff'] > $itm['magic_inc'] ) { - $u->error = 'На персонаже есть каст лучше этого!'; - $lsct['good'] = 0; - } - } - }else{ - $lsct['good'] = 1; - } - //просто используем на персонажа - if($lsct['good'] == 0) { - - } elseif($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - }elseif($usr['room']==217 || $usr['room']==218 || $usr['room']==219) { - $u->error = 'Персонаж '.$u->microLogin($usr['id'],1).' находится в Общежитии!'; - } elseif($usr['inTurnir'] != 0 && ($u->info['inTurnir'] != $usr['inTurnir'])) { - $u->error = 'Участвует в турнире Башни смерти...'; - } elseif($usr['id']==$u->info['id'] && isset($st['useOnlyUser'])) { - $u->error = 'Нельзя использовать это заклятие на самого себя'; - }elseif($usr['online']error = 'Персонаж находится в реальном мире ;)'; - }elseif($usr['room']!=$u->info['room'] && $usr['battle'] != $u->info['battle'] && $u->info['battle'] > 0) - { - $u->error = 'Персонаж находится в другой комнате ['.$usr['room'].' '.$u->info['room'].']'; - }elseif($usr['admin']>0 && $u->info['admin']==0 && isset($st['useNoAdmin'])) - { - $u->error = 'Нельзя использовать данное заклятие на Ангелов'; - }elseif($usr['battle']>0 && $u->info['battle']!=$usr['battle']) - { - $u->error = 'Персонаж находится в бою'; - }elseif(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos'])) - { - $u->error = 'Хаосники не могут использовать данное заклятие'; - }else{ - //добавляем эффект персонажу - $goodUse = 1; - // - $tpsm = 0; - if( $itm['useInBattle'] == 0 && $usr['battle'] > 0 ) { - //Нельзя юзать - $goodUse = 0; - }else{ - if( $usr['battle'] > 0 ) { - global $btl; - if($u->info['team'] != $btl->users[$btl->uids[$usr['id']]]['team'] ) { - if( $itm['useInBattle'] == 1 ) { - $goodUse = 0; - } - $tpsm = 2; - }elseif($u->info['team'] == $btl->users[$btl->uids[$usr['id']]]['team'] ) { - if( $itm['useInBattle'] == 2 ) { - $goodUse = 0; - } - $tpsm = 1; - } - } - } - // - if( $goodUse == 1 ) { - if(isset($st['onlyOne'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - if(isset($st['oneType'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - } - // - if( $goodUse == 1 && $itm['magic_inc'] == 'unclone' ) { - //Переманить клона - if($usr['clone'] > 0 && $usr['hpNow'] >= 1 && $usr['team'] != $u->info['team']) { - mysql_query('UPDATE `stats` SET `team` = "'.$u->info['team'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - if( $u->info['sex'] == 0 ) { - $txt_m = '{u1} переманил клона {u2} на свою сторону.'; - }else{ - $txt_m = '{u1} переманила клона {u2} на свою сторону.'; - } - $this->inBattleLog($txt_m,$usr); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.($itm['iznosNOW'] + 1).'" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "'.$itm['item_id'].'" AND `inOdet` > 0 AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" LIMIT 20'); - $u->error = 'Вы успешно использовали заклинание "'.$itm['name'].'" на "'.$usr['login'].'"'; - }else{ - $u->error = 'Вы не можете переманивать данного персонажа...'; - } - }elseif($goodUse == 1) - { - $us = $this->add_eff($usr['id'],$itm['magic_inc']); - if($us[0]==1) { - $mmmid = mysql_insert_id(); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - if($u->info['id']!=$usr['id']) - { - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал заклинание "'.$itm['name'].'" ('.$us[1].') на персонажа "'.$usr['login'].'" (id'.$usr['id'].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - $u->addDelo(1,$usr['id'],'"System.inventory": Персонаж "'.$u->info['login'].'" (id'.$u->info['id'].') использовал заклинание "'.$itm['name'].'" ('.$us[1].') на персонажа [itm:'.$itm['id'].'].',time(),$usr['city'],'System.inventory',0,0); - $u->error = 'Вы успешно использовали заклинание "'.$itm['name'].'" на персонажа "'.$usr['login'].'"
    '.$us[1].''; - //$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовал'.$sx.' заклинание "'.$itm['name'].'" на персонажа "'.$usr['login'].'".'; - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - }else{ - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал заклинание "'.$itm['name'].'" ('.$us[1].') на персонажа самого себя [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - $u->error = 'Вы успешно использовали заклинание "'.$itm['name'].'" на самого себя
    '.$us[1].''; - - //$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовал'.$sx.' заклинание "'.$itm['name'].'" на себя.'; - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - } - // - if( $usr['battle'] > 0 ) { - //Заносим в лог - $txt_m = ''; - if( $u->info['sex'] == 0 ) { - if($u->info['id']!=$usr['id']) { - $txt_m .= '{u1} воспользовался магией "'.$itm['name'].'" на {u2}.'; - }else{ - $txt_m .= '{u1} воспользовался магией "'.$itm['name'].'" на себя.'; - } - }else{ - if($u->info['id']!=$usr['id']) { - $txt_m .= '{u1} воспользовалась магией "'.$itm['name'].'" на {u2}.'; - }else{ - $txt_m .= '{u1} воспользовалась магией "'.$itm['name'].'" на себя.'; - } - } - $this->inBattleLog($txt_m,$usr); - // - //По завершению боя эффект должен слетать - //306 - положительное , 307 - отрицательное - if( $tpsm == 1 ) { - //306 - mysql_query('UPDATE `eff_users` SET `v1` = "priem",`v2` = "306",`timeUse` = "77",`hod` = "-1",`img2` = "'.$itm['img'].'" WHERE `id` = "'.$mmmid.'" LIMIT 1'); - }elseif( $tpsm == 2 ) { - //307 - mysql_query('UPDATE `eff_users` SET `v1` = "priem",`v2` = "307",`timeUse` = "77",`hod` = "-1",`img2` = "'.$itm['img'].'" WHERE `id` = "'.$mmmid.'" LIMIT 1'); - } - // - } - // - $this->youuse++; - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'" ... ('.$itm['magin_inc'].' and '.$itm['magic_inci'].', Эффект не добавлен)'; - } - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'"'; - } - } - } - }else{ - $u->error = 'Персонаж "'.$jl.'" не найден в этом городе ('.$u->info['city'].')'; - } - }elseif(isset($st['useOnItem']) && $st['useOnItem']==1) - { - //используем на предмет - - }else{ - //на себя - $goodUse = 1; - if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos'])) - { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данное заклятие'; - } - - if($itm['magic_inci'] == 'sanich2') { - if($u->info['battle'] == 0) { - $sz = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "sanich2" AND `time` > '.(time()-4*60*60).' LIMIT 1',1); - if(!isset($sz['id'])) { - $slech=rand(0,4); - $goodUse = 0; - if($slech==1){ - //3083 Настойка на жучьей требухе - //$this->add_eff($u->info['id'],3083); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 290 AND `delete` =0'); - $this->add_eff($u->info['id'],290); - $echotext = 'Настойка на жучьей требухе!'; - $u->error = 'Вы получили эфект от '.$echotext.''; - }elseif($slech==2){ - //5239 Амброзия подмастерья Владык - //$this->add_eff($u->info['id'],5239); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 472 AND `delete` =0'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 470 AND `delete` =0'); - $this->add_eff($u->info['id'],472); - $echotext = 'Амброзия подмастерья Владык!'; - $u->error = 'Вы получили эфект от '.$echotext.''; - }elseif($slech==3){ - //5069 Амброзия Скучающих Владык - //$this->add_eff($u->info['id'],470); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 472 AND `delete` =0'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 470 AND `delete` =0'); - $this->add_eff($u->info['id'],470); - $echotext = 'Амброзия Скучающих Владык!'; - $u->error = 'Вы получили эфект от '.$echotext.''; - }elseif($slech==4){ - //1463 Звездное Сияние - //$this->add_eff($u->info['id'],1463); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 35 AND `delete` =0'); - $this->add_eff($u->info['id'],35); - $echotext = 'Звездное Сияние!'; - $u->error = 'Вы получили эфект от '.$echotext.''; - }else{ - $slech=1; - - $echotext = 'Не удалось прочитать страницу!'; - $u->error = ' '.$echotext.' '; - } - - $itm['iznosNOW'] += $slech; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addAction(time(),'sanich2',$slech); - - if($u->info['sex'] == 1) { - $rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовала "'.$itm['name'].' Саныча" и получила эффект '.$echotext.' травмы.'; - }else{ - $rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовал "'.$itm['name'].' Саныча" и получил эффект '.$echotext.' травмы.'; - } - - - - /* - $slech = 0; - $strm = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 4 AND `delete` = "0" LIMIT 1')); - if(isset($strm['id'])) { - if($strm['v1'] == 1) { - $slech = 1; - }elseif($strm['v1'] == 2) { - $slech = 2; - }elseif($strm['v1'] == 3) { - $slech = 3; - } - } - if($slech > 0) { - - $goodUse = 0; - - $slf = 'легкой'; - if($slech == 2) { - $slf = 'средней'; - }elseif($slech == 3) { - $slf = 'тяжелой'; - } - - if($u->info['sex'] == 1) { - $rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовала "'.$itm['name'].' Саныча" и исцеласб от '.$slf.' травмы.'; - }else{ - $rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовал "'.$itm['name'].' Саныча" и исцелился от '.$slf.' травмы.'; - } - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$strm['id'].'" LIMIT 1'); - $u->error = 'Вы успешно исцелились от '.$slf.' травмы.'; - $itm['iznosNOW'] += $slech; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addAction(time(),'sanich2',$slech); - }else{ - $u->error = 'У персонажа нет физических увечий которые можно излечить'; - }*/ - - }else{ - $u->error = 'Задержка использования '.$u->timeOut(($sz['time']+4*60*60)-time()).'.'; - } - }else{ - $u->error = 'Невозможно использовать в бою'; - } - - }elseif($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) { - - $sz = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "sanich1" AND `time` > '.(time()-6*60).' LIMIT 1',1); - if(!isset($sz['id'])) { - $goodUse = 0; - $u->error = 'Вы успешно использовали "'.$itm['name'].'"'; - $z = 1; - while($z <= 5) { - $u->info['tactic'.$z]++; - if($u->info['tactic'.$z] > 25) { - $u->info['tactic'.$z] = 25; - }elseif($u->info['tactic'.$z] < 0) { - $u->info['tactic'.$z] = 0; - } - $z++; - } - if($u->info['sex'] == 1) { - $this->inBattleLog('{u1} использовала "'.$itm['name'].' Саныча".'); - }else{ - $this->inBattleLog('{u1} использовал "'.$itm['name'].' Саныча".'); - } - mysql_query('UPDATE `stats` SET `tactic1` = "'.$u->info['tactic1'].'",`tactic2` = "'.$u->info['tactic2'].'",`tactic3` = "'.$u->info['tactic3'].'",`tactic4` = "'.$u->info['tactic4'].'",`tactic5` = "'.$u->info['tactic5'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addAction(time(),'sanich1',$u->info['battle']); - }else{ - $u->error = 'Задержка использования '.$u->timeOut(($sz['time']+6*60)-time()).'.'; - } - - }elseif($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) { - - $sz = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "sanich3" AND `time` > '.(time()-3*60*60).' LIMIT 1',1); - if(!isset($sz['id'])) { - - $usr = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`level`,`s`.`hpNow`,`s`.`team`,`u`.`login`,`u`.`sex` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`id` = "'.$u->info['enemy'].'" AND `u`.`battle` = "'.$u->info['battle'].'" LIMIT 1')); - if(isset($usr['id']) && $usr['hpNow'] >= 1) { - $iznslvl = $usr['level']; - - $goodUse = 0; - $u->error = 'Вы успешно использовали "'.$itm['name'].'" на '.$usr['login'].''; - - if($u->info['sex'] == 1) { - $this->inBattleLog('{u1} использовала "'.$itm['name'].' Саныча" на {u2}.',$usr); - }else{ - $this->inBattleLog('{u1} использовал "'.$itm['name'].' Саныча" на {u2}.',$usr); - } - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$usr['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpNow'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1'); - $itm['iznosNOW'] += $iznslvl; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - $u->addAction(time(),'sanich3',$u->info['battle']); - }else{ - $u->error = 'Нет подходящего противника'; - } - - }else{ - $u->error = 'Задержка использования '.$u->timeOut(($sz['time']+3*60*60)-time()).'.'; - } - - }elseif($itm['magic_inci']=='lech') - { - $goodUse = 0; - if($u->info['level']>=2 and $u->info['level']<=13){ - $travm = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="'.$u->info['id'].'" and `id_eff`="4" and `delete`="0" LIMIT 1')); - if($travm) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - }else{ - $u->error = 'У вас нету травмы.'; - } - }else{ - $u->error = 'Ваш уровень не подходит для использования свитка.'; - } - } - - - if($goodUse==1) - { - - $upd1 = 1; - $upd2 = 1; - //добавляем эффект персонажу - if(isset($st['onlyOne'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - if(isset($st['oneType'])) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - - if($itm['magic_inci']=='unclone') - { - //Свиток клонирования - if( $u->info['hpNow'] < 1 ) { - $u->error = 'Вам не удалось переманить клона...'; - }elseif( $u->info['battle'] == 0 ) { - $u->error = 'Можно использовать только в поединке...'; - }else{ - //Преманиваем - $u->error = 'Переманили...'; - } - }elseif($itm['magic_inci']=='cloneMe') - { - //Свиток клонирования - if( true == false ) { - $u->error = 'Свитки клонирования запрещены в нашем проекте.'; - }elseif( $u->info['hpNow'] < 1 ) { - $u->error = 'Вы успешно клонировали свой труп ;)'; - }elseif( $u->info['battle'] == 0 ) { - $u->error = 'Можно использовать только в поединке...'; - }else{ - $bot_cou = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` LIKE "%'.$u->info['login'].' (клон%" AND `battle` = "'.$u->info['battle'].'" LIMIT 1')); - $bot_cou = $bot_cou[0]+1; - //Добавляем бота - $clone = array( - 'id' => $u->info['id'], - 'login' => $u->info['login'].' (клон '.$bot_cou.')', - 'level' => $u->info['level'], - 'city' => $u->info['city'], - 'cityreg' => $u->info['cityreg'], - 'name' => $u->info['name'], - 'sex' => $u->info['sex'], - 'deviz' => $u->info['deviz'], - 'hobby' => $u->info['hobby'], - 'time_reg' => $u->info['time_reg'], - 'obraz' => $u->info['obraz'], - 'stats' => $u->info['stats'], - 'upLevel' => $u->info['upLevel'], - 'priems' => $u->info['priems'], - 'loclon' => true, - 'inTurnir' => $u->info['inTurnir'] - ); - $bot = $u->addNewbot(1,NULL,$clone,NULL,true); - if( $bot > 0 ) { - mysql_query('UPDATE `stats` SET `team` = "'.$u->info['team'].'",`hpNow` = "'.$u->stats['hpNow'].'",`mpNow` = "'.$u->stats['mpNow'].'" WHERE `id` = "'.$bot.'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle` = "'.$u->info['battle'].'" WHERE `id` = "'.$bot.'" LIMIT 1'); - //Доабвляем лог - if( $u->info['sex'] == 0 ) { - $txt_m = '{u1} использовал "'.$itm['name'].'" и породил клона.'; - }else{ - $txt_m = '{u1} использовала "'.$itm['name'].'" и породила клона.'; - } - $this->inBattleLog($txt_m,NULL); - if( $u->info['sex'] == 0 ) { - $txt_m = ''.$u->info['login'].' (клон '.$bot_cou.')['.$u->info['level'].'] вмешался в поединок!'; - }else{ - $txt_m = ''.$u->info['login'].' (клон '.$bot_cou.')['.$u->info['level'].'] вмешалась в поединок!'; - } - $this->inBattleLog($txt_m,$usr_m); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.($itm['iznosNOW'] + 1).'" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "'.$itm['item_id'].'" AND `inOdet` > 0 AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" LIMIT 20'); - $u->error = 'Заклятие "'.$itm['name'].'" было успешно использовано'; - }else{ - $u->error = 'Неудалось использовать заклятие...'; - } - unset($txt_m,$usr_m,$clone,$bot_cou,$bot); - } - - } elseif($itm['magic_inci'] == 'scan') { - if($u->info['inTurnir'] != 0) { - $sp = mysql_query('SELECT `st`.*, `u`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `inTurnir` = "'.$u->info['inTurnir'].'"'); - while($pl = mysql_fetch_array($sp)) { - $rrm = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `x` = "'.$pl['x'].'" AND `y` = "'.$pl['y'].'"')); - $trnt .= $pl['login'].' Комната : '.$rrm['name'].', '; - } - $trnt = rtrim($trnt,', '); - $it_ = $u->addItem(2435, $u->info['id'], 'noodet=1|noremont=1|sudba='.$u->info['login'].''); - mysql_query('UPDATE `items_users` SET `use_text` = 500 WHERE `id` = "'.$it_.'" LIMIT 1'); - mysql_query('INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`,`type`) VALUES ("'.$it_.'","'.time().'","","'.mysql_real_escape_string($trnt).'","'.$u->info['city'].'","1","1")'); - mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - $u->error = 'Вы получили выписку...'; - - } else { - $u->error = 'Используется только в Башне смерти...'; - } - }elseif($itm['magic_inci']=='tactic') { - //Выдаем тактику - if( $u->stats['hpNow'] >= 1 ) { - - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `tactic` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); - if(isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - }else{ - // - mysql_query('INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("'.$u->info['battle'].'","'.$u->info['id'].'","'.time().'","'.$itm['item_id'].'","'.$itm['name'].'","1")'); - // - mysql_query('INSERT INTO `battle_actions` (`uid`,`btl`,`time`,`vars`,`vals`) VALUES ( - "'.$u->info['id'].'","'.$u->info['battle'].'","'.time().'","use_cast_tactic","" - )'); - $u->info['tactic'.$st['addtac']] += $st['addtacv']; - mysql_query('UPDATE `stats` SET `tactic'.$st['addtac'].'` = "'.$u->info['tactic'.$st['addtac']].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Доабвляем лог - if( $u->info['sex'] == 0 ) { - $txt_m = '{u1} применил заклинание "'.$itm['name'].'".'; - }else{ - $txt_m = '{u1} применила заклинание "'.$itm['name'].'".'; - } - $this->inBattleLog($txt_m,NULL); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.($itm['iznosNOW'] + 1).'" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - $u->error = 'Заклятие "'.$itm['name'].'" было успешно использовано'; - } - }else{ - $u->error = 'Вы погибли...'; - } - }elseif($itm['magic_inci']=='add_animal') - { - if($u->info['animal']>0) - { - $u->error = 'Не удалось использовать "'.$itm['name'].'", у Вас уже есть зверь.'; - }else{ - $anm = array('type'=>1,'name'=>'','obraz'=>'','stats'=>'','sex'=>0); - - //Выбираем тип зверя - - if($itm['name'] == 'Призвать Сову') { - $anm['type'] = 2; - }elseif($itm['name'] == 'Призвать Светляка') { - $anm['type'] = 3; - }elseif($itm['name'] == 'Призвать Кота') { - $anm['type'] = 1; - }elseif($itm['name'] == 'Призвать Чертяку') { - - $anm['type'] = 4; - }elseif($itm['name'] == 'Призвать Свина') { - $anm['type'] = 6; - }elseif($itm['name'] == 'Призвать Пса') { - $anm['type'] = 5; - }elseif($itm['name'] == 'Призвать Дракона') { - $anm['type'] = 7; - - if($anm['type']==1) - { - $anm['name'] = 'Кот'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'20864.gif',2=>'21301.gif',3=>'21139.gif',4=>'20427.gif'); - $anm['stats'] = 's1=2|s2=5|s3=2|s4=5|rinv=40|m9=5|m6=10'; - }elseif($anm['type']==7) - { - $anm['name'] = 'Дракон'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'21338_pgtpdbx.gif'); - $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; - } - }elseif($anm['type']==2) - { - $anm['name'] = 'Сова'; - $anm['sex'] = 1; - $anm['obraz'] = array(1=>'21415.gif',2=>'21722.gif',3=>'21550.gif'); - $anm['stats'] = 's1=2|s2=2|s3=5|s4=5|rinv=40|m9=5|m6=10'; - }elseif($anm['type']==3) - { - $anm['name'] = 'Светляк'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'22277.gif',2=>'22265.gif',3=>'22333.gif',4=>'22298.gif'); - $anm['stats'] = 's1=3|s2=10|s3=3|s4=4|rinv=40|m9=5|m6=10'; - }elseif($anm['type']==4) - { - $anm['name'] = 'Чертяка'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'22177.gif',2=>'21976.gif',3=>'21877.gif'); - $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; - }elseif($anm['type']==5) - { - $anm['name'] = 'Пес'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'22352.gif',2=>'23024.gif',3=>'22900.gif',4=>'22501.gif',5=>'22700.gif'); - $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; - }elseif($anm['type']==6) - { - $anm['name'] = 'Свин'; - $anm['sex'] = 0; - $anm['obraz'] = array(1=>'24000.gif',2=>'25000.gif',3=>'27000.gif',4=>'28000.gif'); - $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; - } - $anm['obraz'] = $anm['obraz'][rand(1,count($anm['obraz']))]; - $anm['obraz'] = str_replace('.gif','',$anm['obraz']); - $anm['obraz'] = str_replace('.jpg','',$anm['obraz']); - $anm['obraz'] = str_replace('.png','',$anm['obraz']); - $ins = mysql_query('INSERT INTO `users_animal` (`type`,`name`,`uid`,`obraz`,`stats`,`sex`) VALUES ("'.$anm['type'].'","'.$anm['name'].'","'.$u->info['id'].'","'.$anm['obraz'].'","'.$anm['stats'].'","'.$anm['sex'].'")'); - if($ins) - { - - $u->info['animal'] = mysql_insert_id(); - mysql_query('UPDATE `users` SET `animal` = "'.$u->info['animal'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Вы успешно использовали "'.$itm['name'].'" и помните - "Мы в ответе за тех, кого приручили".'; - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал заклинание "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'", что-то здесь не так ...'; - } - } - }elseif($goodUse == 1) - { - if($itm['magic_inc'] == '') { - $itm['magic_inc'] = $itm['magic_inci']; - } - $us = $this->add_eff($u->info['id'],$itm['magic_inc']); - if($us[0]==1) - { - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - if($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - $u->addDelo(1,$u->info['id'],'"System.inventory": Персонаж использовал заклинание "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0); - $this->youuse++; - $u->error = 'Вы успешно использовали заклинание "'.$itm['name'].'"
    '.$us[1].''; - //$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" использовал'.$sx.' заклинание "'.$itm['name'].'" на себя.'; - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')"); - }else{ - if($u->error != '') { - $u->error = 'Не удалось использовать "'.$itm['name'].'"...
    '.$u->error; - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'"...'; - } - } - }else{ - if($u->error != '') { - $u->error = 'Не удалось использовать "'.$itm['name'].'"
    '.$u->error; - }else{ - $u->error = 'Не удалось использовать "'.$itm['name'].'"'; - } - } - } - //------------------------------ - } - } - if( $goodUse == 1 ) { - mysql_query('UPDATE `items_users` SET `lastUPD` = '.time().' WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); - } - }else{ - if ($id==5555) - { - mysql_query('UPDATE `stats` SET `seff` = 0 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Эфекты развернуты'; - - }elseif ($id==7777){ - mysql_query('UPDATE `stats` SET `seff` = 1 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Эфекты свернуты'; - }else{ - $u->error = 'Предмет не найден в инвентаре'; - } - - } - } - - - public function add_eff($uid,$id,$is_no = NULL) - { - $g = array(0=>0,1=>''); - $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.$id.'" LIMIT 1')); - - if($is_no != NULL) { - //добавляем эффект персонажу - if($eff['onlyOne'] > 0) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$uid.'" AND `delete` = "0" AND `id_eff` = "'.$eff['id2'].'"'); - if($upd1) - { - $goodUse = 1; - } - } - if($st['oneType'] > 0) - { - //убираем прошлые эффекты - $goodUse = 0; - $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$uid.'" AND `delete` = "0" AND `overType` = "'.$eff['overType'].'"'); - if($upd2) - { - $goodUse = 1; - } - } - } - if($goodUse == 1 || $is_no == NULL) { - if(isset($eff['id2'])) - { - //$eff = $this->paguba($eff); - $n = $eff['mname']; - $d = $eff['mdata']; - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("'.$eff['oneType'].'","'.$eff['id2'].'","'.$uid.'","'.$n.'","'.time().'","'.$d.'","'.$eff['noAce'].'")'); - if($ins) - { - $g[0] = 1; - $g[1] = '...'; - } - } - } - return $g; - } - - //Проверка склонностей в поединке, куда вмешиваемся - public function testAlignAtack( $u1 , $u2 , $btl_test ) { - $r = true; - if( $btl_test['type'] != 500 && $btl_test['dn_id'] == 0 && $btl_test['team_win'] == -1 ) { - $u1 = mysql_fetch_array(mysql_query('SELECT `id`,`align` FROM `users` WHERE `id` = "'.mysql_real_escape_string($u1).'" LIMIT 1')); - $u2 = mysql_fetch_array(mysql_query('SELECT `id`,`team` FROM `stats` WHERE `id` = "'.mysql_real_escape_string($u2).'" LIMIT 1')); - $u1['align'] = floor($u1['align']); - $tm = $tm[$u1['team']]; - $no_align = array(); - if( $u1['align'] == 1 ) { - $no_align[3] = true; - }elseif( $u1['align'] == 3 ) { - $no_align[1] = true; - } - - $sp = mysql_query('SELECT `u`.`align`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`battle` = "'.$btl_test['id'].'" AND `st`.`team` != "'.$u2['team'].'"'); - while( $pl = mysql_fetch_array($sp) ) { - if( $no_align[floor($pl['align'])] == true ) { - $r = false; - } - } - } - return $r; - } - - //Проверка травмы - public function testTravma( $uid , $vals ) { - $r = false; - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "'.$uid.'" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if( isset($tr_pl['id']) && $tr_pl['v1'] >= $vals ) { - $r = true; - } - return $r; - } - - //создаем нападение на персонажа - public function atackUser($uid1, $uid2, $tm, $btl, $addExp = 0, $type = 0, $kulak = 0, $bsid = 0) { - global $u; - $usr = mysql_fetch_array(mysql_query('SELECT `u`.*,`s`.* FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `u`.`id` = `s`.`id` WHERE `u`.`id` = "'.$uid2.'" LIMIT 1')); - $btl_test = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$btl.'" AND `team_win` = -1 LIMIT 1')); - //$u->info['clan'] - Мой $usr['clan'] - Противник // кланвар - $clan_test = mysql_fetch_array(mysql_query('SELECT * FROM `clan_wars` WHERE ((`clan1`="'.$u->info['clan'].'" AND `clan2`="'.$usr['clan'].'") OR (`clan2`="'.$u->info['clan'].'" AND `clan1`="'.$usr['clan'].'")) AND `time_finish` > "'.time().'" LIMIT 1')); - $good = 0; - //Эффекты из-за которых нельзя нападать - $efsno = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid2.'" - AND `name` LIKE "%Лепим снежок%" AND `delete` = "0" - LIMIT 1')); - //$check = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars`= "end_trup" AND `time` > "'.(time()-3*60*60).'" ORDER BY `actions`.`time` DESC LIMIT 1;')); - $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "'.$u->info['id'].'" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - $check2 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE (`id_eff` = 479 OR `id_eff` = 480 OR `id_eff` = 481) AND `uid` = "'.$usr['id'].'" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - /*if( $usr['no_ip'] == 'trupojor' && $usr['level'] != $u->info['level'] ) { - $u->error = 'Нельзя нападать на монстра этого уровня!';*/ - if( $usr['no_ip'] == 'trupojor' && $usr['level'] ==9 && $u->info['level']>9 ) { - $u->error = 'Нельзя нападать на монстра этого уровня!'; - }elseif( $usr['no_ip'] == 'trupojor' && $usr['level'] ==10 && ($u->info['level']<10 || $u->info['level']>11 )) { - $u->error = 'Нельзя нападать на монстра этого уровня!'; - }elseif( $ua['no_ip'] == 'trupojor' && isset($check['id']) ) { //&& $ua['level'] >9 - $u->error = 'Нельзя нападать на монстра чаще одного раза в 3 часа!'; - }elseif(isset($check2['id'])) { //&& $ua['level'] >9 - $u->error = 'Персонаж имеет защиту от нападения!'; - //}elseif( $u->info['level'] > $usr['level']+1 ) { - //$u->error = 'Вы слишком сильны для этого боя'; - }elseif( $usr['level']==8 && $usr['no_ip'] != 'trupojor') { - $u->error = 'На 8-е уровни нападать нельзя.'; - }elseif( $u->info['level'] != $usr['level'] && $usr['no_ip'] != 'trupojor' && !isset ($clan_test['id'])) { - $u->error = 'Нападать можно на персонажей только своего уровня!!!'; - }elseif( isset($btl_test['id']) && $btl_test['noatack'] > 0 ) { - $u->error = 'Поединок защищен магией! Вы не можете вмешаться!'; - }elseif($usr['level'] < 8) { - $u->error = 'Новички находятся под защитой Мироздателя...'; - }elseif($u->info['level'] < 8) { - $u->error = 'Тренируйтесь вам пока еще рано...'; - }elseif( isset($efsno['id']) && $efsno['delete'] > 0 ) { - $u->error = 'Невозможно напасть, противник чем-то занят...'; - }elseif($usr['admin']==1 && $u->info['admin'] == 0 ) { - $u->error = 'Уважайте хранителей...'; - }elseif($this->testTravma($uid2 , 3) == true) { - $u->error = 'Противник тяжело травмирован, нельзя напасть!'; - } elseif($this->testTravma($uid1 , 2) == true) { - $u->error = 'Вы травмированы, нельзя напасть!'; - } elseif($bsid != 0 && ($u->info['x'] != $usr['x'] || $u->info['y'] != $usr['y'] )) { - $u->error = 'Вы находитесь в разных комнатах...'; - } elseif($usr['clan'] != 0 && ($usr['clan'] == $u->info['clan']) && $u->info['admin'] == 0) { - $u->error = 'Чтите честь ваших сокланов.'; - } elseif($btl != 0 && $btl_test['smert'] == 1 && $type != 222) { - $u->error = 'Вы не можете вмешаться в этот кровавый поединок!'; - } elseif($btl == 0) { - $s01 = $u->getStats($uid1,0); - if($s01['hpNow'] < floor($s01['hpAll']/100*33) ) { - $u->error = 'Нельзя напасть, у противника не восстановилось здоровье'; - } else { - $addExp += $usr['bbexp']; - //effect ненападения - if( $usr['no_ip'] == 'trupojor') - { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","'.$u->info['id'].'","Защита от нападения","zashitatk=1","'.time().'")'); - } - //тут клан вар - - //************ - //нападаем на персонажа - $timewait=rand(1,3); - //===Удаление защиты от нападения в результате нападения пользователем - $dsl=mysql_query('SELECT * FROM `eff_users` WHERE (`id_eff` = 479 OR `id_eff` = 480 OR `id_eff` = 481) AND `uid` = "'.$u->info['id'].'" AND `delete` = 0 ORDER BY `overType` DESC;'); - while( $dpl = mysql_fetch_array($dsl)) - { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$dpl['id'].'";'); - } - //======= - if ($type==222) // - { - $ins = mysql_query('INSERT INTO `battle` (`kulak`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`, `inTurnir`, `clan1`, `clan2`, `smert` ) VALUES ( - "'.$kulak.'", - "'.$u->info['city'].'", - "'.time().'", - "'.$u->info['login'].','.$usr['login'].'", - "'.(60*$timewait).'", - "99", - "0", - "0", - "50", - "9", - "'.$addExp.'", - "0", - "'.$bsid.'", - "'.$u->info['clan'].'", - "'.$usr['clan'].'", - "1" - )'); - } - elseif (isset ($clan_test['id'])) // - { - $ins = mysql_query('INSERT INTO `battle` (`kulak`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`, `inTurnir`, `clan1`, `clan2` ) VALUES ( - "'.$kulak.'", - "'.$u->info['city'].'", - "'.time().'", - "'.$u->info['login'].','.$usr['login'].'", - "'.(60*$timewait).'", - "250", - "0", - "0", - "50", - "9", - "'.$addExp.'", - "0", - "'.$bsid.'", - "'.$u->info['clan'].'", - "'.$usr['clan'].'")'); - } - else - { - $ins = mysql_query('INSERT INTO `battle` (`kulak`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`, `inTurnir`) VALUES ( - "'.$kulak.'", - "'.$u->info['city'].'", - "'.time().'", - "'.$u->info['login'].','.$usr['login'].'", - "'.(60*$timewait).'", - "'.$type.'", - "0", - "0", - "50", - "9", - "'.$addExp.'", - "0", "'.$bsid.'")'); - } - unset($timewait); - if($ins) - { - $btl_id = mysql_insert_id(); - //Обновляем НР и МР игрокам - if($s01['level']<=7) - { - $s01['tactic7'] = floor(10/$s01['hpAll']*$s01['hpNow']); - }elseif($s01['level']==8) - { - $s01['tactic7'] = floor(20/$s01['hpAll']*$s01['hpNow']); - }elseif($s01['level']==9) - { - $s01['tactic7'] = floor(30/$s01['hpAll']*$s01['hpNow']); - }elseif($s01['level']>=10) - { - $s01['tactic7'] = floor(40/$s01['hpAll']*$s01['hpNow']); - } - $s01 = array( 'hpAll' => $s01['hpAll'] , 'hpNow' => $s01['hpNow'] , 'mpAll' => $s01['mpAll'] , 'mpNow' => $s01['mpNow'] ); - $s02 = $u->getStats($uid2,0); - if($s02['level']<=7) - { - $s02['tactic7'] = floor(10/$s02['hpAll']*$s02['hpNow']); - }elseif($s02['level']==8) - { - $s02['tactic7'] = floor(20/$s02['hpAll']*$s02['hpNow']); - }elseif($s02['level']==9) - { - $s02['tactic7'] = floor(30/$s02['hpAll']*$s02['hpNow']); - }elseif($s02['level']>=10) - { - $s02['tactic7'] = floor(40/$s02['hpAll']*$s02['hpNow']); - } - - //Духовность, спасение - /*if( $s01['s7'] > 49 ) { - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '".$s01['id']."', 'Спасение', 'add_spasenie=1', 0, 77, 0, '".$s01['id']."', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); - "); - } - if( $s02['s7'] > 49 ) { - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '".$s02['id']."', 'Спасение', 'add_spasenie=1', 0, 77, 0, '".$s02['id']."', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); - "); - }*/ - // - - $s02 = array( 'hpAll' => $s02['hpAll'] , 'hpNow' => $s02['hpNow'] , 'mpAll' => $s02['mpAll'] , 'mpNow' => $s02['mpNow'] ); - - $upd2 = mysql_query('UPDATE `users` SET `battle`="'.$btl_id.'" WHERE `id` = "'.$uid1.'" OR `id` = "'.$uid2.'" LIMIT 2'); - mysql_query('UPDATE `stats` SET `lider` = "'.$btl_id.'",`tactic7` = "'.$s01['tactic7'].'",`hpNow` = "'.$s01['hpNow'].'",`mpNow` = "'.$s01['mpNow'].'",`team`="1",`zv` = "0" WHERE `id` = "'.$uid1.'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `lider` = "'.$btl_id.'",`tactic7` = "'.$s02['tactic7'].'",`hpNow` = "'.$s02['hpNow'].'",`mpNow` = "'.$s02['mpNow'].'",`team`="2",`zv` = "0" WHERE `id` = "'.$uid2.'" LIMIT 1'); - - if( $kulak > 0 || $btl_test['kulak'] > 0 ) { - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE ( `uid` = "'.$uid1.'" OR `uid` = "'.$uid2.'" ) AND `delete` = "0"'); - } - - $good = $btl_id; - if($bsid != 0) { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1')); - if($u->info['sex'] == 0) { - $text = ' {u1} напал на {u2} завязался бой »»'; - } else { - $text = ' {u1} напала на {u2} завязался бой »»'; - } - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `align`, `clan`, `battle`, `level` FROM `users` WHERE (`inUser` = "'.$usr['id'].'" OR `id` = "'.$usr['id'].'") LIMIT 1')); - if(!isset($usr_real['id'])) { $usr_real = $usr; } - if(isset($usr_real['id'])) { - $usrreal = ''; - if($usr_real['align'] > 0) { $usrreal .= ''; } - if($usr_real['clan'] > 0) { $usrreal .= ''; } - $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; - } else { - $usrreal = 'Невидимка[??]'; - } - $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); - if(isset($me_real['id'])) { - $mereal = ''; - if($me_real['align'] > 0) { $mereal .= ''; } - if($me_real['clan'] > 0) { $mereal .= ''; } - $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; - } else { - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}', $mereal, $text); - $text = str_replace('{u2}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$bs['id'].'", "'.$bs['count'].'", "'.$bs['city'].'", - "'.round($bs['money']*0.85,2).'","'.$i.'")'); - unset($text, $usrreal, $mereal, $usr_real, $me_real); - } - } - } - }elseif( isset($btl_test['id']) && $btl_test['type'] == 500 && $usr['team'] == 1 ){ - $u->error = 'Нельзя сражаться на стороне монстров!'; - }elseif( isset($btl_test['id']) && $btl_test['type'] == 250 && $u->info['clan'] != $btl_test['clan1'] && $u->info['clan'] != $btl_test['clan2']){ - $u->error = 'Нельзя попасть в клановые бои - если вы неявляетесь представителем данных кланов!!!'; - }elseif( isset($btl_test['id']) && $btl_test['invis'] > 0 ){ - $u->error = 'Нельзя вмешиваться в невидимый бой!'; - }elseif( $btl_test['noatack'] > 0 ) { - $u->error = 'В этот поединок нельзя вмешиваться!'; - }else{ - - //вмешиваемся в бой - //effect ненападения - if( $usr['no_ip'] == 'trupojor') - { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","'.$u->info['id'].'","Защита от нападения","zashitatk=1","'.time().'")'); - } - $upd = mysql_query('UPDATE `users` SET `battle`="'.$btl.'" WHERE `id` = "'.$uid1.'" LIMIT 1'); - if($upd) - { - - if( $kulak > 0 || $btl_test['kulak'] > 0 ) { - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "'.$uid1.'" AND `delete` = "0"'); - } - - $uid1st = $u->getStats($uid1); - $uid1u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`clan`,`align`,`sex` FROM `users` WHERE `id` = "'.$uid1.'" LIMIT 1')); - - if($uid1u['level']<=7) - { - $uid1st['tactic7'] = floor((10+$uid1st['s7'])/$uid1st['hpAll']*$uid1st['hpNow']); - }elseif($uid1u['level']==8) - { - $uid1st['tactic7'] = floor((20+$uid1st['s7'])/$uid1st['hpAll']*$uid1st['hpNow']); - }elseif($uid1u['level']==9) - { - $uid1st['tactic7'] = floor((30+$uid1st['s7'])/$uid1st['hpAll']*$uid1st['hpNow']); - }elseif($uid1u['level']>=10) - { - $uid1st['tactic7'] = floor((40+$uid1st['s7'])/$uid1st['hpAll']*$uid1st['hpNow']); - }else{ - $uid1st['tactic7'] = floor((10+$uid1st['s7'])/$uid1st['hpAll']*$uid1st['hpNow']); - } - - //Духовность, спасение - if( $uid1st['s7'] > 49 ) { - mysql_query('UPDATE `eff_users` SET `delete`="'.time().'" WHERE `uid` = "'.$uid1st['id'].'" AND `overType` = 101 AND `delete` = 0'); - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '".$uid1st['id']."', 'Спасение', 'add_spasenie=1', 101, 77, 0, '".$uid1st['id']."', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); - "); - } - - - $btxt = ''; - if( $uid1u['align'] > 0 ) { - $btxt = $btxt.''; - } - if( $uid1u['align2'] > 0 ) { - $btxt = $btxt.''; - } - if( $uid1u['clan'] > 0 ) { - $btxt = $btxt.''; - } - $btxt = $btxt.'{u1}['.$uid1u['level'].']'; - if( $uid1u['sex'] == 1 ) { - $btxt = $btxt.' вмешалась в поединок.'; - }else{ - $btxt = $btxt.' вмешался в поединок.'; - } - - if( $kulak > 0 ) { - $btxt .= ' (Кулачное нападение)'; - } - - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$btl.'" ORDER BY `id_hod` DESC LIMIT 1')); - if(isset($lastHOD['id'])) { - $id_hod = $lastHOD['id_hod']; - if($lastHOD['type']!=6) { - $id_hod++; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$btl.'","'.($id_hod).'","{tm1} '.$btxt.'","login1='.$uid1st['login'].'||t1='.$uid1st['team'].'||login2='.$uid1st['login'].'||t2='.$uid1st['team'].'||time1='.time().'","","","","","6")'); - } - - // Бафф Зверя animal_bonus --------------------------------- - if($u->info['animal'] > 0) { - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.$u->info['animal'].'" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if(isset($a['id'])) { - if($a['eda']>=1) { - $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "'.$a['type'].'" AND `level` = "'.$a['level'].'" LIMIT 1')); - $anl = $anl['bonus']; - - $tpa = array(1=>'cat',2=>'owl',3=>'wisp',4=>'demon',5=>'dog',6=>'pig',7=>'dragon'); - $tpa2 = array(1=>'Кота',2=>'Совы',3=>'Светляка',4=>'Чертяки',5=>'Пса',6=>'Свина',7=>'Дракона'); - $tpa3 = array(1=>'Кошачья Ловкость',2=>'Интуиция Совы',3=>'Сила Стихий',4=>'Демоническая Сила',5=>'Друг',6=>'Полная Броня',7=>'Инферно'); - - mysql_query('UPDATE `eff_users` SET `delete`="'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `overType` = 100 AND `delete` = 0'); - mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_'.$tpa[$a['type']].'.gif",22,"'.$u->info['id'].'","'.$tpa3[$a['type']].' ['.$a['level'].']","'.$anl.'","100","77","priem","'.$u->info['id'].'")'); - - if ($a['type']==6) - { - if($a['level']==1 || $a['level']==2 || $a['level']==3){$zhp=50;} - elseif($a['level']==4){$zhp=75;} - elseif($a['level']==5 || $a['level']==6){$zhp=125;} - elseif($a['level']==7 || $a['level']==8){$zhp=150;} - elseif($a['level']==9){$zhp=200;}elseif($a['level']==10){$zhp=300;} - else {$zhp=0;} - $u->info['hpNow']+=$zhp; - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - /*$anl = $u->lookStats($anl); - - $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].''; - $vLog .= '||s2=1||t2='.$u->info['team'].'||login2='.$a['name'].' (Зверь '.$u->info['login'].')'; - - $mas1 = array('time'=>time(),'battle'=>$btl,'id_hod'=>1,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - - $ba = ''; - $i6 = 0; - while($i6items['add'])) { - if(isset($anl['add_'.$u->items['add'][$i6]])) { - if($anl['add_'.$u->items['add'][$i6]] > 0) { - $ba .= $u->is[$u->items['add'][$i6]].': +'.$anl['add_'.$u->items['add'][$i6]].', '; - } - } - $i6++; - } - $ba = trim($ba,', '); - if($ba == '') { - $ba = 'Эффект отсутсвует'; - } - */ - //$mas1['text'] = '{tm1} {u2} очнулся от медитации, и призвал заклятье "'.$tpa3[$a['type']].' ['.$a['level'].']" на {u1}. ('.$ba.')'; - //$nxtlg[count($nxtlg)] = $mas1; - //mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "'.$a['id'].'" LIMIT 1'); - //$btl->add_log($mas1); - //$btl->get_comment();*/ - }else{ - $u->send('',$u->info['room'],$u->info['city'],'',$u->info['login'],''.$a['name'].' нуждается в еде...',time(),6,0,0,0,1); - } - } - } - // Бафф Зверя animal_bonus --------------------------------- - $ltm = array(1=>2, 2=>1); - mysql_query('UPDATE `stats` SET `hpNow` = "'.$uid1st['hpNow'].'",`mpNow` = "'.$uid1st['mpNow'].'",`team`="'.$ltm[$tm].'",`tactic7`="'.(0+$uid1st['tactic7']).'" WHERE `id` = "'.$uid1.'" LIMIT 1'); - $good = $btl; - unset($uid1st); - if($bsid != 0) { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1')); - //$cloneuid=mysql_fetch_array(mysql_query('SELECT `uid` FROM `battle_users` WHERE `login` = "'.$u->info['login'].'" AND `battle` ="'.$btl.'" LIMIT 1')); // uid клона - //mysql_query('UPDATE `stats` SET `tactic7`= 10.000 WHERE `id` = "'.$cloneuid.'" LIMIT 1'); - if($u->info['sex'] == 0) { - $text = ' {u1} вмешался в поединок против {u2} »»'; - } else { - $text = ' {u1} вмешалась в поединок против {u2} »»'; - } - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `align`, `clan`, `battle`, `level` FROM `users` WHERE `inUser` = "'.$usr['id'].'" LIMIT 1')); - if(!isset($usr_real['id'])) { $usr_real = $usr; } - if(isset($usr_real['id'])) { - $usrreal = ''; - if($usr_real['align'] > 0) { $usrreal .= ''; } - if($usr_real['clan'] > 0) { $usrreal .= ''; } - $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; - } else { - $mereal = 'Невидимка[??]'; - } - $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); - if(isset($me_real['id'])) { - $mereal = ''; - if($me_real['align'] > 0) { $mereal .= ''; } - if($me_real['clan'] > 0) { $mereal .= ''; } - $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; - } else { - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}', $mereal, $text); - $text = str_replace('{u2}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$bs['id'].'", "'.$bs['count'].'", "'.$bs['city'].'", - "'.round($bs['money']*0.85,2).'","'.$i.'")'); - unset($text,$usrreal,$mereal,$usr_real,$me_real); - } - } - } - return $good; - } - - //Нападение на центральной площади - public function magicCentralAttack() { - global $c, $code, $u, $re; - } -} - -$magic = new Magic; - -?> \ No newline at end of file diff --git a/_incl_data/class/__reg.php b/_incl_data/class/__reg.php deleted file mode 100644 index 254dc037..00000000 --- a/_incl_data/class/__reg.php +++ /dev/null @@ -1,405 +0,0 @@ -"'.(time()-60*60*1).'" AND `ipreg` = "'.mysql_real_escape_string(IP).'" LIMIT 1')); - if(isset($_COOKIE['reg_capitalcity']) || (int)$_COOKIE['reg_capitalcity']>time() || isset($lr['id'])) - { - $error .= 'Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.
    '; $_POST['step'] = 1; - } - - if($error=='') - { - - $reg_bonus = false; - /*if(isset($_POST['register_code'])) - { - $cd = mysql_fetch_array(mysql_query('SELECT * FROM `register_code` WHERE `code` = "'.mysql_real_escape_string($_POST['register_code']).'" AND `time_finish` = "0" AND `use` = "0" LIMIT 1')); - if(isset($cd['id']) && $cd['use']==0) - { - $reg_bonus = true; - $upd = mysql_query('UPDATE `register_code` SET `use` = "'.$reg['id'].'",`time_start`="'.time().'" WHERE `id` = "'.$cd['id'].'" LIMIT 1'); - if($upd && $reg['id']>0) - { - $uz = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "'.mysql_real_escape_string($cd['uid']).'" LIMIT 1')); - if(!isset($uz['id'])) - { - $uz['login'] = 'Невидимка'; - } - $error .= 'Вы успешно активировали приглашение от '.$uz['login'].'. Теперь вы можете зарегистрироваться. Код действует только на эту регистрацию.
    '; - mysql_query("UPDATE `items_users` SET `data`='info=Код приглашения: ".$cd['code']."
    При утери приглашения регистрация по данному коду будет запрещена.
    Кто-то регестрируется по вашему приглашению. Дата: ".date('d.n.Y H:i',time())."
    ' WHERE `secret_id` = '".$cd['code']."' LIMIT 1"); - $cd['use'] = $reg['id']; - - if($cd['time_create']1) - { - //Запрещенные логины - $nologin = array(0=>'ангел',1=>'angel',2=>'администрация',3=>'administration',4=>'Комментатор',5=>'Мироздатель',6=>'Мусорщик',7=>'Падальщик',8=>'Повелитель',9=>'Архивариус',10=>'Пересмешник',11=>'Волынщик',12=>'Лорд Разрушитель',13=>'Милосердие',14=>'Справедливость',15=>'Искушение',16=>'Вознесение'); - $blacklist = "!@#$%^&*()\+Ёё|/'`\""; - $sr = '_-йцукенгшщзхъфывапролджэячсмитьбюё1234567890'; - $i = 0; - while($imystr($reg_d[0]))) - { - $error .= 'Выберите, пожалуйста, другой ник.
    '; $_POST['step'] = 1; $i = count($nologin); - } - $i++; - } - $reg_d[0] = str_replace(' ',' ',$reg_d[0]); - //Логин от 4 до 20 символов - if(strlen($reg_d[0])>20) - { - $error .= 'Логин должен содержать не более 20 символов.
    '; $_POST['step'] = 1; - } - if(strlen($reg_d[0])<4) - { - $error .= 'Логин должен содержать не менее 4 символов.
    '; $_POST['step'] = 1; - } - //Один алфавит - $er = $this->en_ru($reg_d[0]); - if($er==true) - { - $error .= 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.
    '; $_POST['step'] = 1; - } - //Запрещенный символы - if(strpos($sr,$reg_d[0])) - { - $error .= 'Логин содержит запрещенные символы.
    '; $_POST['step'] = 1; - } - //Персонажи в базе - $log = mysql_fetch_array(mysql_query('SELECT `id` from `users` where `login`="'.mysql_real_escape_string($reg_d[0]).'" LIMIT 1')); - $log2 = mysql_fetch_array(mysql_query('SELECT `id` from `lastNames` where `login`="'.mysql_real_escape_string($reg_d[0]).'" LIMIT 1')); - if(isset($log['id']) || isset($log2['id'])) - { - $error .= 'Логин '.$reg_d[0].' уже занят, выберите другой.
    '; $_POST['step'] = 1; - } - //Разделители - if(substr_count($reg_d[0],' ')+substr_count($reg_d[0],'-')+substr_count($reg_d[0],'_')>2) - { - $error .= 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).
    '; $_POST['step'] = 1; - } - $reg_d[0] = trim($reg_d[0],' '); - - - if($_POST['step']!=1) - { - $stp = 2; $noup = 0; - } - } - if($_POST['step']>2) - { - //проверяем пароль - if(strlen($reg_d[1])<6 || strlen($reg_d[1])>30) - { - $error .= 'Длина пароля не может быть меньше 6 символов или более 30 символов.
    '; $_POST['step'] = 2; - } - if($reg_d[1]!=$reg_d[2]) - { - $error .= 'В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее.
    '; $_POST['step'] = 2; - } - if(preg_match('/'.$reg_d[0].'/i',$reg_d[1])) - { - $error .= 'Пароль содержит элементы логина.
    '; $_POST['step'] = 2; - } - if($_POST['step']!=2) - { - $stp = 3; $noup = 0; - } - } - if($_POST['step']>3) - { - //проверяем e-mail - if(strlen($reg_d[3])<6 || strlen($reg_d[3])>50) - { - $error .= 'E-mail не может быть короче 6-х символов и длинее 50-ти.
    '; $_POST['step'] = 3; - } - - if(!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3])) - { - $error .= 'Вы указали явно ошибочный E-mail.
    '; $_POST['step'] = 3; - } - - $reg_d[4] = $chat->str_count($reg_d[4],30); - $reg_d[5] = $chat->str_count($reg_d[5],30); - - if($_POST['step']!=3) - { - $stp = 4; $noup = 0; - } - } - if($_POST['step']>4) - { - //Имя, Пол, Город, Девиз и т.д. - $er = $this->en_ru($reg_d[6]); - if($er==true || strlen($reg_d[6])<2) - { - $error .= 'Укажите ваше реальное имя!
    '; $_POST['step'] = 4; - } - - $reg_d[6] = $chat->str_count($reg_d[6],90); - $reg_d[7] = round($reg_d[7]); - $reg_d[8] = round($reg_d[8]); - $reg_d[9] = round($reg_d[9]); - - if($reg_d[7]<1 || $reg_d[7]>31 || $reg_d[8]<1 || $reg_d[8]>12 || $reg_d[9]<1920 || $reg_d[9]>2006) - { - $error .= 'Ошибка в написании дня рождения.
    '; $_POST['step'] = 4; - } - - if($reg_d[15]!=0 && $reg_d[15]!=1) - { - $error .= 'Вы указали не верный пол.
    '; $_POST['step'] = 4; - } - - if($reg_d[14]!='Black' && $reg_d[14]!='Blue' && $reg_d[14]!='Fuchsia' && $reg_d[14]!='Gray' && $reg_d[14]!='Green' && $reg_d[14]!='Maroon' && $reg_d[14]!='Navy' && $reg_d[14]!='Olive' && $reg_d[14]!='Purple' && $reg_d[14]!='Teal' && $reg_d[14]!='Orange' && $reg_d[14]!='Chocolate' && $reg_d[14]!='DarkKhaki' && $reg_d[14]!='SandyBrown') - { - $error .= 'Вы указали не верный цвет сообщения в чате.
    '; $_POST['step'] = 4; - } - - if($_POST['step']!=4) - { - $stp = 5; $noup = 0; - } - } - if($_POST['step']>5) - { - //Соглашение с законами - if(!isset($_POST['law_'.$reg['id']]) || $_POST['law_'.$reg['id']]!='on') - { - $error .= 'Извините, без принятия правил нашего клуба, вы не можете зарегистрировать свой персонаж.
    '; $_POST['step'] = 5; - } - - if(!isset($_POST['law2_'.$reg['id']]) || $_POST['law2_'.$reg['id']]!='on') - { - $error .= 'Извините, без принятия Соглашения о предоставлении сервиса игры '.$c['title'].', вы не можете зарегистрировать персонаж.
    '; $_POST['step'] = 5; - } - - if($_POST['code']!=$_SESSION['code'] || $_SESSION['code']<100 || $_POST['code']=='') - { - $error .= 'Ошибка введения кода.
    '; $_POST['step'] = 5; - } - - if($_POST['step']!=5) - { - //завершение регистрации и редирект в игру - - if($filter->spamFiltr($reg_d[13])!=0) - { - $reg_d[13] = ''; - } - if($filter->spamFiltr($reg_d[10])!=0) - { - $reg_d[10] = ''; - } - if($filter->spamFiltr($reg_d[6])!=0) - { - $reg_d[6] = ''; - } - - /*$mbid = mysql_fetch_array(mysql_query('select min(t1.id + 1) -from users t1 -where t1.id + 1 not in (select id from users where id > 9999) AND t1.id > 9998')); - //$mbid1 = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "'.$mbid[0].'" LIMIT 1')); - //$mbid2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `id` = "'.$mbid[0].'" LIMIT 1')); - //if(isset($mbid1['id']) && isset($mbid2['id'])) { - */ - $mbid = 'NULL'; - /*}else{ - /* чистим возможные данные */ - /*if($mbid [0]> 0) { - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$mbid[0].'" LIMIT 1'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$mbid[0].'" LIMIT 1'); - mysql_query('DELETE FROM `bank` WHERE `uid` = "'.$mbid[0].'" LIMIT 1'); - mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$mbid[0].'" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$mbid[0].'" LIMIT 1'); - } - $mbid = $mbid[0]; - }*/ - - if($_COOKIE['b4n'] == '1') { - setcookie('b4n','2',time()+60*60*24*3); - $reg['referal'] = 'btl4.net'; - }elseif(isset($_COOKIE['hstreger'])) { - $reg['referal'] = $_COOKIE['hstreger']; - } - - $ins = mysql_query("INSERT INTO `users` (`activ`,`fnq`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`a1`,`q1`,`mail`,`name`,`bithday`,`sex`,`city_real`,`icq`,`icq_hide`,`deviz`,`chatColor`,`timereg`) VALUES ( - '0', - '0', - '".mysql_real_escape_string($reg['referal'])."', - '0', - '".$reg_d[0]."', - '".md5($reg_d[1])."', - '".IP."', - '".IP."', - 'capitalcity', - 'capitalcity', - '".$reg_d[4]."', - '".$reg_d[5]."', - '".$reg_d[3]."', - '".$reg_d[6]."', - '".$reg_d[7].".".$reg_d[8].".".$reg_d[9]."', - '".$reg_d[15]."', - '".$reg_d[10]."', - '".$reg_d[11]."', - '".$reg_d[12]."', - '".$reg_d[13]."', - '".$reg_d[14]."', - '".time()."')"); - if($ins) - { - $uid = mysql_insert_id(); - - $refer = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned`,`admin`,`level` FROM `users` WHERE `id` = "'.mysql_real_escape_string($reg['referal']).'" LIMIT 1')); - if(isset($refer['id'])) { - mysql_query("INSERT INTO `items_users` (`gift`,`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('".$refer['login']."','".$uid."','3199','noodet=1|items_in_file=sunduk_new|var_id=1|open=1|noremont=1|nodelete=1|nosale=1',1,2,'capitalcity',".time().")"); - $text = 'Вы стали воспитанником игрока "'.$refer['login'].'"! В инвентаре (раздел -прочее-) вы найдете вспомогательные предметы.'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','11','0')"); - } - - mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('".$uid."','".time()."')"); - mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('".$uid."','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')"); - //Добавляем предметы - mysql_query("INSERT INTO `items_users` (`gift`,`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('Мироздатель','".$uid."','1','add_hpAll=3',10,2,'capitalcity',".time().")"); - mysql_query("INSERT INTO `items_users` (`gift`,`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('Мусорщик','".$uid."','73','add_mib3=1|add_mab3=1|add_mib4=1|add_mab4=1',20,2,'capitalcity',".time().")"); - mysql_query("INSERT INTO `items_users` (`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('".$uid."','724','moment=1|sudba=".mysql_real_escape_string($reg_d[0])."|moment_hp=100|nohaos=1|musor=2|noremont=1',100,2,'capitalcity',".time().")"); - mysql_query("INSERT INTO `items_users` (`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('".$uid."','865','tr_lvl=1|sudba=".mysql_real_escape_string($reg_d[0])."|useOnLogin=1|musor=1|noremont=1',50,2,'capitalcity',".time().")"); - mysql_query("INSERT INTO `items_users` (`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('".$uid."','4014','sudba=".mysql_real_escape_string($reg_d[0])."|noremont=1|usefromfile=1|musor=1|nodelete=1|nosale=1|expUpg=300000',1,2,'capitalcity',".time().")"); - - /* - $text = 'Администрация проекта: Желаем приятного общения, великих побед и незабываемых впечатлений в нашей с вами игре! :-)'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','11','0')"); - $text = 'Вы получили предмет [img[items/pot_cureHP100_20.gif]][1] "Зелье Жизни", он находится в инвентаре, в разделе "эликсиры"'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','11','0')"); - $text = 'Вы получили предмет [img[items/pal_button8.gif]][1] "Нападение", он находится в инвентаре, в разделе "заклятия"'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','11','0')"); - $text = 'Вы получили предмет [img[items/qsvit_hran.gif]][1] "Свиток Обучения", он находится в инвентаре, в разделе "заклятия". Использовав данный свиток Вы получите +300.000 ед. опыта'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','11','0')"); - */ - - if(isset($_COOKIE['login']) || isset($_COOKIE['pass'])) - { - setcookie('login','',time()-60*60*24,'',$c['host']); - setcookie('pass','',time()-60*60*24,'',$c['host']); - } - setcookie('login',$reg_d[0],time()+60*60*24*7,'',$c['host']); - setcookie('pass',md5($reg_d[1]),time()+60*60*24*7,'',$c['host']); - setcookie('auth',md5($reg_d[1].'AUTH'.IP),time()+60*60*24*365,'',$c['host']); - setcookie('reg_capitalcity',true,time()+60*60,'',$c['host']); - $chat->send('',1,'capitalcity','','','Вас приветствует новичок: [login:'.$reg_d[0].']',time(),12,1,0,0); - mysql_query("UPDATE `users` SET `online`='".time()."' WHERE `uid` = '".$uid."' LIMIT 1"); - mysql_query("UPDATE `register_code` SET `reg_id`='".$uid."',`time_finish`='".time()."' WHERE `id` = '".$cd['id']."' LIMIT 1"); - mysql_query("UPDATE `items_users` SET `delete`='".time()."' WHERE `secret_id` = '".$cd['code']."' LIMIT 1"); - mysql_query('DELETE FROM `register` WHERE `id` = "'.$reg['id'].'" LIMIT 1'); - header('location: /bk'); - die('Регистарция прошла успешно...'); - }else{ - $error .= 'Ошибка регистрации. Попробуйте позже...
    '; - } - } - } - } - return $stp; - } -} - -$r = new register; -?> \ No newline at end of file diff --git a/_incl_data/class/__seasons.php b/_incl_data/class/__seasons.php deleted file mode 100644 index e91d3078..00000000 --- a/_incl_data/class/__seasons.php +++ /dev/null @@ -1,35 +0,0 @@ - array( 1 , '01' , 'Январь' , 'Январьский' ), - 2 => array( 2 , '02' , 'Февраль' , 'Февральский' ), - 3 => array( 3 , '03' , 'Март' , 'Мартовский' ), - 4 => array( 4 , '04' , 'Апрель' , 'Апрельский' ), - 5 => array( 5 , '05' , 'Май' , 'Майский' ), - 6 => array( 6 , '06' , 'Июнь' , 'Июньский' ), - 7 => array( 7 , '07' , 'Июль' , 'Июльский' ), - 8 => array( 8 , '08' , 'Август' , 'Августовский' ), - 9 => array( 9 , '09' , 'Сентябрь' , 'Сентябрьский' ), - 10 => array( 10 , '10' , 'Октябрь' , 'Октябрьский' ), - 11 => array( 11 , '11' , 'Ноябрь' , 'Ноябрьский' ), - 12 => array( 12 , '12' , 'Декабрь' , 'Декабрьский' ), - ); - - public static $date = array( ), $m = array( ); - - public static function data( $val ) { - self::$m = mysql_fetch_array(mysql_query('SELECT * FROM `sss_m` WHERE `id` = "'.mysql_real_escape_string((int)$val).'" LIMIT 1')); - if( self::$m['s'] != self::$date['m'] ) { - self::$m = array( ); - } - } - -} - -?> \ No newline at end of file diff --git a/_incl_data/class/__telegram.php b/_incl_data/class/__telegram.php deleted file mode 100644 index d40c5202..00000000 --- a/_incl_data/class/__telegram.php +++ /dev/null @@ -1,197 +0,0 @@ -readGood('.$id.',"https://img.new-combats.com/i/misc/read.gif"); nobtext('.$id.');'; - } - } - } - - public function lockMsg($id,$uid) - { - $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id`="'.$id.'" AND `uid`="'.$uid.'" LIMIT 1 FOR UPDATE')); - if(isset($msg['id'])) - { - $lock = array(0=>1,1=>0); - mysql_query('START TRANSACTION'); - $upd = mysql_query('UPDATE `telegram` SET `read`="1",`lock`="'.$lock[$msg['lock']].'" WHERE `id` = "'.$id.'" AND `uid`="'.$uid.'" LIMIT 1'); - mysql_query('COMMIT'); - if($upd) - { - if($lock[$msg['lock']]==1) - { - echo ''; - }else{ - echo ''; - } - } - } - } - - public function deleteMsgAll($uid,$pg) - { - mysql_query('START TRANSACTION'); - $upd = mysql_query('UPDATE `telegram` SET `delete`="1" WHERE `uid`="'.$uid.'" AND `read`="1" AND `lock`="0" AND `delete`="0"'); - mysql_query('COMMIT'); - if($upd) - { - echo ''; - } - } - - public function deleteMsg($id,$uid,$pg) - { - $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id`="'.$id.'" AND `uid`="'.$uid.'" LIMIT 1 FOR UPDATE')); - if(isset($msg['id'])) - { - mysql_query('START TRANSACTION'); - $upd = mysql_query('UPDATE `telegram` SET `delete`="1" WHERE `id` = "'.$id.'" AND `uid`="'.$uid.'" LIMIT 1'); - mysql_query('COMMIT'); - if($upd && $msg['delete']==0 && $msg['lock']==0) - { - echo ''; - } - } - } - - private function addMsgTable($id,$from,$fromType,$ttl,$time,$lock,$read,$pg) - { - $i1 = ''; - if($read==1) - { - $i1 = ''; - } - - if($lock==1) - { - $i1 = ''; - } - - if($fromType==1) - { - $from = ''.$from.''; - }elseif($read==0) - { - $from = ''.$from.''; - } - - echo ' - - - - - - - - -
    '.$i1.'
    '.$from.''.substr($ttl,0,30).'...'.date('d.m.y H:i',$time).'
    - '; - } - - public function seeMsg($uid,$page,$maxPages) - { - $page = ceil($page); - echo ' - - - - - - - - - -
    От когоЗаголовок сообщенияКогда
    Блокировка сообщений
    Удалить все прочитанные сообщения
    '; - - $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `telegram` WHERE `uid`="'.$uid.'" AND `delete`="0"')); - $pg = ceil($i[0]/$maxPages); - if($page<0) - { - $page = 0; - }elseif($page>$pg) - { - $page = $pg; - } - - if($i[0]>0) - { - $sp = mysql_query('SELECT * FROM `telegram` WHERE `uid`="'.$uid.'" AND `delete`="0" ORDER BY `id` DESC LIMIT '.(($page-1)*$maxPages).' , '.$maxPages.''); - while($pl = mysql_fetch_array($sp)) - { - $this->addMsgTable($pl['id'],$pl['from'],$pl['fromType'],$pl['text'],$pl['time'],$pl['lock'],$pl['read'],$page); - } - } - - if($i[0]==0) - { - echo '
    Сообщений нет
    '; - }elseif($i[0]>$maxPages){ - $pages = ''; - $i = 1; - while($i<=$pg) - { - $cls = ''; - if($page==$i) - { - $cls = 'style="color:#6f0000; font-size:14px;"'; - } - $pages .= ' '.$i.''; - $i++; - } - echo ' - - - - - - - - -
    Страницы: '.$pages.'
    '; - } - } - - public function __clone() - { - trigger_error('Дублирование не допускается.', E_USER_ERROR); - } -} - -?> \ No newline at end of file diff --git a/_incl_data/class/__turnir.php b/_incl_data/class/__turnir.php deleted file mode 100644 index 36b8c8b0..00000000 --- a/_incl_data/class/__turnir.php +++ /dev/null @@ -1,539 +0,0 @@ - 'Выжить любой ценой', - 1 => 'Каждый сам за себя', - 2 => 'Захват ключа' - ); - - public function start() { - global $c,$u; - $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "'.$u->info['inTurnirnew'].'" LIMIT 1')); - $this->user = mysql_fetch_array(mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "'.$u->info['inTurnirnew'].'" AND `bot` = "'.$u->info['id'].'" LIMIT 1')); - } - - public function startTurnir() { - global $c,$u; - $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `win` = "0" AND `lose` = "0" AND `nich` = "0"')); - if($row[0] > 0 && $this->info['status'] != 3) { - mysql_query('UPDATE `turnirs` SET `status` = "3" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - //Создание поединка - mysql_query('INSERT INTO `battle` (`city`,`time_start`,`timeout`,`type`,`turnir`) VALUES ("'.$u->info['city'].'","'.time().'","60","1","'.$this->info['id'].'")'); - $uri = mysql_insert_id(); - //Закидываем персонажей в поединок - mysql_query('UPDATE `users` SET `battle` = "'.$uri.'" WHERE `inUser` = "0" AND `inTurnirnew` = "'.$this->info['id'].'"'); - //Обозначаем завершение турнира при выходе - die('Перейтиде в раздел "поединки"...'); - }else{ - if($this->info['status'] == 3) { - $this->finishTurnir(); - } - } - } - - public function finishTurnir() { - global $c,$u; - $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "'.$u->info['inTurnirnew'].'" LIMIT 1')); - //mysql_query('UPDATE `users` SET `inUser` = 0, `inTurnirnew` = 0 WHERE `inTurnirnew` = '.$this->info['id'].' AND `inUser` > 0 LIMIT '.$this->info['users_in']); - if($this->info['status'] == 3) { - $win = ''; - $lose = ''; - $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "'.$this->info['id'].'" ORDER BY `points` DESC'); - while($pl = mysql_fetch_array($sp)) { - mysql_query('DELETE FROM `users_turnirs` WHERE `turnir` = "'.$this->info['id'].'"'); - $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1')); - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['bot'].'" LIMIT 1')); - if(isset($inf['id'],$bot['id'])) { - //выдаем призы и т.д - mysql_query('DELETE FROM `users` WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$bot['id'].'" LIMIT 1000'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$bot['id'].'" LIMIT 1000'); - } - - if($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) { - - $inf['add_expn'] = 3000; - - $inf['add_expp'] = array( - 0, - 1, - 5, - 10, - 15, - 25, - 35, - 70, - 100, - 150, - 200, - 300, - 500, - 700, - 1000 - ); - - //$inf['add_expn'] = floor($inf['add_expn']/100*$inf['add_expp'][$inf['level']]); - //$inf['add_expn'] = floor($inf['add_expn']/100*$inf['add_expp'][7]); - //получаем опыт (с 0 по 12 лвл) - $inf['add_expn'] = array( 10 , 30 , 55 , 62 , 92 , 180 , 350 , 1350 , 4500 , 7000 , 21000 , 30000 , 35000 ); - $inf['add_expn'] = $inf['add_expn'][$inf['level']]; - - mysql_query('UPDATE `users` SET `win` = `win` + 1,`win_t` = `win_t` + 1 WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `exp` = `exp` + '.$inf['add_expn'].' WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - $win .= ''.$inf['login'].', '; - - $r = 'Турнир завершен. Вы являетесь победителем турнира, получено опыта: '.$inf['add_expn'].'.'; - - /*if( $this->info['users_in'] >= 10 ) { - $r .= ' В турнире собралось 10 или более человек: Чек на 1 екр. добавлен к Вам в инвентарь.'; - $u->addItem(4393,$inf['id'],''); - }*/ - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','".$inf['room']."','','".$inf['login']."','".$r."','".time()."','6','0')"); - }elseif($pl['team'] != $this->info['winner'] && $this->info['winner'] != 0) { - mysql_query('UPDATE `users` SET `lose` = `lose` + 1,`lose_t` = `lose_t` + 1 WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - - $lose .= ''.$inf['login'].', '; - - }else{ - mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - } - mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "'.$inf['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `users` SET `inUser` = "0",`inTurnirnew` = "0" WHERE `inTurnirnew` = "'.$this->info['id'].'" LIMIT '.$this->info['users_in']); - mysql_query('UPDATE `turnirs` SET `chat` = 4 , `winner` = -1,`users_in` = 0,`status` = 0,`winner` = -1,`step` = 0,`time` = "'.(time()+$this->info['time2']).'",`count` = `count` + 1 WHERE `id` = '.$this->info['id'].' LIMIT 1'); - - if($win != '') { - $win = rtrim($win,', '); - $lose = rtrim($lose,', '); - $win = 'Победители турнира: '.$win.'. Проигравшая сторона: '.$lose.'. Следующий турнир начнется через '.$u->timeOut($this->info['time2']).' ('.date('d.m.Y H:i',(time()+$this->info['time2'])).').'; - }else{ - $win = 'Победители турнира отсутствует. Следующий турнир начнется через '.$u->timeOut($this->info['time2']).' ('.date('d.m.Y H:i',(time()+$this->info['time2'])).').'; - } - $r = 'Турнир завершен. '.$win; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','".$r."','".time()."','6','0')"); - } - } - - public function locationSee() { - global $c,$u; - - $r = ''; - - $tm1 = ''; - - $tm2 = ''; - - $noitm = array( - 869 => 1, - 1246 => 1, - 155 => 1, - 1245 => 1, - 678 => 1 - ); - - if($this->info['step'] != 3 && $this->info['step'] != 0) { - //получение комплекта - if(isset($_GET['gocomplect']) && $this->user['points'] < 2) { - $aso = explode(',',$this->user['items']); - $ast = explode('-',$_GET['gocomplect']); - $asg = array(); - $asj = array(); - $asgp = array(); - - $i = 0; - while($i < count($aso)) { - if($aso[$i] > 0) { - $asg[$aso[$i]] = true; - } - $i++; - } - - $i = 0; $j = 0; $noitm = 0; - $addi = 1; - while($i < count($ast)) { - if($ast[$i] > 0) { - if($asg[$ast[$i]] != true) { - $noitm++; - } - $itm = mysql_fetch_array(mysql_query('SELECT `id`,`inSlot`,`price1` FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($ast[$i]).'" LIMIT 1')); - if(isset($itm['id'])) { - $itm2 = mysql_fetch_array(mysql_query('SELECT `iid`,`price_1` FROM `items_shop` WHERE `item_id` = "'.mysql_real_escape_string($ast[$i]).'" AND `kolvo` > 0 LIMIT 1')); - if($itm2['price_1'] > $itm['price1']) { - $itm['price1'] = $itm2['price_1']; - } - if($itm['inSlot'] == 3) { - $asg[$itm['inSlot']][count($asg[$itm['inSlot']])] = $itm['id']; - $asgp[$itm['inSlot']][count($asgp[$itm['inSlot']])] = $itm['price1']; - $j++; - }elseif($itm['inSlot'] == 10) { - $asg[$itm['inSlot']][count($asg[$itm['inSlot']])] = $itm['id']; - $asgp[$itm['inSlot']][count($asgp[$itm['inSlot']])] = $itm['price1']; - $j++; - }else{ - $asg[$itm['inSlot']] = $itm['id']; - $asp[$itm['inSlot']] = $itm['price1']; - $j++; - } - } - } - $i++; - } - - if($noitm > 0) { - echo 'Использование багов карается законом!'; - $addi = 0; - }elseif(count($asg[3]) > 2) { - echo 'Вы выбрали слишком много предметов, выберите только два оружия и один щит'; - $addi = 0; - }elseif(count($asg[10]) > 3) { - echo 'Вы выбрали слишком много предметов, выберите только три кольца'; - $addi = 0; - }elseif($j > 16) { - echo 'Вы выбрали слишком много предметов'; - $addi = 0; - }elseif($j < 1) { - echo 'Выберите хотя бы один предмет'; - $addi = 0; - } - - //$addi = 0; - - if($addi == 1) { - - $i = 0; - while($i <= 17) { - if($i == 10) { - if($asg[$i][0] > 0) { - $u->addItem($asg[$i][0],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i][0]); - } - if($asg[$i][1] > 0) { - $u->addItem($asg[$i][1],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i][1]); - } - if($asg[$i][2] > 0) { - $u->addItem($asg[$i][2],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i][2]); - } - }elseif($i == 3) { - if($asg[$i][0] > 0) { - $u->addItem($asg[$i][0],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i][0]); - } - if($asg[$i][1] > 0) { - $u->addItem($asg[$i][1],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i][1]); - } - }elseif($asg[$i] > 0) { - $u->addItem($asg[$i],$u->info['id']); - $this->user['points'] += 1+round($asgp[$i]); - } - $i++; - } - - mysql_query('UPDATE `users_turnirs` SET `points` = "'.$this->user['points'].'",`items` = "0" WHERE `bot` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `ability` = "100",`skills` = "10" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `level` = "12" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `turnirs` SET `step` = "0" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - - $this->info['step'] = 0; - $this->info['items'] = '0'; - } - } - } - - if($this->info['step'] == 3) { - $this->finishTurnir(); - }elseif($this->info['step'] == 0) { - //распределяем команды - $po = array(0,0); - $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "'.$this->info['id'].'" AND `points` > 3 ORDER BY `points` DESC LIMIT '.$this->info['users_in']); - $tmr = rand(1,2); - if($tmr == 1) { - $tmr = array(2,1); - }else{ - $tmr = array(1,2); - } - while($pl = mysql_fetch_array($sp)) { - $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1')); - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['bot'].'" LIMIT 1')); - if(isset($inf['id'],$bot['id'])) { - if($po[1] == $po[2]) { - $tm = rand(1,2); - }elseif($po[1] > $po[2]) { - $tm = 2; - }else{ - $tm = 1; - } - //$tm = $tmr[$tm]; - $bot['team'] = $tm; - $po[$bot['team']] += $pl['points']; - mysql_query('UPDATE `stats` SET `team` = "'.$bot['team'].'" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users_turnirs` SET `team` = "'.$bot['team'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - } - mysql_query('UPDATE `turnirs` SET `step` = "1" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - } - - $sp = mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "'.$this->info['id'].'" LIMIT '.$this->info['users_in']); - $po = array(0,0); - while($pl = mysql_fetch_array($sp)) { - $inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1')); - $bot = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `u`.`id` = "'.$pl['bot'].'" LIMIT 1')); - if(isset($inf['id'],$bot['id'])) { - $po[$bot['team']] += $pl['points']; - //${'tm'.$bot['team']} .= ''.$bot['login'].' ['.$bot['level'].']
    '; - ${'tm'.$bot['team']} .= $u->microLogin($bot,2).'
    '; - } - } - $r .= ''; - $r .= '

    «'.$this->name[$this->info['type']].'»


    Начало турнира через '.$u->timeOut($this->info['time'] - time()).'! '; - - if(isset($_GET['hpregenNowTurnir'])) { - if($u->stats['hpNow'] < $u->stats['hpAll'] || $u->stats['mpNow'] < $u->stats['mpAll']) { - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpAll'].'",`mpNow` = "'.$u->stats['mpAll'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - - if($this->user['points'] < 3) { - //Еще не получили обмундирование - if($this->user['points'] < 2) { - $r .= ''; - }else{ - $r .= ' '; - } - }else{ - $r .= 'Вы участвуете в турнире!'; - $r .= '   '; - } - - $r .= '
    '; - if($this->user['points'] < 3) { - if($this->user['items'] != '0') { - $r .= '
    '; - if($this->user['items'] == '') { - //Выдаем предметы для выбора - $ai = ''; - - $sp = mysql_query('SELECT `a`.*,`b`.* FROM `items_shop` AS `a` LEFT JOIN `items_main` AS `b` ON (`a`.`item_id` = `b`.`id`) WHERE `a`.`sid` = 1 AND - (`a`.`r` != 5 AND `a`.`r` != 9 AND `a`.`r` <= 18 AND `a`.`kolvo` > 0 AND `cantBuy` = 0 AND `a`.`level` < 9 AND `b`.`level` < 9) AND - `b`.`class` != 6'); - while($pl = mysql_fetch_array($sp)) { - if(!isset($noitm[$pl['item_id']])) { - $aso[$pl['inslot']][count($aso[$pl['inslot']])] = $pl; - } - } - - $j = 1; - $com = array(); - while($j <= 5) { - $i = 0; - while($i <= 17) { - if($i == 3) { - // - $com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; - }elseif($i == 14) { - //правая рука - $com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; - }else{ - //обмундирование - $com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; - if($i == 10) { - $ai .= $com[$i]['id'].','; - $com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; - $ai .= $com[$i]['id'].','; - //$com[$i] = $aso[$i][rand(0,count($aso[$i])-1)]; - //$ai .= $com[$i]['id'].','; - } - } - if($com[$i]['id'] > 0 && $i != 10) { - $ai .= $com[$i]['id'].','; - } - $i++; - } - $j++; - } - unset($com); - - $ai .= '0'; - $this->user['items'] = $ai; - mysql_query('UPDATE `users_turnirs` SET `items` = "'.$ai.'" WHERE `id` = "'.$this->user['id'].'" LIMIT 1'); - } - - //Выводим предметы чтобы надеть их - $ai = explode(',',$this->user['items']); - $i = 0; $ia = array(); - while($i < count($ai)) { - if($ai[$i] > 0) { - $pli = mysql_fetch_array(mysql_query('SELECT `id`,`inSlot`,`name`,`type`,`img`,`level` FROM `items_main` WHERE `id` = "'.$ai[$i].'" LIMIT 1')); - $ia[$pli['inSlot']][count($ia[$pli['inSlot']])] = $pli; - unset($pli); - } - $i++; - } - unset($ai); - - $r .= 'Выберите предметы для турнира:
    '; - ?> - - - 0) { - $j = 0; - while($j < count($ia[$i])) { - $r .= ''; - $j++; - } - $r .= '
    '; - } - $i++; - } - - } - - } - $r .= '
    '; - //$r .= 'Команда №1: '.rtrim($tm1,', '); - //$r .= '
    Команда №2: '.rtrim($tm2,', '); - - $r .= ' - - - - - - - - -
    Команда 1Команда 2
    '.rtrim($tm1,', ').''.rtrim($tm2,', ').'
    '; - - - if( ($this->info['time'] - time() < 0) && $this->info['step'] == 1) { - //начинаем турнир - $this->startTurnir(); - } - - echo $r; - } - -} -$tur = new turnir; -$tur->start(); -?> \ No newline at end of file diff --git a/_incl_data/class/_cron_.php b/_incl_data/class/_cron_.php deleted file mode 100644 index cea8de55..00000000 --- a/_incl_data/class/_cron_.php +++ /dev/null @@ -1,2547 +0,0 @@ -users[]['eff'] после использования, в противном случаи некотрые приемы используются через 1 ход -*/ - -class priems -{ - - public function mg2static_points($uid,$st) { - global $u; - if(isset($st['mg2static_points'])) { - $mg = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid.'" AND `data` LIKE "%add_mg2static_points%" AND `delete` = "0" ORDER BY `id` DESC LIMIT 1')); - if(isset($mg['id'])) { - $mg['data'] = $u->lookStats($mg['data']); - $mg['data']['add_mg2static_points']++; - $mg['data']['add_zm2proc']--; - $mg['x'] = $mg['data']['add_mg2static_points']; - $mg['data'] = $u->impStats($mg['data']); - mysql_query('UPDATE `eff_users` SET `data` = "'.$mg['data'].'",`x` = "'.$mg['x'].'" WHERE `id` = "'.$mg['id'].'" LIMIT 1'); - } - } - } - - //отнимаем ману - public function minMana($uid,$mp,$tp=NULL) - { - global $u,$btl; - $r = true; - /* уменьшаем расход маны, если $mp > 0 */ - //с вычетом уменьшения разсхода маныss - $mp -= round($mp/100*$btl->stats[$btl->uids[$uid]]['min_use_mp']); - $btl->stats[$btl->uids[$uid]]['mpNow'] -= $mp; - if($btl->stats[$btl->uids[$uid]]['mpNow']<0) - { - $btl->stats[$btl->uids[$uid]]['mpNow'] = 0; - $r = false; - }elseif($btl->stats[$btl->uids[$uid]]['mpNow']>$btl->stats[$btl->uids[$uid]]['mpAll']) - { - $btl->stats[$btl->uids[$uid]]['mpNow'] = $btl->stats[$btl->uids[$uid]]['mpAll']; - } - - mysql_query('UPDATE `stats` SET `mpNow` = "'.($btl->stats[$btl->uids[$uid]]['mpNow']).'" WHERE `id` = "'.((int)$uid).'" LIMIT 1'); - return $r; - } - - //используем прием каждый ход - public function hodUsePriem($eff,$pr) - { - global $u,$btl,$c,$code; - $return_main = true; - $ue = mysql_fetch_assoc(mysql_query('SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE `u`.`id`="'.$eff['uid'].'" AND `u`.`battle`="'.$btl->info['id'].'" AND `st`.`hpNow` > 0 LIMIT 1')); - if($pr['file']!='0') - { - if(file_exists('../../_incl_data/class/priems/'.$pr['file'].'.php')) - { - $hod = $eff['hod']; - require('priems/'.$pr['file'].'.php'); - } - if(!isset($cup)) - { - //отнимаем тактики от приема - //$this->mintr($pl); - } - }elseif($pr['file3']!='0') - { - if(file_exists('../../_incl_data/class/priems/'.$pr['file3'].'.php')) - { - $hod = $eff['hod']; - require('priems/'.$pr['file3'].'.php'); - } - if(!isset($cup)) - { - //отнимаем тактики от приема - //$this->mintr($pl); - } - }else{ - //какие-то другие эффекты - - } - return $return_main; - } - - public function redate($pl,$uid) - { - global $u,$btl; - $i = 0; - if($pl!='') - { - $e = explode('|',$pl); - while($i'lvl1',1=>'ts5',2=>'mpAll'),array(0=>$btl->users[$btl->uids[$uid]]['level'],1=>$btl->stats[$btl->uids[$uid]]['s5'],2=>$btl->stats[$btl->uids[$uid]]['mpAll'])); - if($f[0]!='' && $f[1]!='') - { - $e[$i] = implode('=',$f); - } - $i++; - } - $pl = implode('|',$e); - } - return $pl; - } - - /* uid - на кого кастуем - pr - id приема - data - дата, если -1, то добавляем дату3 - d2 - добавляем дату3 - tm - время использования, 77 - вечно - h - кол-во "вечных" ходов - uu - id юзера который использовал - tp - тип приема - */ - public function addPriem($uid,$pr,$data,$d2,$tm,$h,$uu,$max,$bj,$tp = 0,$ch = 0,$rdt = 0,$tr_life_user = 0,$noupdatebtl = 0,$noplus = 0,$pname = NULL) - { - global $u,$btl; - $pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.((int)$pr).'" LIMIT 1')); - if($uid=='3'){ - //print_r($pl); - } - $r = false; - if(isset($pl['id'])) - { - if($data==-1) - { - $data = $this->redate($pl['date3'],$u->info['id']); - }elseif($d2==1) - { - $data .= '|'.$this->redate($pl['date3'],$u->info['id']); - } - - if($pl['cancel_eff2']!='') - { - $i = 0; - $e = explode(',',$pl['cancel_eff2']); - while($i0) - { - $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid.'" AND `v1` = "priem" AND `v2` = "'.$e[$i].'" AND `delete` = "0" LIMIT 1')); - if(isset($nem['id'])) - { - $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$e[$i].'" LIMIT 1')); - if(isset($nem['id'])) - { - $btl->delPriem($nem,$btl->users[$btl->uids[$uid]],2); - } - } - } - $i++; - } - } - if($max>0) - { - if( $noplus == 0 ) { - if($pl['zmu'] == 1) { - $num = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `bj` = "'.$bj.'" AND `user_use` = "'.$u->info['id'].'" AND `uid` = "'.$uid.'" AND `delete` = "0" LIMIT 1')); - }else{ - $num = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `bj` = "'.$bj.'" AND `uid` = "'.$uid.'" AND `delete` = "0" LIMIT 1')); - } - } - - if(isset($num['id']) && ($num['user_use']!=$u->info['id'] && $pl['zmu'] != 2)) - { - // удаляем эффект - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$num['id'].'" LIMIT 1'); - if(isset($num['id'])) - { - $i = 0; - while($istats[$btl->uids[$uid]]['effects'])) - { - if($btl->stats[$btl->uids[$uid]]['effects'][$i]['id']==$num['id']) - { - //обновляем - $btl->stats[$btl->uids[$uid]]['effects'][$i]['delete'] = time(); - } - $i++; - } - } - unset($num); - } - - if(!isset($num['id'])) - { - if (isset($pname)) - { - $ins = mysql_query('INSERT INTO `eff_users` (`tr_life_user`,`bj`,`user_use`,`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`) VALUES ("'.floor($tr_life_user).'","'.$bj.'","'.$uu.'","'.$h.'",'.$pl['id'].',"'.$pl['img'].'.gif",22,"'.$uid.'","'.$pname.'","'.$data.'","0","'.$tm.'","priem")'); - } - else - { - $ins = mysql_query('INSERT INTO `eff_users` (`tr_life_user`,`bj`,`user_use`,`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`) VALUES ("'.floor($tr_life_user).'","'.$bj.'","'.$uu.'","'.$h.'",'.$pl['id'].',"'.$pl['img'].'.gif",22,"'.$uid.'","'.$pl['name'].'","'.$data.'","0","'.$tm.'","priem")'); - } - - if($ins) - { - $r = true; - $lid = mysql_insert_id(); - } - /* добавляем данные к $btl->eff */ - if( $noupdatebtl == 0 ) { - $btl->stats[$btl->uids[$uid]] = $u->getStats($uid,0); - } - - }elseif($num['x']<$max) - { - //Добавляем еще и обновляем заряды - $num['x']++; $num['hod'] = $h; - if( $data != -1 && $data != '' && $d2 == 2 ) { - $num['data'] .= '|'.$data.''; - $upd = mysql_query('UPDATE `eff_users` SET `x` = `x` + 1,`hod` = "'.$h.'",`data` = "'.$num['data'].'" WHERE `id` = "'.$num['id'].'" LIMIT 1'); - }else{ - $upd = mysql_query('UPDATE `eff_users` SET `x` = `x` + 1,`hod` = "'.$h.'" WHERE `id` = "'.$num['id'].'" LIMIT 1'); - } - if($upd) - { - $r = true; - } - }else{ - //обновляем заряды - $num['hod'] = $h; - if( $data != -1 && $data != '' && $d2 == 2 ) { - $num['data'] .= '|'.$data.''; - $upd = mysql_query('UPDATE `eff_users` SET `hod` = "'.$h.'",`data` = "'.$num['data'].'" WHERE `id` = "'.$num['id'].'" LIMIT 1'); - }else{ - $upd = mysql_query('UPDATE `eff_users` SET `hod` = "'.$h.'" WHERE `id` = "'.$num['id'].'" LIMIT 1'); - } if($upd) - { - $r = true; - } - } - - if($r==true) - { - //cancel_eff был здесь - if($pl['cancel_eff']!='') - { - $i = 0; - $e = explode(',',$pl['cancel_eff']); - while($i0) - { - $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid.'" AND `v1` = "priem" AND `v2` = "'.$e[$i].'" AND `delete` = "0" LIMIT 1')); - if(isset($nem['id'])) - { - $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$e[$i].'" LIMIT 1')); - if(isset($nem['id'])) - { - $btl->delPriem($nem,$btl->users[$btl->uids[$uid]],2); - } - } - } - $i++; - } - } - } - - /*if($ch==1) - { - $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$uid]]['sex'].'||t2='.$btl->users[$btl->uids[$uid]]['team'].'||login2='.$btl->users[$btl->uids[$uid]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - if($tp > 0) { - $tco = array(1=>'006699',2=>'006699',3=>'006699',4=>'006699'); //не крит - $tcl = array(1=>'A00000',2=>'008080',3=>'0000FF',4=>'A52A2A'); //не крит - $tco = $tco[$tp]; - $tcl = $tcl[$tp]; - $nmz = array( - 0=>array(0=>'хаоса',1=>'хаос'), - 1=>array(0=>'огня',1=>'огненный'), - 2=>array(0=>'воздуха',1=>'электрический'), - 3=>array(0=>'воды',1=>'холод'), - 4=>array(0=>'земли',1=>'земляной'), - 5=>array(0=>'Света',1=>'свет'), - 6=>array(0=>'Тьмы',1=>'тьма'), - 7=>array(0=>'нейтралитета',1=>'серая магия') - ); - $nmz = $nmz[$tp]; - $mas1['text'] = '{tm1} {u1} {1x16x0} заклинание магии '.$nmz[0].' "'.$pl['name'].'"'; - }else{ - //$mas1['text'] = '{tm1} {u1} {1x16x0} прием "'.$pl['name'].'"'; - //$btl->priemAddLogFast($u->info['id'],0,$pl['name'],'{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL).'',0,time()); - } - if($u->info['id']!=$uid) - { - $mas1['text'] .= ' на персонажа {u2}.'; - }else{ - $mas1['text'] .= '.'; - } - $btl->add_log($mas1); - }*/ - - if(isset($num['id'])) - { - $i = 0; - while($istats[$btl->uids[$uid]]['effects'])) - { - if($btl->stats[$btl->uids[$uid]]['effects'][$i]['id']==$num['id']) - { - //обновляемss - $btl->stats[$btl->uids[$uid]]['effects'][$i]['data'] = $num['data']; - $btl->stats[$btl->uids[$uid]]['effects'][$i]['hod'] = $num['hod']; - $btl->stats[$btl->uids[$uid]]['effects'][$i]['x'] = $num['x']; - } - $i++; - } - } - } - } - return $r; - } - - public function lookStatsArray($m) - { - $ist = array(); - $di = explode('|',$m); - $i = 0; $de = false; - while($iinfo['id']; - } - $k = $btl->magKrit($ue['level'],$btl->stats[$btl->uids[$usu]]['mg'.$tmp]); - - if($krituet==false){$k=0;} - - $hpmin = $this->testPower($btl->stats[$btl->uids[$usu]],$btl->stats[$btl->uids[$uen]],$hpmin,$tmp,2); - $hpmin = round($hpmin); - - $dopyrn = $this->testPower($btl->stats[$btl->uids[$usu]],$btl->stats[$btl->uids[$uen]],$dopyrn,$tmp,2); - $dopyrn = round($dopyrn); - - if($btl->users[$btl->uids[$uen]]['tactic7']<=0 && $dp==0) - { - $hpmin = 0; $k = -1; - $dopyrn = 0; - } - if($k==1 && $hpmin!=0 && $krituet==true) - { - //крит - $hpmin = $hpmin*2; - }elseif($k==-1 && $hpmin!=0) - { - //промах - $hpmin = $hpmin/2; - $dopyrn = $dopyrn/2; - } - if($hpmin<1){ $hpmin = 0; }else{ - $hpmin = rand(($hpmin*0.97),$hpmin); - } - - $hpmin += floor($dopyrn); - - if(isset($btl->stats[$btl->uids[$uen]]['min_heal_proc'])) { - if($btl->stats[$btl->uids[$uen]]['min_heal_proc'] > 100) { - $btl->stats[$btl->uids[$uen]]['min_heal_proc'] = 100; - } - $hpmin = round($hpmin/100*(100+$btl->stats[$btl->uids[$uen]]['min_heal_proc'])); - } - - if($btl->users[$btl->uids[$uen]]['tactic7']>0 && $dp==0) - { - //Отнимаем тактики, если это возможно - $btl->users[$btl->uids[$uen]]['tactic7'] -= $hpmin/$btl->stats[$btl->uids[$uen]]['hpAll']; - $btl->users[$btl->uids[$uen]]['tactic7'] = round($btl->users[$btl->uids[$uen]]['tactic7'],2); - $btl->stats[$btl->uids[$uen]]['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - if($uen==$u->info['id']) - { - $u->info['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - $u->stats['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - } - if($btl->users[$btl->uids[$uen]]['tactic7']<0) - { - $btl->users[$btl->uids[$uen]]['tactic7'] = 0; - } - } - $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] + $hpmin); - - if($hp2 > $btl->stats[$btl->uids[$uen]]['hpAll']) - { - $hpmin = floor($hp2-$btl->stats[$btl->uids[$uen]]['hpAll']); - $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; - }elseif($hp2<0) - { - $hp2 = 0; - } - $rr[0] = $hpmin; //урон - $rr[1] = $k; //тип - /* проверяем приемы защиты */ - //получаем массив с приемами противника - $miny = 0; //на сколько едениц урон буде меньше (защита приема) - $minu = 0; - $sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); - while($pl2 = mysql_fetch_assoc($sp1)) - { - $pl2['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$pl2['v2'].'" LIMIT 1')); - if(isset($pl2['priem']['id'])) - { - $dt1 = $u->lookStats($pl2['priem']['date2']); - if(isset($dt1['yron_u2'])) - { - $minu = getdr($dt1['yron_u2'],array(0=>'lvl1',1=>'yr1',2=>'ts5',3=>'ts6'),array(0=>$btl->users[$btl->uids[$level]],1=>$hpmin,2=>0,3=>0)); - $miny -= $minu; - $hpmin += $minu; - $btl->delPriem($pl2,$btl->users[$btl->uids[$uen]]); - } - } - - } - - /* проверяем приемы ослабления */ - - //отнимаем НР - $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; - $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; - $upd = mysql_query('UPDATE `stats` SET `hpNow` = '.$hp2.',`tactic7` = '.$btl->users[$btl->uids[$uen]]['tactic7'].' WHERE `id` = "'.$uen.'" LIMIT 1'); - - //заносим в лог боя - $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$uen]]['sex'].'||t2='.$btl->users[$btl->uids[$uen]]['team'].'||login2='.$btl->users[$btl->uids[$uen]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - if($rp==1) - { - $mas1['id_hod']--; - } - //$btl->takeExp($u->info['id'],$hpmin,$u->info['id'],$uen); - - $btl->takeExp($u->info['id'],($hpmin*0.33),$u->info['id'],$uen,true); - - if($hpmin>0) - { - $hpmin = '+'.ceil($hpmin); - }else{ - $hpmin = '--'; - } - $tco = array(1=>'006699',2=>'006699',3=>'006699',4=>'006699'); //не крит - $tcl = array(1=>'A00000',2=>'008080',3=>'0000FF',4=>'A52A2A'); //не крит - $tco = $tco[$tmp]; - $tcl = $tcl[$tmp]; - if($k==1) - { - //крит - $tco = 'FF0000'; - $tcl = 'FF0000'; - }elseif($k==-1) - { - //промах - $tco = '979797'; - $tcl = '979797'; - } - $nmz = array( - 1=>array(0=>'огня',1=>'огненная'), - 2=>array(0=>'воздуха',1=>'электрическая'), - 3=>array(0=>'воды',1=>'водная'), - 4=>array(0=>'земли',1=>'земляная') - ); - $nmz = $nmz[$tmp]; - - if($rp==1) - { - if($k==0) - { - //$tcl = '000000'; - //$tco = '008000'; - } - $sx = array(0=>'',1=>'а'); - $mas1['text'] = '{tm1} Заклинание "'.$pl['name'].'" восстановило здоровье персонажа {u2}. '.$hpmin.' ['.ceil($hp2).'/'.$btl->stats[$btl->uids[$uen]]['hpAll'].']'; - }else{ - $mas1['text'] = '{tm1} {u1} {1x16x0} заклинание "'.$pl['name'].'" и восстановил здоровье персонажа {u2} магией '.$nmz[0].'. '.$hpmin.' ['.ceil($hp2).'/'.$btl->stats[$btl->uids[$uen]]['hpAll'].']'; - } - $btl->add_log($mas1); - $pz[(int)$id] = 1; - return $rr; - } - - public $cof_mag = array( - 0 => 250, - 1 => 250, - 2 => 250, - 3 => 250, - 4 => 250, - 5 => 250, - 6 => 250, - 7 => 250, - 8 => 250, - 9 => 300, - 10 => 360, - 11 => 475, - 12 => 520, - 13 => 625, - 14 => 750, - 15 => 895, - 16 => 1075, - 17 => 1290, - 18 => 1550, - 19 => 1860, - 20 => 2230, - 21 => 2675 - ); - public function magatack( $u1, $u2, $yron, $type, $krit ) { - global $btl; - $r = $yron; - // - $prm = array( - 'y' => $btl->stats[$btl->uids[$u1]]['mg'.$btl->mname[$type]], //умелки - 'yv' => 0, //умения, значение коф. - 'max_krit' => 0 //вероятность крита - ); - // - // (уровень цени)*2 - 7 - минимальное умелок, чтобы не было промахов - /* - Для магии Света/Тьмы по формуле: Уровень Цели * 2 – 9 - каждая умелка выше этой нормы увеличивает маг крит на 3%. но не больше 30% - */ - //Рассчет урона от приема - /* - b - базовый урон - m - мощь - z - защита цели [ед.] - p - подавление [ед.] - k - коэффициент ; k=250 для 8ки, k=300 для 9ки и т.д. +20% на уровень - */ - $prm['b'] = round($r,2); //базовый урон - $prm['m'] = $btl->stats[$btl->uids[$u1]]['pm'.$btl->mname[$type]]; //мощь - $prm['z'] = $btl->stats[$btl->uids[$u2]]['zm'.$btl->mname[$type]]; //защита цели (ед.) - - if( $prm['z'] < 0 ) { - $prm['z'] = 0; - } - // $prm['p'] = round(($btl->stats[$btl->uids[$u1]]['pzm'.$btl->mname[$type]]+$btl->stats[$btl->uids[$u1]]['pzm'])*0.8); //подавление (ед.) - //New подава - if (isset($btl->stats[$btl->uids[$u1]]['pzm'])) - { - //$ri=round(sqrt(2*$i*28)); - $prm['p'] = round($btl->stats[$btl->uids[$u1]]['pzm'.$btl->mname[$type]]+round(sqrt(2*$btl->stats[$btl->uids[$u1]]['pzm']*24))); - // $prm['p'] = round(($btl->stats[$btl->uids[$u1]]['pzm'.$btl->mname[$type]]+$btl->stats[$btl->uids[$u1]]['pzm'])*2); - - } - - - - - //$prm['k'] = $this->cof_mag[$btl->users[$btl->uids[$u2]]['level']]; //коэффицент - $prm['k']=1; - if( $prm['k'] == 0 ) { - $prm['k'] = 1; - } - - // - /*if( $prm['p']*10 > $prm['k'] ) { - $prm['p'] = round($prm['k']/10); - }*/ - if( $prm['p']*10 > $prm['z']+$prm['k'] ) { - $prm['p'] = round(($prm['z']+$prm['k'])/10); - } - - //echo '[Мощность '.$prm['m'].'%, Подавление '.$prm['p'].' ед., Защита цели '.$prm['z'].' ед., Коэффицент '.$prm['k'].']'; - - //$prm['p'] = round($prm['p']*2); - - //$r = $prm['b']*(1+$prm['m']/100)*pow(2,(($prm['p']*10-$prm['z'])/$prm['k'])); (верная старая) - //$r = $prm['b']*(1+$prm['m']/100)*pow(2,((0-($prm['z']-$prm['p']*10))/$prm['k'])); (хз какая, старая) - // - $prm['znew'] = ( ( $prm['z'] / 100) * ( 100 - $prm['p'] ) ) - 5 * $prm['p']; - // - //Занижаем мощность на 10% - убрал временно занижение. - $r = $prm['b']*((1+$prm['m']/100)); - //echo '['.$prm['b'].'*(1+'.$prm['m'].'/100)*pow(2,(('.$prm['p'].'*10-'.$prm['z'].')/'.$prm['k'].'));]'; - - //$r += floor($btl->stats[$btl->uids[$u1]]['s5']*0.25); - //ТУТ $btl->stats[$btl->uids[$u2]]['zmproc'] - - if( $r < floor($prm['b']*0.2) ) { - $r = floor($prm['b']*0.2); - } - // - //$prm['y'] -= 5; - if( $type < $btl->mname[$type] ) { - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 7); - }else{ - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 9); - } - // - if( $prm['y'] >= $prm['yv'] || $btl->stats[$btl->uids[$u1]]['acestar'] > 0 ) { - if( $krit == 1 ) { - $prm['max_krit'] = 3 * ( $prm['y'] - $prm['yv'] ); - if( $prm['max_krit'] < 0 ) { - $prm['max_krit'] = 0; - //Утсноавил макс крит 25 процентов - }elseif( $prm['max_krit'] > 25 ) { - $prm['max_krit'] = 25; - } - //$prm['max_krit'] = round($prm['max_krit']/2); - //Крит возможен - - if( $btl->stats[$btl->uids[$u1]]['acestar'] ) { - //Крит 100% - $prm['max_krit'] = 100; - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u1.'" AND `data` LIKE "%add_acestar=%" AND `delete` = 0 LIMIT 1'); - } - - if( $btl->get_chanse($prm['max_krit']) == true ) { - $krit = true; - }else{ - $krit = false; - } - }else{ - $krit = false; - } - $promah = false; - }else{ - $krit = false; - //Вероятность промоха - $prm['promah'] = 3 * ( $prm['yv'] - $prm['y'] ); - if( $prm['promah'] < 0 ) { - $prm['promah'] = 0; - }elseif( $prm['promah'] > 30 ) { - $prm['promah'] = 30; - } - if( $btl->get_chanse($prm['promah']) == true ) { - $promah = true; - }else{ - $promah = false; - } - } - - if( $krit == true ) { - $r = $r*2; - $promah_type = 0; - $r = floor($r/100*(100-$btl->zmgo($prm['znew']))); - }elseif( $promah == true ) { - $r = 0; - $promah_type = 2; - }else - {$r = floor($r/100*(100-$btl->zmgo($prm['znew'])));} - - - if ($promah == false) // Промах новый - { - $prm['promah']=$btl->stats[$btl->uids[$u2]]['m19']; - if( $btl->get_chanse($prm['promah']) == true) { - $promah = true; - $r = 0; - $promah_type = 2; - } - } - - - - /*if (isset($btl->stats[$btl->uids[$u2]]['zmproc'])) - { - if ($btl->stats[$btl->uids[$u2]]['zmproc']>=75) - { - $r-=$r*75/100; - } - else - { - $r-=$r*$btl->stats[$btl->uids[$u2]]['zmproc']/100; - } - if ($r<=0){$r=1;} - }*/ - - if( $type == 'земля' ) { - $r = floor($r * 1.00); - } - if( $type == 'воздух' ) { - $r = floor($r * 1.00); - } - if( $type == 'вода' ) { - $r = floor($r * 1.00); - } - if( $type == 'огонь' ) { - $r = floor($r * 0.75); - } - - if( $krit == true && $r > floor($prm['b']*20) ) { - $r = floor($prm['b']*20); - }elseif($krit == false && $r > floor($prm['b']*10)) { - $r = floor($prm['b']*10); - } - - if($r < 1 ) { - $r = 0; - } - // - unset($prm); - // - return array( floor($r) , $krit , $promah , $promah_type ); - } - - public function magatackfiz( $u1, $u2, $yron, $type, $krit , $ymelki ) { - global $btl; - $r = $yron; - // - if( !isset($ymelki) || $ymelki == '0' ) { - $ymelki = $type; - } - // - $prm = array( - 'ym' => $btl->stats[$btl->uids[$u1]]['mg'.$btl->mname[$ymelki]], //умелки (магические умелки) - 'y' => $btl->stats[$btl->uids[$u1]]['a'.$btl->mname[$ymelki]], //умелки - 'yv' => 0, //умения, значение коф. - 'max_krit' => 0 //вероятность крита - ); - // - // (уровень цени)*2 - 7 - минимальное умелок, чтобы не было промахов - /* - Для магии Света/Тьмы по формуле: Уровень Цели * 2 – 9 - каждая умелка выше этой нормы увеличивает маг крит на 3%. но не больше 30% - */ - //Рассчет урона от приема - /* - b - базовый урон - m - мощь - z - защита цели [ед.] - p - подавление [ед.] - k - коэффициент ; k=250 для 8ки, k=300 для 9ки и т.д. +20% на уровень - */ - $prm['b'] = $r; //базовый урон - $prm['m'] = $btl->stats[$btl->uids[$u1]]['pa'.$btl->mname[$type]]; //мощь - $prm['z'] = $btl->stats[$btl->uids[$u2]]['za'.$btl->mname[$type]]; //защита цели (ед.) - $prm['p'] = $btl->stats[$btl->uids[$u1]]['pza'.$btl->mname[$type]]; //подавление (ед.) - $prm['k'] = $this->cof_mag[$btl->users[$btl->uids[$u1]]['level']]; //коэффицент - // - if( $prm['p']*10 > $prm['k'] ) { - $prm['p'] = floor($prm['k']/10); - } - // - $r = $prm['b']*(1+$prm['m']/100)*pow(2,(($prm['p']*10-$prm['z'])/$prm['k'])); - if( $r < floor($prm['b']*0.2) ) { - $r = floor($prm['b']*0.2); - }elseif( $r > floor($prm['b']*10) ) { - $r = floor($prm['b']*10); - } - // - //$prm['y'] -= 5; - if( $type < $btl->mname[$type] ) { - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 7); - }else{ - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 9); - } - // - if( $prm['y'] >= $prm['yv'] || (isset($btl->mname[$ymelki]) && $prm['ym'] >= $prm['yv']) ) { - if( $krit == 1 ) { - if( isset($btl->mname[$ymelki]) ) { - $prm['max_krit'] = 3 * ( $prm['ym'] - $prm['yv'] ); - }else{ - $prm['max_krit'] = 3 * ( $prm['y'] - $prm['yv'] ); - } - //echo '[Magical crit: '.$prm['max_krit'].'%]'; - if( $prm['max_krit'] < 0 ) { - $prm['max_krit'] = 0; - }elseif( $prm['max_krit'] > 30 ) { - $prm['max_krit'] = 30; - } - //$prm['max_krit'] = round($prm['max_krit']/2); - //Крит возможен - if( rand( 0 , 100 ) <= $prm['max_krit'] ) { - $krit = true; - }else{ - $krit = false; - } - }else{ - $krit = false; - } - $promah = false; - }else{ - $krit = false; - //Вероятность промоха - $prm['promah'] = 3 * ( $prm['yv'] - $prm['ym'] ); - if( $prm['promah'] < 0 ) { - $prm['promah'] = 0; - }elseif( $prm['promah'] > 30 ) { - $prm['promah'] = 30; - } - if( rand( 0 , 100 ) <= $prm['promah'] ) { - $promah = true; - }else{ - $promah = false; - } - } - // - if( $krit == true ) { - $r = $r*2; - $promah_type = 0; - }elseif( $promah == true ) { - $r = rand(1,floor($r/4)); - $promah_type = 1; - if( rand(0,100) < 50 ) { - $r = 0; - $promah_type = 2; - } - } - // - unset($prm); - // - return array( floor($r) , $krit , $promah , $promah_type ); - } - - public function magicAtack($ue,$hpmin,$tmp,$pl,$eff,$rp = 0,$mxx = 0,$fiz = 0,$nomf = 0,$krituet=true,$heal =0,$namenew=NULL) - { - $trawm_off=false; - global $u,$c,$code,$btl; - if( $namenew != NULL ) { - $pl['name'] = $namenew; - } - $rr = array(); - $nhpmin = $hpmin; - $uen = $ue['id']; - $usu = $eff['user_use']; - if($eff['user_use']<1) - { - $usu = $u->info['id']; - } - if($nomf==0) - { - $k = $btl->magKrit($ue['level'],$btl->stats[$btl->uids[$usu]]['mg'.$tmp]); - if($krituet==false){$k=0;} - if($fiz==0) - { - - //магический урон - if($nomf == 0) { - $hpmin = $this->testPower($btl->stats[$btl->uids[$usu]],$btl->stats[$btl->uids[$uen]],$hpmin,$tmp,2); - } - }else{ - //физический урон - $wAp += $btl->stats[$btl->uids[$usu]]['pa'.$tmp.'']; - $wAp += $btl->stats[$btl->uids[$usu]]['m10']; - $wAp -= $btl->stats[$btl->uids[$uen]]['antpa'.$tmp.'']*1.75; - $wAp -= $btl->stats[$btl->uids[$uen]]['antm10']*1.75; - $hpmin += ceil((0.01+$hpmin/100)*(0.01+0.98*$wAp))-1; - - $hpmin -= round( $hpmin/100*(35*($btl->stats[$btl->uids[$uen]]['za']+$btl->stats[$btl->uids[$uen]]['za'.$tmp])/1200) ); - $hpmin = round($hpmin); - - if(isset($btl->stats[$btl->uids[$uen]]['zaproc']) || isset($btl->stats[$btl->uids[$uen]]['za'.$fiz.'proc'])) //защита от урона (призрачки) - { - $hpmin = floor($hpmin/100*(100-$btl->stats[$btl->uids[$uen]]['zaproc']-$btl->stats[$btl->uids[$uen]]['za'.$fiz.'proc'])); - if($hpmin<0) - { - $hpmin = 0; - } - } - } - } - $hpmin = round($hpmin); - if($k==1 and $krituet==true) - { - //крит - $hpmin = $hpmin*2; - }elseif($k==-1) - { - //промах - $hpmin = $hpmin/2; - } - if($hpmin<$nhpmin*0.2) { - $hpmin = $nhpmin*0.2; - } - if($hpmin<1){ $hpmin = 0; }else{ - if($nomf == 0) { - $hpmin = rand(($hpmin*0.97),$hpmin); - } - } - if($mxx>0 && $hpmin > $mxx) - { - if($k==0) - { - $hpmin = $mxx; - }elseif($k==1 && $hpmin/2 > $mxx) - { - $hpmin = $mxx*2; - } - } - $rr[0] = $hpmin; //урон - $rr[1] = $k; //тип - /* проверяем приемы защиты */ - //получаем массив с приемами противника - $miny = 0; //на сколько едениц урон буде меньше (защита приема) - $minu = 0; - $sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); - while($pl2 = mysql_fetch_assoc($sp1)) - { - $pl2['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$pl2['v2'].'" LIMIT 1')); - if(isset($pl2['priem']['id'])) - { - $dt1 = $u->lookStats($pl2['priem']['date2']); - if(isset($dt1['yron_u2'])) - { - $minu = getdr($dt1['yron_u2'],array(0=>'lvl1',1=>'yr1',2=>'ts5',3=>'ts6'),array(0=>$btl->users[$btl->uids[$level]],1=>$hpmin,2=>1,3=>0)); - $miny -= $minu; - $hpmin += $minu; - if(isset($dt1['rzEndMg']) && $dt1['rzEndMg']==1) - { - $btl->delPriem($pl2,$btl->users[$btl->uids[$uen]]); - } - }elseif(isset($dt1['rzEndMg']) && $dt1['rzEndMg']==1) { - $btl->delPriem($pl2,$btl->users[$btl->uids[$uen]]); - } - } - - } - - $hpmin = $btl->testPogB($uen,$hpmin); - - $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] - $hpmin); - - if($btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg'.$tmp] > 0 && $fiz == 0) { - //Часть урона восставнавливает ману - $btl->stats[$btl->uids[$usu]]['mpNow'] += round($hpmin/100*$btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg'.$tmp]); - //if($btl->stats[$btl->uids[$usu]]['mpNow'] > $btl->stats[$btl->uids[$usu]]['mpAll']) { - //$btl->stats[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpAll']; - //} - $btl->users[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - if($usu == $u->info['id']) { - $u->info['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - $u->stats['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - } - } - - if($hp2<0) - { - $hp2 = 0; - }elseif($hp2>$btl->stats[$btl->uids[$uen]]['hpAll']) - { - $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; - } - - $btl->stats[$btl->uids[$uen]]['last_hp'] = -floor($hpmin); - - if($heal != 0) { - if($heal == -1) { - //хил на текущий урон с учетом мф - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] += $hpmin; - if($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] < 0) { - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = 0; - }elseif($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] > $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']) { - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']; - } - - if($eff['user_use'] == $u->info['id']) { - $u->stats['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; - } - - $btl->users[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; - - $upd = mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$eff['user_use']]]['hpNow'].'" WHERE `id` = "'.$eff['user_use'].'" LIMIT 1'); - }else{ - //хил на конкретное число - - } - } - - /* проверяем приемы ослабления */ - - //отнимаем НР - $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; - $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; - - if($uen == $u->info['id']) { - $u->stats['hpNow'] = $hp2; - } - - // тяж травма для кровавых - if($btl->info['type']==99 and $hp2==0 and $trawm_off==false){ - //$eff['user_use'] - //$sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); - - $trawm_off=true; - //$at[2][$i]['ttravm']='получил Тяжелую травму.'; - $btl->addTravm($btl->users[$btl->uids[$uen]]['id'],3,$btl->users[$btl->uids[$eff['user_use']]]['level']); - } - $upd = mysql_query('UPDATE `stats` SET `hpNow` = '.$hp2.',`last_hp` = "'.$btl->stats[$btl->uids[$uen]]['last_hp'].'" WHERE `id` = "'.$uen.'" LIMIT 1'); - - //заносим в лог боя - $vLog = 'time1='.time().'||s1='.$btl->users[$btl->uids[$usu]]['sex'].'||t1='.$btl->users[$btl->uids[$usu]]['team'].'||login1='.$btl->users[$btl->uids[$usu]]['login'].'||s2='.$btl->users[$btl->uids[$uen]]['sex'].'||t2='.$btl->users[$btl->uids[$uen]]['team'].'||login2='.$btl->users[$btl->uids[$uen]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - if($rp>0) - { - $mas1['id_hod']--; - } - $hpminkrit = 0; - if( $k == 1 ) { - $hpminkrit = $hpmin; - } - $btl->addNewStat( array( - 'battle' => $u->info['battle'], - 'uid1' => $u->info['id'], - 'uid2' => $uen, - 'time' => time(), - 'type' => 0, - 'a' => '10000', - 'b' => 0, - 'type_a' => 1, - 'type_b' => 0, - 'ma' => 1, - 'mb' => 1, - 'yrn' => $hpmin, - 'yrn_krit' => $hpminkrit, - 'tm1' => $u->info['team'], - 'tm2' => $btl->users[$btl->uid[$uen]]['team'] - ) ); - - $btl->takeExp($u->info['id'],$hpmin,$usu,$uen); - - if($hpmin>0) - { - $hpmin = '-'.ceil($hpmin); - }else{ - $hpmin = '--'; - } - $tco = array(1=>'006699',2=>'006699',3=>'006699',4=>'006699',5=>'006699',6=>'006699',7=>'006699'); //не крит - $tcl = array(1=>'A00000',2=>'008080',3=>'0000FF',4=>'A52A2A',5=>'006699',6=>'006699',7=>'006699'); //не крит - $tco = $tco[$tmp]; - $tcl = $tcl[$tmp]; - if($k==1) - { - //крит - $tco = 'FF0000'; - $tcl = 'FF0000'; - }elseif($k==-1) - { - //промах - $tco = 'CCCCCC'; - $tcl = 'CCCCCC'; - } - $nmz = array( - 1=>array(0=>'огня',1=>'огненный'), - 2=>array(0=>'воздуха',1=>'электрический'), - 3=>array(0=>'воды',1=>'холод'), - 4=>array(0=>'земли',1=>'земляной'), - 5=>array(0=>'Свет',1=>'Свет'), - 6=>array(0=>'Тьма',1=>'Тьма'), - 7=>array(0=>'Серая магия',1=>'Серая магия') - ); - $nmz = $nmz[$tmp]; - if($fiz>0) - { - $nmz = array( - 1=>array(0=>', колющая атака , ',1=>'колющий'), - 2=>array(0=>', рубящая атака , ',1=>'рубящий'), - 3=>array(0=>', дробящая атака , ',1=>'дробящий'), - 4=>array(0=>', режущая атака , ',1=>'режущий') - ); - $nmz = $nmz[$fiz]; - } - - if($rp==1) - { - if($k==0) - { - $tcl = '000000'; - $tco = '008000'; - } - $sx = array(0=>'',1=>'а'); - $mas1['text'] = '{tm1} {u2} утратил'.$sx[$btl->users[$btl->uids[$uen]]['sex']].' здоровье от "'.$pl['name'].'". '.$hpmin.' ['.ceil($hp2).'/'.$btl->stats[$btl->uids[$uen]]['hpAll'].']'; - }else{ - if( $fiz == 1 ) { - $mas1['text'] = '{tm1} {u1} {1x16x0} прием "'.$pl['name'].'" и поразил {u2}. '.$hpmin.' ['.ceil($hp2).'/'.$btl->stats[$btl->uids[$uen]]['hpAll'].']'; - }else{ - $mas1['text'] = '{tm1} {u1} {1x16x0} заклинание "'.$pl['name'].'" и поразил магией '.$nmz[0].' {u2}. '.$hpmin.' ['.ceil($hp2).'/'.$btl->stats[$btl->uids[$uen]]['hpAll'].']'; - } - } - $btl->add_log($mas1); - $pz[(int)$id] = 1; - return $rr; - } - - public function testActiv($id) - { - global $u; - $r = 0; - if($u->info['admin'] > 0 || $u->info['nadmin'] > 0 || $u->info['id'] > 0) { - $r = 1; - }else{ - $tst = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time` < '.time().' AND `vars` = "read" AND `vals` = "'.$id.'" LIMIT 1',1); - if(isset($tst['id'])) - { - $r = 1; - } - unset($tst); - } - return $r; - } - - public function testRazmenOldUser( $u2 , $u1 , $plid ) { - global $btl,$u; - $r = 0; - //Уровень -противника- ниже уровня -цели- - if( $btl->users[$btl->uids[$u2]]['id'] != $u->info['id'] ) { - if( $btl->users[$btl->uids[$u1]]['level'] < $btl->users[$btl->uids[$u2]]['level'] ) { - $r = 1; - echo '
    Нельзя кастовать через слабого противника в сильного
    '; - }elseif( $btl->users[$btl->uids[$u1]]['bot'] > 0 && $btl->users[$btl->uids[$u2]]['bot'] == 0 ) { - echo '
    Нельзя кастовать через монстров или зверя
    '; - $r = 1; - }elseif($btl->users[$btl->uids[$u1]]['id'] != $btl->users[$btl->uids[$u2]]['id'] - && $plid!=35 - && $plid!=63 - && $plid!=64 - && $plid!=65 - && $plid!=66 - && $plid!=85 - && $plid!=86 - && $plid!=87 - && $plid!=88 - && $plid!=89 - && $plid!=90 - && $plid!=104 - && $plid!=105 - && $plid!=106 - && $plid!=107 - && $plid!=134 - && $plid!=135 - && $plid!=136 - && $plid!=137) //Атака в темную 90,89,88,87,86,85,35 - { - $this->addPriem($u->info['id'],'344','add_m11=-'.round($u->stats['m11']*75/100).'',1,77,1,$u->stats['id'],3,'тьма',0,0,1); //ТУТ понижение урона при уроне через персонажа - } - } - return $r; - } - - public function testDie($u1) { - global $btl; - //Персонаж 1 погиб от рук персонаж 2 - $btl->spaCheck($btl->stats[$btl->uids[$u1]]['id']); - } - - public function pruse($id) - { - global $u,$c,$code,$btl,$ue; - if($id==100500 && $u->info['animal']>0) - { - $use_lst = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "animal_use'.$btl->info['id'].'" LIMIT 1',1); - if(!isset($use_lst['id'])) - { - $a = mysql_fetch_assoc(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.$u->info['animal'].'" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if($u->stats['hpNow'] < 1) { - echo 'Вы не можете выпустить зверя, вы потеряли все НР'; - }elseif(isset($a['id']) && $a['eda']<1) { - echo 'Вы не накормили зверя...'; - }elseif(isset($a['id'])) - { - //Добавляем зверя в бой - $tp = array(1=>'Кот',2=>'Сова',3=>'Светляк',4=>'Чертяка',5=>'Пес',6=>'Свин',7=>'Дракон'); - $id = mysql_fetch_assoc(mysql_query('SELECT `id` FROM `test_bot` WHERE `login` = "'.$tp[$a['type']].' ['.$a['level'].']" LIMIT 1')); - if(isset($id['id']) && $btl->info['type']!=500) - { - $b = $u->addNewbot($id['id'],NULL,NULL); - if($b>0 && $b!=false) - { - $a['eda'] -= 4; - if($a['eda'] < 0) { - $a['eda'] = 0; - } - - //Добавляем эффект - //$anl = mysql_fetch_assoc(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "'.$a['type'].'" AND `level` = "'.$a['level'].'" LIMIT 1')); - //$anl = $anl['bonus']; - //mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","pet_unleash.gif",22,"'.$u->info['id'].'","Эффект от зверя","'.$anl.'","0","77","priem","'.$u->info['id'].'")'); - - //$anl = $u->lookStats($anl); - $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - /*$ba = ''; - $i = 0; - while($iitems['add'])) { - if(isset($anl['add_'.$u->items['add'][$i]])) { - if($anl['add_'.$u->items['add'][$i]] > 0) { - $ba .= $u->is[$u->items['add'][$i]].': +'.$anl['add_'.$u->items['add'][$i]].', '; - } - } - $i++; - } - $ba = trim($ba,', '); - if($ba == '') { - $ba = 'Отсутсвует'; - }*/ - - if($u->info['sex'] == 1) { - $mas1['text'] = '{tm1} {u1} выпустила зверя "'.$a['name'].'"'; - }else{ - $mas1['text'] = '{tm1} {u1} выпустил зверя "'.$a['name'].'"'; - } - $btl->add_log($mas1); - - mysql_query('UPDATE `users` SET `login` = "'.$a['name'].' (зверь '.$u->info['login'].')",`obraz` = "'.$a['obraz'].'.gif",`battle` = "'.$btl->info['id'].'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "'.$u->info['team'].'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); - mysql_query('UPDATE `users_animal` SET `eda` = "'.$a['eda'].'" WHERE `id` = "'.$a['id'].'" LIMIT 1'); - $u->addAction(time(),'animal_use'.$btl->info['id'],$a['level']); - }else{ - echo 'Не удалось выпустить зверя...'; - } - }else{ - //Бот не найден - echo '
    Не удалось выпустить зверя - он боится...'; - } - }else{ - //зверь не найден - echo 'У Вас нет зверя ...'; - } - }else{ - //зверь уже выпущен - echo 'Вы уже выпускали зверя в этом бою ...'; - } - }else{ - - $p = explode('|',$u->info['priems']); - $pz = explode('|',$u->info['priems_z']); - if($p[(int)$id]>0 && $pz[(int)$id]<=0 && $u->info['hpNow']>=1) - { - $pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `level`<="'.$u->info['level'].'" AND `id` = "'.mysql_real_escape_string($p[(int)$id]).'" LIMIT 1')); - if(isset($pl['id']) && $pl['activ']!=1) - { - if($pl['activ']==0) - { - unset($pl); - }elseif($pl['activ']>1) - { - //Книжный прием - if($this->testActiv($pl['activ'])==0) - { - unset($pl); - } - } - } - if(isset($pl['id'])) - { - $notr = 0; - $pl['useon_user'] = $u->info['enemy']; - if(isset($_POST['useon']) && $_POST['useon']!='' && $_POST['useon']!='none') - { - $_POST['useon'] = iconv('UTF-8', 'windows-1251', $_POST['useon']); - $this->ue = mysql_fetch_assoc(mysql_query('SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE (`u`.`login`="'.mysql_real_escape_string($_POST['useon']).'" OR (`u`.`login2` = "'.mysql_real_escape_string($_POST['useon']).'" AND `u`.`login2` != "")) AND (`u`.`inUser` > 0 OR (`u`.`battle`="'.$btl->info['id'].'" AND `st`.`hpNow` > 0)) ORDER BY `u`.`id` DESC LIMIT 1')); - if(isset($this->ue['id']) && $this->ue['inUser']>0) - { - $this->ue = mysql_fetch_assoc(mysql_query('SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE `u`.`battle`="'.$btl->info['id'].'" AND `st`.`hpNow` > 0) AND `u`.`id` = "'.$this->ue['inUser'].'" ORDER BY `u`.`id` ASC LIMIT 1')); - } - if(!isset($this->ue['id']) && $pl['trUser']>0) - { - $notr++; - } - if($pl['team'] == 1) { - //свои - if($u->info['team'] != $this->ue['team']) { - $notr++; - } - }elseif($pl['team'] == 2) { - //противники - if($u->info['team'] == $this->ue['team']) { - $notr++; - } - }elseif($pl['team'] == 0) { - //любая команда - - } - }else{ - //$this->ue = $btl->users[$btl->uids[$u->info['enemy']]]; - $ga = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "'.$btl->info['id'].'" AND `uid1` = "'.$u->info['id'].'" AND `uid2` = "'.$u->info['enemy'].'" LIMIT 1')); - if(($u->info['enemy']==0 || isset($ga['id'])) && ($pl['tr_hod']>0 || $pl['trUser']>0)) - { - $notr++; - } - } - - $notr += $this->testpriem($pl,1,$this->ue['id']); - - /*if( $u->info['admin'] == 0 ) { - $notr++; - }*/ - - if( $this->ue['id'] > 0 ) { - $notr += $this->testRazmenOldUser($this->ue['id'],$u->info['enemy'], $pl['id']); - } - - if($notr==0) - { - mysql_query('UPDATE `stats` SET `last_pr` = "'.$pl['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - - //Приемы на персонажах - if( $this->ue['id'] > 0 ) { - $btl->priemsRazmen(array($u->info['id'],$this->ue['id']),'fast'); - mysql_query('UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "'.$this->ue['id'].'" AND `delete` = 0'); - }else{ - $btl->priemsRazmen(array($u->info['id'],$u->info['enemy']),'fast'); - mysql_query('UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "'.$u->info['enemy'].'" AND `delete` = 0'); - } - mysql_query('UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0'); - - if(file_exists('../../_incl_data/class/priem/'.$pl['id'].'.php')) { - require('../../_incl_data/class/priem/'.$pl['id'].'.php'); - $this->testDie($this->ue['id']); - }else{ - echo 'useSkill'.$pl['id'].''; - } - - /*echo 'combo::'.$pl['type'].'->'; - if($pl['type']==1) - {*/ - //используется моментально - /*$pz[(int)$id] = 0; - if($pl['file']!='0') - { - if(file_exists('../../_incl_data/class/priems/'.$pl['file'].'.php')) - { - echo 'test1'; - } - }else{*/ - //всякие цели и т.д. - /*echo 'test2'; - } - if(!isset($cup)) - { - $this->uppz($pl,$id); - if($pl['tr_hod']>0) - { - $this->trhod($pl); - } - } - }elseif($pl['type']==2) - {*/ - //Используется на себя (не моментально) - //$this->addEffPr($pl,$id); - /*echo 'test3->'; - if(file_exists('../../_incl_data/class/priem/'.$pl['id'].'.php')) { - require('../../_incl_data/class/priem/'.$pl['id'].'.php'); - }else{ - echo 'useSkill'.$pl['id'].''; - }*/ - /*echo 'test3'; - if($pl['file2']!='0') - { - $fast_use_priem = 1; - if(file_exists('../../_incl_data/class/priems/'.$pl['file2'].'.php')) - { - echo '->file'; - } - }*/ - /*}elseif($pl['type']==3) - { - echo 'Использовать приемы данного типа временно запрещено'; - } - */ - - if(!isset($cup)) { - $this->uppz($pl,$id); - //Отнимаем тактики - //$this->mintr($pl); - if($pl['tr_hod']>0) { - $this->trhod($pl); - } - if( $pl['id'] != 258 ) { - if( $pl['cancel_eff'] == '' ) { - $pl['cancel_eff'] = '258'; - }else{ - $pl['cancel_eff'] .= ',258'; - } - } - if($pl['cancel_eff']!='') - { - $i = 0; - $e = explode(',',$pl['cancel_eff']); - while($i0) - { - if( $e[$i] == 258 ) { - $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `v1` = "priem" AND `v2` = "'.$e[$i].'" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - }else{ - $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$this->ue['id'].'" AND `v1` = "priem" AND `v2` = "'.$e[$i].'" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - } - if(isset($nem['id'])) - { - $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$e[$i].'" LIMIT 1')); - if(isset($nem['id'])) - { - $btl->delPriem($nem,$btl->users[$btl->uids[$this->ue['id']]],500); - } - } - } - $i++; - } - } - } - - } - } - } - } - } - - private function rezadEff($uid,$mg) - { - global $u,$btl,$c,$code; - //$this->rezadEff($u->info['id'],'wis_fire_'); - $md = ''; $md2 = ''; - $ex = explode('|',$btl->users[$btl->uids[$uid]]['priems']); - $ex2 = explode('|',$btl->users[$btl->uids[$uid]]['priems_z']); - $i = 0; $ty = array(); - while($i0) - { - $md .= '`id` = "'.((int)$ex[$i]).'" OR '; - $ty[$ex[$i]] = $i; - } - $i++; - } - $md = rtrim($md,' OR '); - if( $md != '' ) { - $md = '( '.$md.' ) AND '; - } - $sp = mysql_query('SELECT * FROM `priems` WHERE '.$md.' `img` LIKE "%'.$mg.'%"'); - while($pl = mysql_fetch_assoc($sp)) { - $ex2[$ty[$pl['id']]] = 0; - } - $md2 = implode('|',$ex2); - $btl->users[$btl->uids[$uid]]['priems_z'] = $md2; - $u->info['priems_z'] = $md2; - $upd = mysql_query('UPDATE `stats` SET `priems_z` = "'.$md2.'" WHERE `id` = "'.((int)$uid).'" LIMIT 1'); - unset($md,$md2,$ty); - if($upd) - { - $upd = true; - }else{ - $upd = false; - } - return $upd; - } - - private function trhod($pl) - { - global $u,$btl; - if($u->info['notrhod'] == -1) { - $u->info['notrhod'] = 0; - if($u->stats['magic_cast'] > 0) { - $u->info['notrhod'] = $u->stats['magic_cast']; - } - mysql_query('UPDATE `users` SET `notrhod` = "'.$u->info['notrhod'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - if($u->info['notrhod'] > 0) { - if( $pl['tr_hod'] > 0 ) { - $u->info['notrhod']--; - mysql_query('UPDATE `users` SET `notrhod` = "'.$u->info['notrhod'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - }else{ - $a1 = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "'.$btl->info['id'].'" AND `uid2` = "'.$u->info['id'].'" AND `uid1` = "'.$u->info['enemy'].'" LIMIT 1')); - if(isset($a1['id'])) - { - //противник ударил, пишем что игрок 2 пропустил ход - mysql_query('UPDATE `battle_act` SET `out2` = "1",`tpo2` = "2" WHERE `id` = "'.$a1['id'].'" LIMIT 1'); - $a1['out2'] = 1; - $a1['tpo2'] = 2; - $btl->atacks[$a1['id']] = $a1; - $btl->users[$u->info['id']]['priems_z'] = $u->info['priems_z']; - $btl->startAtack($a1['id']); - }else{ - //бьем противника с пропуском хода - mysql_query('INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("'.$btl->info['id'].'","'.$u->info['id'].'","'.$u->info['enemy'].'","'.time().'","1","1","2")'); - } - } - } - - public function plusData( $d1, $d2 ) { - global $u; - $j1 = $u->lookStats($d1); - $j2 = $u->lookStats($this->redate($d2,$u->info['id'])); - $v = $u->lookKeys($this->redate($d2,$u->info['id']),0); // ключи 2 - //добавляем данные друг к другу - $i = 0; $inf = ''; - while($iis[$vi]!='') - { - if($j2[$v[$i]]>0) - { - $inf .= $u->is[$vi].': +'.($j2[$v[$i]]*(1+$mpr['x'])).', '; - }elseif($j2[$v[$i]]<0){ - $inf .= $u->is[$vi].': '.($j2[$v[$i]]*(1+$mpr['x'])).', '; - } - } - $i++; - } - $inf = rtrim($inf,', '); - $j1 = $u->impStats($j1); - return $j1; - } - - private function addEffPr($pl,$id,$redus = NULL) - { - global $u,$btl; - $rcu = false; - $j = $u->lookStats($pl['date2']); - $mpr = false; $addch = 0; - $uid = $u->info['id']; - if(isset($this->ue['id'])) - { - $uid = $this->ue['id']; - } - if(isset($j['onlyOne'])) - { - $mpr = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `v2` = "'.$pl['id'].'" AND `uid` = "'.$uid.'" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - } - - if($pl['cancel_eff2']!='') - { - $i = 0; - $e = explode(',',$pl['cancel_eff2']); - while($i0) - { - $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid.'" AND `v1` = "priem" AND `v2` = "'.$e[$i].'" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - if(isset($nem['id'])) - { - $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$e[$i].'" LIMIT 1')); - if(isset($nem['id'])) - { - $btl->delPriem($nem,$btl->users[$btl->uids[$uid]],2); - if( $nem['id'] == $mpr['id'] ) { - unset($mpr); - } - } - } - } - $i++; - } - } - - $pld = array(0=>''); $nc = 0; - if(isset($mpr['id']) && $j['onlyOne']==1) - { - //отнимаем тактики - $addch = 1; - $this->mintr($pl); - $this->uppz($pl,$id); - //добавляем прием в эффекты - if(isset($this->ue['id'])) - { - $btl->stats[$btl->uids[$uid]] = $u->getStats($this->ue,0); - }else{ - $btl->stats[$btl->uids[$uid]] = $u->getStats($u->info,0); - } - $nc = 1; - }elseif(!isset($mpr['id'])) - { - $data = ''; - if(isset($j['date3Plus'])) - { - $data = $this->redate($pl['date3'],$u->info['id']); - } - if( isset($redus) ) { - $data .= '|'.$redus; - } - $hd1 = -1; - if($pl['limit']>0) - { - $tm = 77; - $hd1 = $pl['limit']; - }else{ - $tm = 77; - } - if($pl['limit'] == -2) { - $hd1 = $pl['limit']; - } - if ($pl['id']==239) //Вывод приемов которые не моментальные как бы - { - $btl->priemAddLogFast( $uid, 0, $pl['name'], - '{tm'.$u->info['team'].'} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 1, time() ); - } - - mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("'.$hd1.'","'.$pl['id'].'","'.$pl['img'].'.gif",22,"'.$uid.'","'.$pl['name'].'","'.$data.'","0","'.$tm.'","priem","'.$u->info['id'].'")'); - unset($hd1); - //отнимаем тактики - $addch = 1; - $rcu = true; - $nc = 1; - $this->mintr($pl); - //$this->uppz($pl,$id); - //добавляем прием в эффекты - if(isset($this->ue['id'])) - { - $btl->stats[$btl->uids[$uid]] = $u->getStats($this->ue,0); - }else{ - $btl->stats[$btl->uids[$uid]] = $u->getStats($u->info,0); - } - }elseif($j['onlyOne']>1) - { - if($mpr['x']<$j['onlyOne']) - { - if(isset($j['date3Plus'])) - { - $j1 = $u->lookStats($mpr['data']); - $j2 = $u->lookStats($this->redate($pl['date3'],$u->info['id'])); - $v = $u->lookKeys($this->redate($pl['date3'],$u->info['id']),0); // ключи 2 - //добавляем данные друг к другу - $i = 0; $inf = ''; - while($iis[$vi]!='') - { - if($j2[$v[$i]]>0) - { - $inf .= $u->is[$vi].': +'.($j2[$v[$i]]*(1+$mpr['x'])).', '; - }elseif($j2[$v[$i]]<0){ - $inf .= $u->is[$vi].': '.($j2[$v[$i]]*(1+$mpr['x'])).', '; - } - } - $i++; - } - $inf = rtrim($inf,', '); - $j1 = $u->impStats($j1); - $pld[0] = ' x'.($mpr['x']+1); - if($j['refHod']==1) { - $mpr['hod'] = $pl['limit']; - } - $upd = mysql_query('UPDATE `eff_users` SET `hod` = "'.$mpr['hod'].'",`data` = "'.$j1.'",`x` = `x`+1 WHERE `id` = "'.$mpr['id'].'" LIMIT 1'); - if($upd) - { - //отнимаем тактики - $this->mintr($pl); - $this->uppz($pl,$id); - //добавляем прием в эффекты - if(isset($this->ue['id'])) - { - $btl->stats[$btl->uids[$uid]] = $u->getStats($this->ue,0); - }else{ - $btl->stats[$btl->uids[$uid]] = $u->getStats($u->info,0); - } - $addch = 1; - $rcu = true; - $nc = 1; - } - } - } - } - /* тратим свой ход */ - if($nc==1 && $pl['tr_hod']>0) - { - $this->trhod($pl); - } - return $rcu; - } - - public function mintr($pl) - { - global $u,$btl; - $x = 1; $rt = ''; - while($x<=7) - { - if( $pl['ndt'.$x] == 0 ) { - $u->info['tactic'.$x] -= $pl['tt'.$x]; - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] -= $pl['tt'.$x]; - } - if($u->info['tactic'.$x]<0) - { - $u->info['tactic'.$x] = 0; - } - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$x]<0) - { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] = 0; - } - //$rt .= ',`tactic'.$x.'`="'.$u->info['tactic'.$x].'"'; - $rt .= ',`tactic'.$x.'`="'.$btl->users[$btl->uids[$u->info['id']]]['tactic'.$x].'"'; - $x++; - } - if($pl['xuse']>0) - { - $u->addAction(time(),'use_priem_'.$btl->info['id'].'_'.$u->info['id'],$pl['id']); - } - $rt = ltrim($rt,','); - mysql_query('UPDATE `stats` SET '.$rt.' WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - public function maxtr($x,$val) - { - global $u,$btl; - $u->info['tactic'.$x] += $val; - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] += $val; - if($u->info['tactic'.$x]<0) { - $u->info['tactic'.$x] = 0; - } - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] < 0) { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] = 0; - } - $rt .= '`tactic'.$x.'`="'.$u->info['tactic'.$x].'"'; - mysql_query('UPDATE `stats` SET '.$rt.' WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - public function actpridMax($pl) - { - global $u,$btl; - if($pl['actprid2']>0 || $pl['actprid3']>0) - { - $i = 0; - $pe = explode('|',$u->info['priems']); - $piz = array(); - while($i0) - { - $piz[$pe[$i]] = (int)$pl['actprid2']; - }elseif($pl['actprid3']>0) - { - $piz[$pe[$i]] = $psp['zad']; - } - } - } - $i++; - } - $pz = explode('|',$u->info['priems_z']); - $p = explode('|',$u->info['priems']); - $i = 0; - while($i0 && isset($piz[$p[$i]])) - { - if($pz[$i]==0) - { - $pz[$i] = $piz[$p[$i]]; - } - } - $i++; - } - $pz = implode('|',$pz); - $u->info['priems_z'] = $pz; - $btl->users[$btl->uids[$u->info['id']]]['priems_z'] = $pz; - $btl->stats[$btl->uids[$u->info['id']]]['priems_z'] = $pz; - } - } - - public function uppz($pl,$id) - { - global $u,$btl; - $this->actpridMax($pl); - $p = explode('|',$u->info['priems']); - $pz = explode('|',$u->info['priems_z']); - $pz[(int)$id] = $pl['zad']; - $i = 0; $pe = explode(',',$pl['actprid']); - $piz = array(); - while($i0) - { - if(isset($piz[$p[$i]])) - { - if( $pl['id'] == 281 ) { - //Жертва воде + воздуху дает 5 ед. задержки на землю и огонь - if($p[(int)$i] == 246 || $p[(int)$i] == 186) { - $pz[(int)$i] = 5; - }else{ - $pz[(int)$i] = $pl['zad']; - } - }else{ - $pz[(int)$i] = $pl['zad']; - } - } - if(isset($piz2[$p[$i]])) - { - if( $pz[(int)$i] == 0 ) { - $pz[(int)$i] = 1; - } - } - } - $i++; - } - $pz = implode('|',$pz); - $u->info['priems_z'] = $pz; - $btl->users[$btl->uids[$u->info['id']]]['priems_z'] = $pz; - $btl->stats[$btl->uids[$u->info['id']]]['priems_z'] = $pz; - $tr = $u->lookStats($pl['tr']); - if(isset($tr['tr_mpNow'])) - { - $tr['tr_mpNow'] = round($tr['tr_mpNow']/100*(100-$u->stats['min_use_mp'])); - $btl->users[$btl->uids[$u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; - $btl->stats[$btl->uids[$u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; - if($btl->stats[$btl->uids[$u->info['id']]]['mpNow']<$btl->users[$btl->uids[$u->info['id']]]['mpNow']) - { - $btl->users[$btl->uids[$u->info['id']]]['mpNow'] = $btl->stats[$btl->uids[$u->info['id']]]['mpNow']; - } - } - $u->info['mpNow'] = $btl->users[$btl->uids[$u->info['id']]]['mpNow']; - mysql_query('UPDATE `stats` SET `mpNow` = "'.$u->info['mpNow'].'",`priems_z` = "'.$pz.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - public function reuns($id) - { - global $u,$c,$code; - $p = explode('|',$u->info['priems']); - if($p[(int)$id]>0) - { - //снимаем прием - $p[(int)$id] = 0; - $p = implode('|',$p); - $upd = mysql_query('UPDATE `stats` SET `priems` = "'.mysql_real_escape_string($p).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['priems'] = $p; - } - } - - public function uns($id) - { - global $u,$c,$code; - $pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `level`<="'.$u->info['level'].'" AND `activ` > "0" AND `id` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(isset($pl['id'])) - { - $notr = $this->testpriem($pl,1); - if($notr==0) - { - $yes = -1; $non = -1; - $i = 0; $p = explode('|',$u->info['priems']); - while($i < $u->info['priemslot']) - { - if($non==-1 && $p[$i]==0) - { - $non = $i; - } - if($p[$i]==$pl['id']) - { - $yes = $i; - } - $i++; - } - - if($yes==-1) - { - if($non!=-1) - { - //одеваем прием - $p[$non] = $pl['id']; - $p = implode('|',$p); - $upd = mysql_query('UPDATE `stats` SET `priems` = "'.$p.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($upd) - { - $u->info['priems'] = $p; - } - }else{ - //снимаем последний прием - echo 'Снимаем последний прием...'; - } - }else{ - //такой прием уже стоит, ничего не делаем - } - - } - } - } - - //выводим приемы $id - 1 (вне боя), 2 - в бою - public function seeMy($t) - { - global $u,$c,$code,$btl; - if( $u->info['inTurnir'] == 0 || true == true ) { - $i = 0; $p = explode('|',$u->info['priems']); $lvar = ''; $pr = ''; - while($i<$u->info['priemslot']) - { - if($p[$i]>0) - { - $pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `level`<="'.$u->info['level'].'" AND `activ` > "0" AND `id` = "'.mysql_real_escape_string($p[$i]).'" LIMIT 1')); - $lvar = $this->priemInfo($pl,$t,$i); - $pz = $lvar[1]; - $lvar = $lvar[0]; - if($t==1) - { - if(isset($_GET['inv'])) { - //$cl = 'href="main.php?skills=1&rz=4"'; - $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all='.((int)$_GET['all']).'&skills=1&rz=4&p_raz=all\'"'; - }else{ - //$cl = 'href="main.php?skills=1&rz=4&unuse_priem='.$i.'&rnd='.$code.'"'; - $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all='.((int)$_GET['all']).'&skills=1&unuse_priem='.$i.'&rz=4&p_raz=\' + p_raz"'; - } - }else{ - if($pl['type']==1) - { - //моментально - if($pl['onUser']==1) - { - $oninuser = ''; - if( $pl['team'] == 1 ) { - if( $u->info['login2'] != '' ) { - $oninuser = $u->info['login2']; - }else{ - $oninuser = $u->info['login']; - } - }else{ - if( $btl->users[$btl->uids[$u->info['enemy']]]['login2'] != '' ) { - $oninuser = $btl->users[$btl->uids[$u->info['enemy']]]['login2']; - }else{ - $oninuser = $btl->users[$btl->uids[$u->info['enemy']]]['login']; - } - } - $cl = 'href="javascript:void(0);" onClick="top.priemOnUser('.$i.',1,\''.$pl['name'].'\',\''.$oninuser.'\',\''.$pl['img'].'\');"'; - unset($oninuser); - }else{ - $cl = 'href="javascript:void(0);" onClick="usepriem('.$i.',1,\''.$pl['img'].'\');"'; - } - }elseif($pl['type']==2) - { - //длительное - $cl = 'href="javascript:void(0);" onClick="usepriem('.$i.',1,\''.$pl['img'].'\');"'; - }elseif($pl['type']==3) - { - $cl = 'href="javascript:void(0);" onClick="alert(\'Возможно используем?\');"'; - } - } - - - $notr = $this->testpriem($pl,$t); - - - $cl2 = ''; - $cli2 = ''; - if( ( ($pz[$i]>0 || $notr>0) && $t==2 ) || (isset($u->stats['nopriems']) && $pl['nosh'] == 0) || $u->stats['notuse_last_pr'] == $pl['id']) - { - //$cl2 = 'filter: alpha(opacity=15); -moz-opacity: 0.15; -khtml-opacity: 0.15; opacity: 0.15;'; - $cli2 = ' class="nopriemuse" '; - } - - $pr .= ''; - }else{ - //if($t==1) - //{ - if(isset($_GET['inv'])) { - $pr .= ''; - }else{ - $pr .= ''; - } - //} - } - $i++; - } - if($u->info['animal']>0 && $t==2) - { - $use_lst = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "animal_use'.$btl->info['id'].'" LIMIT 1',1); - if(!isset($use_lst['id'])) - { - $cl2 = ''; - $pr .= ''; - }else{ - $cl2 = '" class="nopriemuse'; - $pr .= ''; - - } - } - if($t==1) - { - echo '
    '.$pr.'
    '; - }elseif($t==2) - { - $pr = str_replace('"','\\"',$pr); - return $pr; - } - } - } - - public function testpriem($pl,$t = 1,$o = 0) - { - global $c,$u,$code,$btl; - $tr = $u->lookStats($pl['tr']); - $d2 = $u->lookStats($pl['date2']); - $x = 1; - $notr = 0; - - if($t==2 && $pl['id']==181){ - $imun = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['enemy'].'" and `v2`="191" and `delete`="0" LIMIT 1')); - if($imun){ - $notr++; - } - } - - if(isset($btl->stats[$btl->uids[$u->info['id']]]['nousepriem']) && $btl->stats[$btl->uids[$u->info['id']]]['nousepriem'] > 0 && $pl['nosh'] == 0) { - if( $btl->stats[$btl->uids[$u->info['id']]]['noshock_voda'] > 0 && substr($pl['img'],0,10) == 'wis_water_' ) { - //вода - }else{ - $notr++; - } - } - - if( $pl['id'] == $btl->stats[$btl->uids[$u->info['id']]]['notuse_last_pr'] ) { - $notr++; - } - - while($x<=7) - { - if(isset($btl->uids[$u->info['id']],$btl->users[$btl->uids[$u->info['id']]])) - { - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$x] < $pl['tt'.$x] && $x!=7 && $pl['tt'.$x] > 0) - { - $notr++; - }elseif($x==7) - { - if($pl['tt'.$x]>0 && $btl->users[$btl->uids[$u->info['id']]]['tactic'.$x]<=0) - { - $notr++; - } - } - } - $x++; - } - - - if($pl['xuse']>0) - { - $xu = $u->testAction('`vars` = "use_priem_'.$btl->info['id'].'_'.$u->info['id'].'" AND `vals` = "'.$pl['id'].'" LIMIT '.$pl['xuse'].'',2); - if($xu[0]>=$pl['xuse']) - { - $notr++; - } - } - - $x = 0; - $t = $u->items['tr']; - while($x < count($t)) - { - $n = $t[$x]; - if(isset($tr['tr_'.$n])) - { - if($n=='lvl') - { - if($tr['tr_'.$n] > $u->info['level']) - { - $notr++; - } - }elseif($tr['tr_'.$n] > $u->stats[$n]) - { - $notr++; - } - } - $x++; - } - - - - if($pl['activ']==0 || ($this->testActiv($pl['activ'])==0 && $pl['activ']>1)) - { - $notr++; - } - - - //if($t==2) - //{ - if(isset($d2['onlyOne']) || isset($d2['onlyOneX1'])) - { - if(isset($d2['onlyOneX1'])) - { - if($d2['onlyOneX1'] == 1) - { - $pru = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `v2` = "'.$pl['id'].'" AND `delete` = "0" AND `x` >= 1 LIMIT 1')); - if(isset($pru['id']) && $pru['x']>=$d2['onlyOne']) - { - $notr++; - } - } - } - elseif(isset($d2['onlyOne'])) - { - if($d2['onlyOne']>1) - { - $pru = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `v2` = "'.$pl['id'].'" AND `delete` = "0" AND `x` > 1 LIMIT 1')); - if(isset($pru['id']) && $pru['x']>=$d2['onlyOne']) - { - $notr++; - } - } - } - } - - /* - if($d2['onlyOne']>1 || $d2['onlyOneX1'] == 1) - { - if( $d2['onlyOneX1'] == 1 ) { - $pru = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `v2` = "'.$pl['id'].'" AND `delete` = "0" AND `x` >= 1 LIMIT 1')); - }else{ - $pru = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `v2` = "'.$pl['id'].'" AND `delete` = "0" AND `x` > 1 LIMIT 1')); - } - if(isset($pru['id']) && $pru['x']>=$d2['onlyOne']) { - $notr++; - } - }*/ - - - - - - //} - - //Требует чтобы не было - if(isset($tr['tr_nousepriem'])) { - $x = 0; - $nouse = explode(',',$tr['tr_nousepriem']); - while($x < count($nouse)) { - $nousev = explode('.',$nouse[$x]); - if(isset($btl->stats[$btl->uids[$u->info['id']]]['prsu'][$nousev[0]]) && $btl->stats[$btl->uids[$u->info['id']]]['prsu'][$nousev[0]] >= 0) { - if($nousev[2] > 1) { - if($nousev[2] <= $btl->stats[$btl->uids[$u->info['id']]]['prsu'][$nousev[0]]) { - $notr++; - } - }else{ - $notr++; - } - } - $x++; - } - unset($nouse,$nousev); - } - - if(isset($tr['tr_type_itm1'])) { - //требует наличие предмета определенного типа - $itmt = mysql_fetch_assoc(mysql_query('SELECT `u`.`id` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE `m`.`type` = "'.$tr['tr_type_itm1'].'" AND `u`.`inOdet` > 0 AND `u`.`uid` = "'.$u->info['id'].'" AND `u`.`delete` = "0" LIMIT 1')); - if(!isset($itmt['id'])) { - $notr++; - } - } - - if(isset($tr['tr_mpNow'])) - { - if(isset($btl->stats[$btl->uids[$u->info['id']]])) - { - if($btl->stats[$btl->uids[$u->info['id']]]['mpNow'] < round($tr['tr_mpNow']/100*(100-$btl->stats[$btl->uids[$u->info['id']]]['min_use_mp']))) - { - $notr++; - } - }else{ - if($u->info['mpNow'] < $tr['tr_mpNow']) - { - $notr++; - } - } - } - - if(isset($btl->uids[$u->info['id']],$btl->stats[$btl->uids[$u->info['id']]])) - { - if($pl['trUser']==1) - { - //требует чтобы пользователь с кем-то разменивался (при ожидании прием гаснит) - if(isset($btl->ga[$u->info['id']][$u->info['enemy']])) - { - $notr++; - } - }elseif($pl['trUser']==2 && $o > 0) - { - //требует чтобы пользователь с кем-то разменивался (при ожидании не пропадает, но не используется) - $ga = mysql_fetch_assoc(mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "'.$btl->info['id'].'" AND `uid1` = "'.$u->info['id'].'" AND `uid2` = "'.$btl->users[$btl->uids[$u->info['id']]]['enemy'].'" LIMIT 1')); - if(isset($ga['id'])) - { - $notr++; - } - } - } - - - - return $notr; - } - - public function priemInfo($pl,$t,$id = false) - { - global $u,$c,$code,$btl; - $pz = explode('|',$u->info['priems_z']); - $tr = $u->lookStats($pl['tr']); - $trs = ''; - $x = 0; - $notr = 0; - $t = $u->items['tr']; - while($x $u->stats[$n]) - { - $trs .= ''; $notr++; - } - $trs .= '
    • '; - $trs .= $u->is[$n].': '.$tr['tr_'.$n]; - if($tr['tr_'.$n] > $u->stats[$n]) - { - $trs .= '
    '; - } - } - $x++; - } - - $lvar = ''; - $j = 1; - $nm = array(1=>'hit',2=>'krit',3=>'counter',4=>'block',5=>'parry',6=>'hp',7=>'spirit'); - while($j<=6) - { - if($pl['tt'.$j]>0) - { - $lvar .= ' '.round($pl['tt'.$j],2).'   '; - } - $j++; - } - if($pl['tt7']>0) - { - if($lvar!='') - { - $lvar .= '
    '; - } - $lvar .= 'Сила духа: '.round($pl['tt'.$j],2).'
    '; - } - $lvar .= '
    '; - if($pl['zad']>0) - { - $lvar .= 'Задержка: '.$pl['zad']; - if($pz[$id]>0) - { - $lvar .= ' (еще '.$pz[$id].')'; - } - $lvar .= '
    '; - } - if(isset($tr['tr_mpNow']) && $tr['tr_mpNow']>0) - { - $tr['tr_mpNow'] -= round($tr['tr_mpNow']/100*$u->stats['min_use_mp']); - if($u->info['mpNow']<$tr['tr_mpNow'] || (isset($btl->stats[$btl->uids[$u->info['id']]]) && $btl->stats[$btl->uids[$u->info['id']]]['mpNow']<$tr['tr_mpNow'])) - { - $lvar .= '• Расход маны: '.$tr['tr_mpNow'].'
    '; - }else{ - $lvar .= '• Расход маны: '.$tr['tr_mpNow'].'
    '; - } - } - if($pl['tr_hod']>0) - { - $lvar .= '• Прием тратит ход
    '; - } - if($trs!='') - { - $lvar .= 'Требования:'.$trs.'

    '; - }else{ - $lvar .= '
    '; - } - $pl['info'] = preg_replace("!(\#)(.*?)(\#)!ise","getdr('\\2',array(0=>'lvl1',1=>'ts5',2=>'mpAll'),array(0=>'".$u->info['level']."',1=>'".$u->stats['s5']."',2=>'".$u->stats['mpAll']."'))",$pl['info']); - $lvar .= $pl['info']; - $lvar = array(0=>$lvar,1=>$pz); - return $lvar; - } - - //Мощность / подавление / сопротивление и т.д. - public function testPower($s1,$s2,$y,$t,$t2) - { - global $u,$btl; - - $r = 0; - if($t2==2) - { - //урон магией - $pm = array(0=>0,1=>0,2=>0,3=>0); - if($t<5) - { - $pm[0] = $s1['m11']; - $pm[1] = $s2['zm']; - $pm[2] = $s2['antm11']; - } - - if(isset($btl->info['id'])) - { - $pm[3] = $btl->zmgo( $s2['zm'.$t] ); - $pm[3] = round($pm[3]); - } - - //$p += $p/100*($s1['pm'.$t]*0.75+$pm[0]*1.01+$s1['m11a']*0.75-($s2['antpm'.$t]+$s2['antm11a']+$pm[2])) - $p/75*$pm[3]; //от мощностей и защита противника - - //$kfl = 250; - - //$p = $y*(1+ ( $s1['pm'.$t]-$s2['antpm'.$t]-$s2['antm11a']-$pm[2] ) /100)*pow(2,(( ( $s2['pzm'.$t] ) * 10-(($s2['zma']+$pm[1]) + $s2['zm'.$t]) )/$kfl)); - - //урон = b*(1+m/100)*2^((p*10-z)/k) - $fx_vl = array( - 250,250,250,250,250,250,250,250,250,350,400,450,500,550,600,650,700,750,800,850,900,950 - ); - - $fx = array( - 'b' => $y, //базовый урон - 'm' => round( $s1['pm'.$t] * 1 - $s2['antpm'.$t] ), //мощь - 'z' => round( $s2['zm'.$t] ), //защита цели ед. - 'p' => round( ($s1['pzm'] + $s1['pzm'.$t])), //подавление - 'k' => $fx_vl[(0+$s1['lvl'])] //коэффициент ; k=250 для 8ки, k=300 для 9ки и т.д. +20% на уровень - ); - if( ($fx['z']+250) - $fx['p']*10 < 0 ) { //защита не может уйти больше, чем в 250 ед. - $fx['p'] = ($fx['z']+250)/10; - } - $fx['p'] = 0; - // - $p = $fx['b'] * ( 1 + $fx['m'] / 100 ) * pow( 2, ( ( $fx['z'] - $fx['p'] * 10 ) / $fx['k'] ) ); - //$p += $p/100*10; - $p -= $p/100*$pm[3]; - //$p += floor($s1['s5']*0.25); - - if($p < round($y*0.1)) { - $p = round($y*0.1); - }elseif($p > round($y*10)) { - $p = $y*10; - } - - //$p += $p/100*($s1['pzm']+$s1['pzm'.$t]); //от подавления маг.защиты - if( isset($s2['zm'.$t.'proc'])) //защита от магии стихий (призрачки) - { - - $p = floor($p/100*(100-$s2['zm'.$t.'proc'])); - if($p<0) - { - $p = 0; - } - - } - if(isset($s2['zmproc']) ) //защита от магии стихий (призрачки) - { - - if ($s2['zmproc']>=75) - { - $p = floor($p/100*(100-75)); - } - else - { - $p = floor($p/100*(100-$s2['zmproc'])); - if($p<0) - { - $p = 0; - } - } - - } - - //$p = round($p/100*rand(97,100)); - $r = $p; - - }else{ - //урон оружием - - } - - $r = round($r/100*70); - - return $r; - - - /* //if($u->info['id']==340379 or $u->info['id']==399105){ - // echo '$y '.$y.'
    '; - //} - $r = 0; - if($t2==2) - { - //урон магией - $pm = array(0=>0,1=>0,2=>0,3=>0); - if($t<5) - { - $pm[0] = $s1['m11']; - $pm[1] = $s2['zm']; - $pm[2] = $s2['antm11']; - } - $p = $y; - - //$p += ($s1['s5']*($p/100*0.52)); //от интелекта - $p += 0; //от умений - - if(isset($btl->info['id'])) - { - //$pm[3] = ($p/100*((($s2['zma']+$pm[1])+$s2['zm'.$t])*1.25))*0.20; - $pm[3] = $btl->zmgo( ($s2['zma']+$pm[1]) + $s2['zm'.$t] ); - $pm[3] = round($pm[3]); - } - - $p += $p/100*($s1['pm'.$t]*0.75+$pm[0]*1.01+$s1['m11a']*0.75-($s2['antpm'.$t]+$s2['antm11a']+$pm[2])) - $p/75*$pm[3]; //от мощностей и защита противника - - - $p += $p/100*($s1['pzm']+$s1['pzm'.$t]); //от подавления маг.защиты - if(isset($s2['zmproc']) || isset($s2['zm'.$t.'proc'])) //защита от магии стихий (призрачки) - { - - $p = floor($p/100*(100-$s2['zmproc']-$s2['zm'.$t.'proc'])); - if($p<0) - { - $p = 0; - } - - } - $p = round($p/100*rand(90,100)); - $r = $p; - - }else{ - //урон оружием - - } - //if($u->info['id']==340379 or $u->info['id']==399105){ - // echo '$r '.$r.'
    '; - // } - return $r;*/ - } - - private function pyes($id) - { - global $u; - $p = explode('|',$u->info['priems']); - $r = false; - $i = 0; - while($iinfo['inTurnir'] == 0 || true == true ) { - $t = $u->items['tr']; - $nm = array(1=>'hit',2=>'krit',3=>'counter',4=>'block',5=>'parry',6=>'hp',7=>'spirit'); - $lvlfe = $u->info['level']; - if(isset($_GET['all'])) { - $lvlfe = 21; - } - $sp = mysql_query('SELECT * FROM `priems` WHERE `level`<="'.$lvlfe.'" AND `activ` > "0" ORDER BY `img`,`level` ASC'); - $u->info['lvl'] = $u->info['level']; $lvar = ''; - while($pl = mysql_fetch_assoc($sp)) - { - $noaki = 0; - if($pl['activ']==1 || $this->testActiv($pl['activ'])==1) - { - $lvar = $this->priemInfo($pl,1); - $lvar = $lvar[0]; - $cl = ''; $a1 = ''; $a2 = ''; - - //$cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?skills=1&unuse_priem='.$i.'&rz=4&p_raz=\' + p_raz"'; - $a1 = ''; $a2 = ''; - - if($this->pyes($pl['id'])==true || $this->testpriem($pl,1)>0) - { - if((isset($_GET['all']) && $_GET['all'] == 1) || $this->pyes($pl['id'])==true) { - $cl = 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; - $a1 = ''; - $a2 = ''; - }else{ - $noaki = 1; - } - } - if($noaki == 0) { - $mtnu = explode('_',$pl['img']); - if($mtnu[0] != 'wis') { - $mtnu = $mtnu[0]; - }else{ - $mtnu = 'wis_'.$mtnu[1]; - } - echo $a1.''.$a2; - } - } - } - } - } -} - -$priem = new priems; - -?> diff --git a/_incl_data/class/ai.login.php b/_incl_data/class/ai.login.php deleted file mode 100644 index c78da449..00000000 --- a/_incl_data/class/ai.login.php +++ /dev/null @@ -1,21 +0,0 @@ - \ No newline at end of file diff --git a/_incl_data/class/bot.logic.php b/_incl_data/class/bot.logic.php deleted file mode 100644 index 2ef37642..00000000 --- a/_incl_data/class/bot.logic.php +++ /dev/null @@ -1,1339 +0,0 @@ - - array( - 'timeout' => 30 - ) - )); - $val = file_get_contents('https://new-combats.com/jx/battle/refresh_bot.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass'].'&'.$txt,false,$ctx); - echo '['.$val.']
    '; - unset( $val ); - } - } - - static function battle_priems() { - - //используем приемы в бою - if(self::$st['hpNow'] > 0 && self::$bot['battle'] > 0) { - - $pr = explode('|',self::$bot['priems']); - $rz = explode('|',self::$bot['priems_z']); - $i = 0; - while($i < count($pr)) { - if($pr[$i] > 0) { - self::$pr[$pr[$i]] = $rz[$i]; - } - $i++; - } - $i = 0; - while($i < count($pr)) { - if($rz[$i] < 1 && $pr[$i] > 0) { - //Можно использовать прием, подключаем логику - botPriemLogic::start( $i, $pr[$i] ); - } - $i++; - } - self::$pr = false; - - } - - } - - static function clear_bot() { - - //Очистка бота, обнуляем его до [0], удаляем эффекты, предметы и т.д, а текущему ставим логин delete - - //Удаляем сообщения в чате - mysql_query('DELETE FROM `chat` WHERE `to` = "'.self::$bot['login'].'"'); - //Удаляем шмотки и эффекты - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.self::$bot['id'].'"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.self::$bot['id'].'"'); - - //Удаляем статы и поле в юзерс - mysql_query('DELETE FROM `users` WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `online` WHERE `uid` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.self::$bot['id'].'" LIMIT 1'); - //Добавляем статы и юзерс - //mysql_query('UPDATE `users` SET `login` = "delete",`login2` = `login` WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - //self::createNewBot(self::$bot['login'],self::$bot['sex']); - /* - $ins = mysql_query("INSERT INTO `users` (`fnq`,`id`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`a1`,`q1`,`mail`,`name`,`bithday`,`sex`,`city_real`,`icq`,`icq_hide`,`deviz`,`chatColor`,`timereg`) VALUES ( - '0', - ".self::$bot['id'].", - '0', - '0', - '".self::$bot['login']."', - '".self::$bot['pass']."', - '0', - '".self::$bot['ip']."', - 'capitalcity', - 'capitalcity', - '0', - '0', - '".self::$bot['mail']."', - '".self::$bot['name']."', - '".self::$bot['bithday']."', - '".self::$bot['sex']."', - '".self::$bot['city_real']."', - '0', - '1', - '".self::$bot['deviz']."', - '".self::$bot['chatColor']."', - '".time()."')"); - if($ins) { - $uid = self::$bot['id']; - mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('".$uid."','".time()."')"); - mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('".$uid."','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')"); - } - */ - } - - static function inuser_go_main( $id , $txt = '' ) { - if(isset($id['id'])) { - $ctx = stream_context_create(array('https'=> - array( - 'timeout' => 1 - ) - )); - file_get_contents('https://new-combats.com/main_bot.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass'].'&'.$txt,false,$ctx); - } - } - - static function inuser_go_zv( $id , $txt = '' ) { - if(isset($id['id'])) { - $ctx = stream_context_create(array('https'=> - array( - 'timeout' => 1 - ) - )); - file_get_contents('https://new-combats.com/main_bot.php?zayvka=1&r=4&uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass'].'&'.$txt,false,$ctx); - } - } - - //ПРоверка на файтрум - static function test_fr( $id , $city = 'capitalcity' ) { - $r = true; - if( $city == 'capitalcity' ) { - if( $id != 0 && $id != 2 && $id != 4 && $id != 5 && $id != 7 && $id != 377 ) { - $r = false; - } - } - return $r; - } - - //Действия бота вне боя - static function actions() { - - global $u; - - if( self::$bot['battle'] == 0 && self::$bot['zv'] == 0 && self::$bot['pass'] == 'saintlucia' ) { - - //Можно: сменить фулл, перейти в другую комнату, входить наймом, делать бафы - - //Переходим в другую комнату - if( true == false && self::$bot['a1'] != 0 && self::$bot['a1'] != self::$bot['room'] ) { - - self::_loc( self::$bot['a1'] ); - - }else{ - - self::update('a1',0); - - //CAPITAL - if( self::$bot['city'] == 'capitalcity' ) { - - - if( self::test_fr(self::$bot['room']) == false ) { - - if( self::$bot['exp'] > 400000 && self::$bot['level'] == 8 ) { - self::$bot['exp'] = 400000; - mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - }elseif( self::$bot['exp'] > 3500000 && self::$bot['level'] == 9 ) { - self::$bot['exp'] = 3500000; - mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - //Действие в комнате - //Магазин - if( self::$bot['room'] == 10 ) { - - //Покупаем кристалл вечности - if( self::$bot['level'] == 5 && self::$bot['exp'] >= 12499) { - $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "'.self::$bot['id'].'" AND `delete` = "0" LIMIT 1')); - if( !isset($cr['id']) ) { - //Покупаем кристалл - $u->addItem(1204,self::$bot['id']); - } - } - - } - - //Переходим в комнату для сражений - self::_loc( self::_loc_zv() ); - - }else{ - - //Стоим на месте, бо сражается )) - - - } - - } - //CAPITAL - - } - - //Если бот уже набрал опыт для перехода на 6-ой - if( self::$bot['level'] == 5 && self::$bot['exp'] >= 12499 ) { - $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "'.self::$bot['id'].'" AND `delete` = "0" LIMIT 1')); - if( !isset($cr['id']) ) { - self::update('a1',10); - } - } - - //Похоже что боту пора сменить комплект )) - if( self::$bot['clss'] == 0 ) { - - //Выбираем новый класс и шмотки :) - - //Меняем класс - self::$bot['clss'] = rand( 1, 4 ); - - $x = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `a_bot_tree` WHERE `level` = "'.(self::$bot['level']).'" ')); - - if( $x[0] > 0 ) { - - if( $x[0] > 1 ) { - - $x = rand( 1 , $x[0] ); - //выбираем 1 из нескольких - $da = array('ASC','DESC','DESC','ASC'); - $da = $da[rand(0,5)]; - $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "'.(self::$bot['level']).'" ORDER BY `id` '.$da.' LIMIT '.($x-1).',1')); - }else{ - $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "'.(self::$bot['level']).'" LIMIT 1')); - } - - if(!isset($com['id'])) { - - $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` < "'.(self::$bot['level']).'" ORDER BY `id` DESC LIMIT 1')); - - } - - if(isset($com['id'])) { - - mysql_query('UPDATE `users` SET `clss` = "'.self::$bot['clss'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - /* Забираем старые шмотки и эффекты */ - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `gift` = "" AND `item_id` != "1204" AND `uid` = "'.self::$bot['id'].'" AND `delete` = "0"'); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "0" WHERE `uid` = "'.self::$bot['id'].'" AND `delete` = "0"'); - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.self::$bot['id'].'" AND `delete` = "0"'); - - /* Обновляем статы и приемы */ - - if($com['pr'] == '') { - $i = 1; - while( $i <= 18 ) { - $com['pr'] .= $com['p'.$i].'|'; - $i++; - } - $com['pr'] .= '0'; - } - - mysql_query('UPDATE `stats` SET `stats` = "'.$com['stats'].'",`priems` = "'.$com['pr'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - /* Выдаем новые предметы и эффекты */ - /* - $e = explode(',',$com['eff']); - $i = 0; - while($i < count($e)) { - if( $e[$i] > 0 ) { - //Кастуем эффект на персонажа без срока годности - - } - $i++; - } - */ - - $i = 1; - while($i <= 20) { - if($com['e'.$i] > 0) { - //Выдаем и надеваем предмет - //$it = $u->addItem($com['e'.$i],self::$bot['id']); - $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.$com['e'.$i].'" LIMIT 1')); - mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("'.$eff['oneType'].'","'.$eff['id2'].'","'.self::$bot['id'].'","'.$eff['mname'].'","'.(time()+9640000).'","'.$eff['mdata'].'","'.$eff['noAce'].'")'); - } - $i++; - } - - $i = 1; - while($i <= 20) { - if($com['w'.$i] > 0) { - //Выдаем и надеваем предмет - $it = $u->addItem($com['w'.$i],self::$bot['id']); - $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_shop` WHERE `item_id` = "'.$com['w'.$i].'" LIMIT 1')); - if($it > 0) { - mysql_query('UPDATE `items_users` SET `inOdet` = "'.$i.'",`delete` = "0", `1price` = "'.$eff1['price_1'].'" WHERE `uid` = "'.self::$bot['id'].'" AND `id` = "'.$it.'" LIMIT 1'); - }else{ - - } - } - $i++; - } - - - - } - - }else{ - //жопа, нет комплектов! ходим в старом - } - - } - - //если бот уже 1-ый уровень, а сидит в новичках :) кидаем его в залы - if( self::$bot['city'] == 'capitalcity' ) { - - if( self::$bot['level'] < 2 && self::$bot['room'] == 0 && self::$bot['a1'] == 0) { - - self::_loc( self::_loc_zv() ); - - }else{ - - //Если куда-то нужно - переходим - - if( self::$bot['a1'] > 0 ) { - - //Топаем в эту комнату - - - } - - } - - } - // - - - - /* ЗАВЕРШЕНИЕ ДЕЙСТВИЙ ВНЕ БОЯ */ - - } - - } - - public $bot_last_action = array(); - - //Включаем логику бота - static function start( $id ) { - if(!isset($bot_last_action[$id])) { - global $u; - $bot_last_action[$id]++; - self::$bot = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`id` = "'.mysql_real_escape_string( $id ).'" AND `u`.`banned` = "0" LIMIT 1')); - - if( isset( self::$bot['id'] ) ) { - - //self::e(self::$bot['id'].'<<['.$bot_last_action[$id].']'); - - self::$st = $u->getStats( self::$bot, 0 ); - - //Заходим ботом в онлайн - self::_online(); - - if( self::$bot['battle'] > 0) { - - //Действия бота в поединке - self::$btl = mysql_fetch_array( mysql_query('SELECT * FROM `battle` WHERE `id` = "'.mysql_real_escape_string(self::$bot['battle']).'" AND `team_win` = "-1" LIMIT 1') ); - if( isset( self::$btl['id'] ) ) { - - $go_bot = false; - $go_txt = ''; - - $a1 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "'.self::$btl['id'].'" AND `uid1` = "'.self::$bot['id'].'" ORDER BY `time` ASC LIMIT 1')); - - //Проверяем возможность использования приемов и делаем список что использовать - //используем приемы - self::battle_priems(); - - if( isset( $a1['id'] ) ) { - - //Бот сделал удар, но никто не ответил, проверяем таймаут и если что заходим - if( $a1['time'] + self::$btl['timeout'] < time() ) { - $go_bot = true; - } - - } - - - /*$a2_sp = mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "'.self::$btl['id'].'" AND `uid2` = "'.self::$bot['id'].'" ORDER BY `time` ASC LIMIT 5'); - - while( $a2 = mysql_fetch_array( $a2_sp ) ) { - - //Бота ударили - делаем ответный удар и заходим - if( $a2['time'] + self::$btl['timeout'] < time() ) { - //Заходим на персонажа - $go_bot = true; - }else{ - mysql_query('UPDATE `stats` SET `enemy` = "'.$a2['uid1'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - $go_bot = true; - $a = array( - 0 => rand(1,5), - 1 => rand(1,5), - 2 => rand(1,5), - 3 => rand(1,5), - 4 => rand(1,5) - ); - $a = $a[0].'_'.$a[1].'_'.$a[2].'_'.$a[3].'_'.$a[4]; - $b = rand(1,5); - $go_txt .= '&atack='.$a.'&block='.$b.''; - } - - }*/ - - //ТУТ test - $a2 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "'.self::$btl['id'].'" AND `uid2` = "'.self::$bot['id'].'" ORDER BY `time` ASC LIMIT 1')); - if(isset($a2['uid1'])) - { - mysql_query('UPDATE `stats` SET `enemy` = "'.$a2['uid1'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - $a3 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "'.self::$btl['id'].'" AND `uid2` = "'.self::$bot['id'].'" ORDER BY `time` ASC LIMIT 1')); - if(isset($a3['uid2'])) - { - mysql_query('UPDATE `stats` SET `enemy` = "'.$a3['uid2'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - //Размен с противником - - - $a1 = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "'.self::$btl['id'].'" AND `uid1` = "'.self::$bot['id'].'" AND `uid2` = "'.self::$bot['enemy'].'" LIMIT 1')); - self::$enemy = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.self::$bot['enemy'].'" LIMIT 1')); - /*if( !isset( $a1['id'] ) && self::$bot['hpNow'] >0 && self::$enemy['hpNow'] >0) { - $go_bot = true; - $a = array( - 0 => rand(1,5), - 1 => rand(1,5), - 2 => rand(1,5), - 3 => rand(1,5), - 4 => rand(1,5) - ); - $a = $a[0].'_'.$a[1].'_'.$a[2].'_'.$a[3].'_'.$a[4]; - $b = rand(1,5); - $go_txt .= '&atack='.$a.'&block='.$b.''; - } - - - unset($a1,$a2_sp,$a2); - //Заходим на персонажа - if( $go_bot == true ) { - self::inuser_go_btl( self::$bot , $go_txt ); - }*/ - - }else{ - - //Заходим на персонажа - self::inuser_go_btl( self::$bot ); - - //Поединок уже завершился, выкидываем из боя - self::$bot['battle'] = 0; - mysql_query( 'UPDATE `users` SET `battle` = "'.self::$bot['battle'].'" WHERE `id` = "'.mysql_real_escape_string(self::$bot['id']).'" LIMIT 1 ' ); - } - - }else{ - - //Действия бота вне поединка - if( self::$bot['timeMain'] < time() ) { - - mysql_query('UPDATE `chat` SET `time` = "'.time().'" WHERE `to` = "'.self::$bot['login'].'" AND `time` = "-1"'); - - //Действие возможно произвести - if( self::$bot['ipreg'] == 1 || self::$bot['ipreg'] == 2 || self::$bot['ipreg'] == 4 ) { - //Принимаем только хаоты - self::$bot['ipreg'] = 3; - } - if( self::$bot['ipreg'] == 5 ) { - //Подаем только хаоты - self::$bot['ipreg'] = 7; - } - // - if( self::$bot['ipreg'] == 0 || self::test_fr(self::$bot['room']) == false ) { - - /*if( self::$bot['exp'] > 0 && self::$bot['exp'] < 30000 ) { - $u->addItem(1204,self::$bot['id']); - mysql_query('UPDATE `stats` SET `exp` = "270000" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - }*/ - - //Удаляем травму и ослабу - //mysql_query('UPDATE `eff_users` SET `timeUse` = "'.(time()-86400*3).'" WHERE `uid` = "'.self::$bot['id'].'" AND `id_eff` = "4" LIMIT 100'); - - //Обновляем эффекты - $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "'.(self::$bot['level']).'" LIMIT 1')); - if(isset($com['id'])) { - $eft = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = "'.self::$bot['id'].'" AND `delete` = "0" LIMIT 1')); - if(!isset($eft['id'])) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.self::$bot['id'].'" AND `delete` = "0"'); - $i = 1; - while($i <= 20) { - if($com['e'.$i] > 0) { - //Выдаем и надеваем предмет - //$it = $u->addItem($com['e'.$i],self::$bot['id']); - $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.$com['e'.$i].'" LIMIT 1')); - mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("'.$eff['oneType'].'","'.$eff['id2'].'","'.self::$bot['id'].'","'.$eff['mname'].'","'.(time()+86400*7).'","'.$eff['mdata'].'","'.$eff['noAce'].'")'); - } - $i++; - } - } - } - - if( self::$bot['level'] >= 13 && self::$bot['clan'] == 0 && self::$bot['align'] == 0 ) { - //обнуляем бота - self::clear_bot(); - } - - //Только-что из поединка, хиляется - if( self::test_fr(self::$bot['room']) == false ) { - - //В какой-то локации, видимо что-то делаем - - }elseif( self::$st['hpNow'] >= self::$st['hpAll'] ) { - echo 1; - //Приступаем к активной деятельности :) - mysql_query('UPDATE `stats` SET `zv`= "0",`team`= "0",`hpNow` = "'.self::$st['hpNow'].'",`mpNow` = "'.self::$st['mpNow'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "'.self::new_action().'",`mod_zvanie` = "Стажер" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - }else{ - - if(self::$bot['mod_zvanie'] == 'Стажер100500') { - //Надеваем комплект + обновляем эффекты - mysql_query('UPDATE `eff_users` SET `timeUse` = "'.( time() + 7200 ) .'" WHERE `uid` = "'.self::$bot['id'].'" AND `delete` = "0" AND `v1` != "priem" LIMIT 12'); - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "'.self::$bot['id'].'" AND `inOdet` > 0 AND `delete` = "0"'); - $sp = mysql_query('SELECT `u`.`id`,`st`.`inslot`,`st`.`2too` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `st` ON `st`.`id` = `u`.`item_id` WHERE `u`.`inOdet` = 0 AND `st`.`inslot` > 0 AND `st`.`inSlot` <= 20'); - $in = array(); - while($pl = mysql_fetch_array($sp)) { - $od = $pl['inslot']; - - if($od == 10 && $in[10] > 0) { - if($in[11] > 0) { - if($in[12] == 0) { - $od = 12; - } - }else{ - $od = 11; - } - } - - if($od == 3 && $in[3] > 0 && $pl['2too'] > 0) { - if( $in[14] > 0 ) { - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "'.self::$bot['id'].'" AND `inOdet` = "14" AND `delete` = "0" LIMIT 1'); - $in[14] = 0; - } - $od = 14; - } - - if( $in[$od] == 0 ) { - $in[$od] = $pl['id']; - mysql_query('UPDATE `items_users` SET `inOdet` = "'.$od.'" WHERE `id` = "'.$pl['id'].'" AND `uid` = "'.self::$bot['id'].'" LIMIT 1'); - } - } - mysql_query('UPDATE `items_users` SET `mod_zvanie` = "Cтaжер" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - //Хиляемся дальше - if( self::$bot['regHP'] == 0 || self::$bot['regMP'] == 0 ) { - mysql_query('UPDATE `stats` SET `regHP` = "'.time().'", `regMP` = "'.time().'",`hpNow` = "'.self::$st['hpNow'].'",`mpNow` = "'.self::$st['mpNow'].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - $reg = $u->regen( self::$bot['id'] , self::$st , 0 ); - } - - self::actions(); - - self::update( 'timeMain', self::rnd() ); - - }elseif( self::$bot['ipreg'] == 1 ) { - - //Принять заявку на бой (физ.) - if( self::$bot['zv'] == 0 ) { - - //Выделяем подходящую заявку в физ. поединке - $rz = 2; - $zv = 0; - $nozv = 0; - - if( self::$bot['level'] == 0 ) { - $rz = 1; - } - - $zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `city` = "'.self::$bot['city'].'" AND `otk` < "'.rand( 2, 6 ).'" AND `time` < "'.( time() - rand( 15, 25 ) ).'" AND `bcs` < "'.time().'" AND `start` = "0" AND `razdel` = "'.$rz.'" AND `cancel` = "0" AND `time` > "'.( time() - 1111).'" AND `money3` = 0 ORDER BY `time` DESC LIMIT 1')); - - if( isset( $zv['id'] ) ) { - - $uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$zv['id'].'" AND `st`.`team`="1" LIMIT 1')); - $uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$zv['id'].'" AND `st`.`team`="2" LIMIT 1')); - - if( isset( $uz1['id'] ) && !isset( $uz2['id'] ) ) { - - $uz1st = $u->getStats($uz1,0); - - if( $uz1st['reting'] <= floor(self::$st['reting']*1.27) ) { - - //Принимаем заявку - $sa = ''; - if( self::$bot['sex'] == 2 ) { - $sa = 'а'; - } - - $text = ' [login:'.self::$bot['login'].'] принял'.$sa.' вашу заявку на бой.[reflesh_main_zv_priem:'.self::$bot['id'].']'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$uz1['city']."','','','".$uz1['login']."','".$text."','".time()."','6','0')"); - mysql_query('UPDATE `stats` SET `zv` = "'.$zv['id'].'",`team` = "2" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - }else{ - $nozv = 1; - } - - unset ($uz1st); - - }else{ - $nozv = 1; - } - }else{ - $nozv = 1; - } - - if( $nozv == 1 ) { - - if( self::$bot['timeMain'] < time() - rand(1,3)*60 ) { - mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - } - - unset($rz); - } - - - }elseif( self::$bot['ipreg'] == 2 ) { - - //Принять заявку на бой (груп.) - self::bot_group_haot_zv( 6 ); - }elseif( self::$bot['ipreg'] == 3 ) { - - //Принять заявку на бой (хаот.) - self::bot_group_haot_zv( 7 ); - }elseif( self::$bot['ipreg'] == 4 ) { - - //Принять заявку на бой (турнир.) - self::e(''.self::$bot['login'].', я хочу принять турнир...'); - }elseif( self::$bot['ipreg'] == 5 ) { - - //Подать заявку (физ.) - if( self::$bot['zv'] == 0 ) { - - $rz = 2; - if( self::$bot['level'] == 0 ) { - $rz = 1; - } - - $ins = mysql_query('INSERT INTO `zayvki` (`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) VALUES ( - "0", - "0", - "'.time().'", - "'.self::$bot['city'].'", - "'.self::$bot['id'].'", - "0", - "0", - "300", - "0", - "21", - "0", - "21", - "1", - "1", - "0", - "0", - "'.$rz.'", - "", - "", - "","'.( 0 + self::$bot['reting'] ).'","0")'); - $zid = mysql_insert_id(); - mysql_query('UPDATE `stats` SET `zv` = "'.$zid.'", `team` = "1" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - }elseif( self::$bot['ipreg'] == 6 || self::$bot['ipreg'] == 7 ) { - - self::bot_group_haot_zv( self::$bot['ipreg'] ); - - //Подать заявку (груп.) или хаотов - //$test_zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `creator` = '.self::$bot['id'].' AND `cancel` = 0 AND `start` = 0 LIMIT 1')); - - //self::e('SELECT * FROM `zayvki` WHERE `creator` = '.self::$bot['id'].' AND `cancel` = 0 AND `start` = 0 LIMIT 1'); - - if( self::$bot['zv'] == 0 ) { - - $rz = 4; - - if( self::$bot['ipreg'] == 7 ) { - $rz = 5; - } - - $rz = 5; - - $zv_c = array( - - 'time_start' => ( 60 * 5 ), - 'tm1' => rand( 2, 6 ), - 'tm2' => rand( 2, 6 ), - 'l1min' => 0, - 'l1max' => 21, - 'l2min' => 0, - 'l2max' => 21, - 'timeout' => ( 60 * rand( 1, 3 ) ) - - ); - - if( self::$bot['ipreg'] == 7 ) { - $zv_c['tm1'] = 99; - } - - $zv_c['tm2'] = $zv_c['tm1']; - $zv_c['l1min'] = self::$bot['level']; - $zv_c['l1max'] = self::$bot['level']; - - if($zv_c['l1min'] < 2) { - $zv_c['l1min'] = 2; - } - if($zv_c['l1max'] >21) { - $zv_c['l1max'] = 21; - } - - $zv_c['l2min'] = $zv_c['l1min']; - $zv_c['l2max'] = $zv_c['l1max']; - /* - $ins = mysql_query('INSERT INTO `zayvki` (`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`,`maxplayers`) VALUES ( - "0", - "0", - "'.time().'", - "'.self::$bot['city'].'", - "'.self::$bot['id'].'", - "0", - "'.$zv_c['time_start'].'", - "'.$zv_c['timeout'].'", - "'.$zv_c['l1min'].'", - "'.$zv_c['l1max'].'", - "'.$zv_c['l2min'].'", - "'.$zv_c['l2max'].'", - "'.$zv_c['tm1'].'", - "'.$zv_c['tm2'].'", - "0", - "0", - "'.$rz.'", - "", - "", - "","'.( 0 + self::$bot['reting'] ).'","0", - "12")'); - $zid = mysql_insert_id(); - mysql_query('UPDATE `stats` SET `zv` = "'.$zid.'", `team` = "1" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - */ - } - - }elseif( self::$bot['ipreg'] == 8 ) { - - //Ожидание начала поединка - if( self::$bot['zv'] == 0 ) { - - //Поединок не удалось начать - mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - }else{ - $zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "'.self::$bot['zv'].'" AND `cancel` = "0" AND `start` = "0" LIMIT 1')); - - if( !isset( $zv['id'] ) ) { - - //Обнуляем действия - mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - }elseif($zv['razdel'] == 4 || $zv['razdel'] == 5) { - - //хаот или группа - if( $zv['time_start'] + $zv['time'] <= time() ) { - - self::inuser_go_zv( self::$bot ); - } - - }else{ - //физ - if( $zv['creator'] == self::$bot['id'] ) { - - $uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$zv['id'].'" AND `st`.`team`="2" LIMIT 1')); - if( isset( $uz2['id'] ) ) { - //Заявку кто-то принял, реагируем! :) - $pr = -1; - - $uz2st = $u->getStats($uz2,0); - - //btl-cof - if( $uz2st['reting'] > floor(self::$st['reting']*1.27)) { - - //Отказываем, в 95% случаев, противник слишком силен - if( rand( 0, 100 ) > 95 ) { - //отправляем бота на избиение :D - $pr = 1; - }else{ - //отказ - $pr = 0; - } - - }else{ - $pr = 1; - } - - //Можно принять заявку - //$pr = 0; - - if( $pr == 1 ) { - - //Прием заявки - //создаем поединок с ботом - $expB = 0; - $btl = array('players'=>'','timeout'=>$zv['timeout'],'type'=>$zv['type'],'invis'=>$zv['invis'],'noinc'=>0,'travmChance'=>0,'typeBattle'=>0,'addExp'=>$expB,'money'=>0); - $ins = mysql_query('INSERT INTO `battle` (`time_over`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`team_win`) VALUES ( - "0", - "'.self::$bot['city'].'", - "'.time().'", - "'.$btl['players'].'", - "'.$btl['timeout'].'", - "'.$btl['type'].'", - "'.$btl['invis'].'", - "'.$btl['noinc'].'", - "'.$btl['travmChance'].'", - "'.$btl['typeBattle'].'", - "'.$btl['addExp'].'", - "'.$btl['money'].'", - "-1")'); - if($ins) - { - $btl_id = mysql_insert_id(); - //обновляем данные о поединке - mysql_query('UPDATE `users` SET `battle`="'.$btl_id.'" WHERE `id` = "'.$uz2['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle`="'.$btl_id.'",`ipreg` = "0" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team`="1" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team`="2" WHERE `id` = "'.$uz2['id'].'" LIMIT 1'); - - //Если бой кулачный, то снимаем вещи - if($btl['type']==1) - { - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "'.self::$bot['id'].'" AND `inOdet`!=0'); - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "'.$uz2['id'].'" AND `inOdet`!=0'); - } - - mysql_query('UPDATE `zayvki` SET `start` = "'.time().'",`btl_id` = "'.$btl_id.'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - - //обновляем заявку, что бой начался - self::$bot['battle'] = $btl_id; - - //Отправляем сообщение в чат всем бойцам - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('".$u->info['city']."','".$u->info['room']."','".$uz2['login']."','".time()."','11','0','117')"); - } - - }elseif( $pr == 0 ) { - - //Отказ - $sa = ''; - if( self::$bot['sex'] == 2 ) { - $sa = 'а'; - } - $text = ' [login:'.self::$bot['login'].'] отказал'.$sa.' вам в поединке.'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$uz2['city']."','','','".$uz2['login']."','".$text."','".time()."','6','0')"); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "1" WHERE `id` = "'.$uz2['id'].'" LIMIT 1'); - mysql_query('UPDATE `zayvki` SET `otk` = ( `otk` + 1 ),`bcs` = "'.( time() + rand( 30, rand( 60, 180 ) ) ).'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - }else{ - //Чего-то ждем... - } - - }else{ - - //Заявку никто не принял, возможно стоит отменить заявку вообще! - if( self::$bot['timeMain'] < time() - 30 - rand((7 / $zv['otk'] ), (3*49 / $zv['otk'] )) ) { - - mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "0",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `zayvki` SET `cancel` = "'.time().'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - - } - - } - - } - - } - - //Бот уже слишком долго ждет ответа игрока, отказываемся от заявки - if( self::$bot['timeMain'] < time() - rand((30 / $zv['otk'] ), (135 / $zv['otk'] )) && $zv['creator'] != self::$bot['id'] && ( $zv['razdel'] == 1 || $zv['razdel'] == 2 ) ) { - - $uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$zv['id'].'" AND `st`.`team`="1" LIMIT 1')); - if( isset( $uz1['id'] ) ) { - - $sa = ''; - if( self::$bot['sex'] == 2 ) { - $sa = 'а'; - } - - $text = ' [login:'.self::$bot['login'].'] отозвал'.$sa.' свой запрос на бой.'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$uz1['city']."','','','".$uz1['login']."','".$text."','".time()."','6','0')"); - } - - mysql_query('UPDATE `zayvki` SET `otk` = ( `otk` + 1 ),`bcs` = "'.( time() + rand( 30, rand( 60, 180 ) ) ).'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "1" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `ipreg` = "1",`timeMain` = "'.self::rnd().'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - - } - - }elseif( self::$bot['ipreg'] == 9 ) { - - //Подать заявку (хаот.) - - }elseif( self::$bot['ipreg'] == 10 ) { - - //Свободные характеристики или умения - - }elseif( self::$bot['ipreg'] == 11 ) { - - //Меняем комплект - - }elseif( self::$bot['ipreg'] == 12 ) { - - //Получили новый уровень - - }elseif( self::$bot['ipreg'] == 13 ) { - - //Помочь персонажу в бою - - }elseif( self::$bot['ipreg'] == 14 ) { - - //Вылечить персонажа от травм - - }elseif( self::$bot['ipreg'] == 15 ) { - - //Сделать каст персонажу (Сокрушение, Холодный разум, Защита от магии, Защита от оружия) - - }elseif( self::$bot['ipreg'] == 16 ) { - - //Выпить эликсиры - - }else{ - self::update('ipreg',0); - } - - } - - } - - return true; - - }else{ - - return false; - - } - } - } - - static function team_zv_cf( $zv , $tm ) { - $r = mysql_fetch_array(mysql_query('SELECT SUM(`btl_cof`) FROM `stats` WHERE `zv` = "'.$zv['id'].'" AND `team` = "'.$tm.'" LIMIT 1')); - $r = 0+round($r[0]); - return $r; - } - - static function new_action() { - - $r = rand( 1 , 7 ); - - if( self::$bot['level'] < 2 ) { - if( $r == 2 || $r == 3 || $r == 6 || $r == 7 || $r == 8 ) { - if( rand(0,1) == 1 ) { - $r = 1; //принимаем физ - }elseif( rand(0,1) == 0 ){ - $r = 4; //принимаем турнир - }else{ - $r = 5; //подаем физ - } - } - }elseif( self::$bot['level'] == 0 ) { - if( rand(0,1) == 1 ) { - $r = 1; //принимаем физ - }else{ - $r = 5; //подаем физ - } - }else{ - //Доступны любые заявки - - } - - if( $r == 4 ) { - $r = 1; - } - - return $r; - - } - - - /*/ - Базовые функции обучения бота - /*/ - //Бот ищет заявку в группы или хаот для своего уровня и подходящую ему - static function bot_group_haot_zv( $id ) { - - if($id == 6) { - //группы - $rz = 4; - }elseif($id == 7) { - //хаоты - $rz = 5; - } - - // - $rz = 5; - // - - - $sp = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "'.$rz.'" AND `cancel` = "0" AND `start` = "0" AND `invise` = "0" AND `money3` = 0 AND ( - ( `min_lvl_1` <= '.self::$bot['level'].' AND `max_lvl_1` >= '.self::$bot['level'].' ) OR ( `min_lvl_2` <= '.self::$bot['level'].' AND `max_lvl_2` >= '.self::$bot['level'].' ) - )'); - - $pr = 0; - - while($pl = mysql_fetch_array( $sp )) { - - if( $pr == 0 ) { - - $go = 1; - $tm = array(0,0,0); - - if( $rz == 4 ) { - - $tm1c = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$pl['id'].'" AND `team` = "1" LIMIT 1')); - $tm2c = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$pl['id'].'" AND `team` = "2" LIMIT 1')); - - if($tm1c[0] < $pl['tm1max']) { - if( $pl['min_lvl_1'] <= self::$bot['level'] && $pl['max_lvl_1'] >= self::$bot['level']) { - $tm[1] = 1; - } - } - - if($tm2c[0] < $pl['tm2max']) { - if( $pl['min_lvl_1'] <= self::$bot['level'] && $pl['max_lvl_1'] >= self::$bot['level']) { - $tm[2] = 1; - } - } - - $atm = 1; - $tmr = 0; - if( $tm[1] == 1 && $tm[2] == 0 ) { - $tmr = 1; - }elseif( $tm[1] == 0 && $tm[2] == 1 ) { - $tmr = 2; - }else{ - $tmr = rand(1,2); - } - - if($tmr > 0) { - if($tmr == 1) { - $atm = 2; - } - - - //Логика приема заявки - if( self::team_zv_cf($pl,$atm) > ( self::team_zv_cf($pl,$tmr) + self::$st['reting'] )*1.67 || ($zv['tm2max'] < $zv['tm1max']/2) || ($zv['tm1max'] < $zv['tm2max']/2) ) { - //self::e(self::$bot['login'].', я очкую '.$pl['id'].' , '.self::team_zv_cf($pl,$atm).' VS '.(self::team_zv_cf($pl,$tm) + self::$st['reting'] ).' ...'); - if(rand(0,100) < 90) { - $go = 0; - } - } - } - - }elseif( $rz == 5 ) { - /* - if( $pl['min_lvl_1'] <= self::$bot['level'] && $pl['max_lvl_1'] >= self::$bot['level']) { - $tm[1] = 1; - } - */ - //Только 8-ки - /*if( self::$bot['level'] <= 8 ) { - if( $pl['min_lvl_1'] <= 8 && $pl['max_lvl_1'] <= 8) { - $tm[1] = 1; - } - }else{*/ - if( $pl['min_lvl_1'] == self::$bot['level'] && $pl['max_lvl_1'] == self::$bot['level'] ) { - $tm[1] = 1; - } - $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$pl['id'].'"')); - $cols = $col_p[0]; - if( $cols >= $pl['maxplayers'] ) { - $go = 0; - } - //} - } - - - if($go == 1 && ( $tm[1] != 0 || $tm[2] != 0 )) { - - if( $tm[1] == 1 && $tm[2] == 0 ) { - $tm = 1; - }elseif( $tm[1] == 0 && $tm[2] == 1 ) { - $tm = 2; - }else{ - $tm = rand(1,2); - } - - if( $rz == 5 ) { - $tm = 1; - } - - //self::e(self::$bot['login'].', принял участие в заявке #'.$pl['id'].', за команду №'.$tm.' '); - - if( $rz == 5 ) { - /* считаем баланс */ - if($pl['tm1'] > $pl['tm2']) - { - $tm = 2; - }elseif($z['tm1']<$z['tm2']) - { - $tm = 1; - }else{ - $tm = rand(1,2); - } - - $tm = rand(1,2); - - if($pl['invise']==0) - { - $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$pl['id'].'"')); - $nxtID = $nxtID[0]; - //$u->info['login2'] = 'Боец ('.($nxtID+1).')'; - self::$bot['login2'] = ''; - }else{ - self::$bot['login2'] = ''; - } - - $blnc = 100*self::$bot['level']+self::$st['reting']; - - $pl['tm'.$tm] += $blnc; - - mysql_query('UPDATE `zayvki` SET `tm1` = "'.$pl['tm1'].'", `tm2` = "'.$pl['tm2'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - - } - - if( $tm > 0 || $rz == 5 ) { - - //Принимаем участие в заявке - mysql_query('UPDATE `stats` SET `zv` = "'.$pl['id'].'",`team` = "'.$tm.'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `login2` = "'.self::$bot['login2'].'",`ipreg` = "8" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - self::$bot['zv'] = $pl['id']; - $pr = $pl['id']; - - } - - } //if - - } // while - - } - - } - - //Добавляем нового бота - static function createNewBot($login,$sex) { - if($sex != 1) { - $sex = 0; - }else{ - $se = 1; - } - - $r = array( - 'name' => '_', - 'city_real' => '', - 'deviz' => '', - 'chatColor' => 'Black' - ); - - $ins = mysql_query("INSERT INTO `users` (`fnq`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`name`,`sex`,`city_real`,`deviz`,`chatColor`,`timereg`) VALUES ( - '0', - 'real_bot_user', - '0', - '".mysql_real_escape_string($login)."', - '".md5('regnxt#$%^а0.'.time())."', - '127.0.0.1', - '127.0.0.1', - 'capitalcity', - 'capitalcity', - '".$r['name']."', - '".mysql_real_escape_string($sex)."', - '".$r['city_real']."', - '".$r['deviz']."', - '".$r['chatColor']."', - '".time()."')"); - if($ins){ - $uid = mysql_insert_id(); - mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('".$uid."','".time()."')"); - mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('".$uid."','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')"); - mysql_query("UPDATE `users` SET `online`='".time()."' WHERE `uid` = '".$uid."' LIMIT 1"); - } - - } - - //Бот находится в онлайне - static function _online() { - if( self::$bot['online'] < time() - 60 ) { - //уровень/апп - if( self::$bot['battle'] == 0 && self::$bot['zv'] == 0) { - self::_level(); - } - self::update( 'online', time() ); - //self::$bot['online'] = time(); - //mysql_query( 'UPDATE `users` SET `online` = "'.self::$bot['online'].'" WHERE `id` = "'.mysql_real_escape_string(self::$bot['id']).'" LIMIT 1 ' ); - - } - } - - //Бот меняет локацию - static function _loc_A( $a, $b ) { - $r = $b; - - return $r; - } - - static function _loc_zv() { - - if( rand(0,100) < 5 ) { - - $r = 1; - - }else{ - - $r = rand(1,4); - - } - - if( $r == 4 ) { - - //будуар - if( self::$bot['sex'] != 1 ) { - $r = rand(1,3); - } - - } - - if( self::$bot['city'] == 'capitalcity' ) { - if($r == 4) { - //будуар - $r = 7; - }elseif( $r == 3 ) { - //ЗВ 3 - $r = 5; - }elseif( $r == 2 ) { - //ЗВ 2 - $r = 2; - }else{ - //ЗВ 1 - $r = 4; - } - - if( self::$bot['level'] == 0 ) { - //Новички - $r = 0; - } - - } - - return $r; - } - - static function _loc( $id ) { - - if( $id == self::$bot['room'] ) { - - //ничего, уже пришли - self::update('a1',0); - - }else{ - - //Прокладываем маршрут из текущей комнаты - $rid_next = self::_loc_A(self::$bot['room'],$id); - if( $rid_next > 0 ) { - //Идем туда - //$rid_next = 377; - mysql_query('UPDATE `users` SET `room` = "'.$rid_next.'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - return true; - }else{ - //Невозможно дойти туда - return false; - } - - } - - } - - //Бот получил уровень, либо апп - static function _level() { - global $u; - $lvl = mysql_fetch_array(mysql_query('SELECT `upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="'.(self::$bot['upLevel']+1).'" LIMIT 1')); - if( isset($lvl['upLevel']) ) { - - if( self::$bot['level'] <= 5 && self::$bot['exp'] >= 12499 ) { - $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "'.self::$bot['id'].'" AND `delete` = "0" LIMIT 1')); - if( !isset($cr['id']) ) { - $u->addItem(1204,self::$bot['id']); - self::$bot['exp'] = 12500; - } - } - //self::$bot['exp'] = 300000; - if($lvl['exp'] <= self::$bot['exp']) { - //mysql_query('UPDATE `stats` SET `exp` = "300000" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - //self::e('test'); - //Получаем уровень - self::inuser_go_main( self::$bot ); - mysql_query('UPDATE `users` SET `clss` = "0" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - - } - - }else{ - self::e(self::$bot['login']); - } - - } - - //Вспомогательные функции - static function e( $t ) { - - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity", - "LEL","6","1","-1")'); - - } - - static function rnd() { - return time() + rand(3,14) + rand(0,14) + rand(7,21); - } - - static function update( $n, $v, $t = 'users' ) { - self::$bot[$n] = $v; - mysql_query('UPDATE `'.$t.'` SET `'.$n.'` = "'.self::$bot[$n].'" WHERE `id` = "'.self::$bot['id'].'" LIMIT 1'); - } - -} -?> \ No newline at end of file diff --git a/_incl_data/class/bot.priem.php b/_incl_data/class/bot.priem.php deleted file mode 100644 index 058ccb5d..00000000 --- a/_incl_data/class/bot.priem.php +++ /dev/null @@ -1,516 +0,0 @@ -= 175 && $id <= 179 ) { self::priem175( $i ); } - - //********************************* - } - return true; - - } - - static function usePriem($id,$on = NULL) { - - //if(self::$p['id'] > 7 && self::$p['id'] < 11) { - //botLogic::e(botLogic::$bot['login'].', использую прием "'.self::$p['name'].'" , battle: Link'); - //} - - $go_txt = '&usepriem='.$id; - if( $on != '') { - $on = str_replace(' ','%20',$on); - $go_txt .= '&useon='.$on; - } - botLogic::inuser_go_btl( botLogic::$bot , $go_txt ); - } - //Ставка на опережение - static function priem220( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Разгадать тактику - static function priem217( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Обреченность - static function priem204( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Выжить - static function priem232( $i ) { - $su = true; - //Логика использования приема - if(self::hp() > 30 || rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Жажда крови - static function priem188( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Шок удар - static function priem235( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Хлебнуть крови - static function priem240( $i ) { - $su = true; - //Логика использования приема - //if(botLogic::$st['tactic2'] < 7 || botLogic::$st['tactic4'] < 3 || self::hp() > 70) { - if(self::hp() > 70) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Силовое поле - static function priem175( $i ) { - $su = true; - //Логика использования приема - /*if(botLogic::$st['hpNow'] >= botLogic::$st['hpAll']) { - $su = false; - }elseif(botLogic::$st['hpNow'] < 5) { - $su = false; - }elseif(rand(0,100) >= 50) { - $su = false; - }*/ - - if($su == true) { - self::usePriem( $i ); - } - } - - //Прикрыться - static function priem1( $i ) { - $su = true; - if(rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Вломить - static function priem2( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Собрать зубы - static function priem3( $i ) { - $su = true; - //Логика использования приема - /*if(botLogic::$st['hpNow'] >= botLogic::$st['hpAll']) { - $su = false; - }elseif(botLogic::$st['hpNow'] < 10) { - $su = false; - }elseif(isset(botLogic::$pr[1]) && botLogic::$pr[1] < 1) { - $su = false; - }*/ - if(self::hp() > 70 || rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Воля к победе - static function priem6( $i ) { - $su = true; - //Логика использования приема - if(self::hp() > 40 || rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Танец ветра - static function priem8( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Танец лезвий - static function priem48( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 70) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Дикая удача - static function priem9( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Слепая удача - static function priem47( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Предвиденье - static function priem10( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 30) { - $su = false; - } - if($su == true) { - self::usePriem( $i ); - } - } - //Второе дыхание - static function priem49( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 80 || self::hp() > 60) { - $su = false; - } - if($su == true) { - self::usePriem( $i ); - } - } - - //Рывок - static function priem223( $i ) { - $su = true; - //Логика использования приема - if(self::hp() > 50 || rand(0,100) >= 50) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Удачный удар - static function priem11( $i ) { - $su = true; - //Логика использования приема - //if(isset(botLogic::$pr[6]) && botLogic::$st['tactic7'] > 0 && self::hp() < 66 && botLogic::$st['tactic1'] < 14) { - if(rand(0,100) >= 30){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Стойкость - static function priem13( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 50){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - //Ярость - static function priem14( $i ) { - $su = true; - //Логика использования приема - if(rand(0,100) >= 50){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Сильный удар - static function priem4( $i ) { - $su = true; - //Логика использования приема - /*if(isset(botLogic::$pr[6]) && botLogic::$st['tactic7'] > 0 && self::hp() < 66 && botLogic::$st['tactic1'] < 14) { - $su = false; - }elseif((isset(botLogic::$pr[11]) || isset(botLogic::$pr[6])) && rand(0,100) <= 75) {*/ - if(rand(0,100) >= 60){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - //Утереть пот - static function priem5( $i ) { - $su = true; - //Логика использования приема - if(self::hp() > 95) { - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - - //Агрессивная защита - static function priem211( $i ) { - $su = true; - //Логика использования приема - - //if( rand(0,100) >= 80 || (isset(botLogic::$pr[7]) && botLogic::$pr[7] < 1) || (isset(botLogic::$pr[45]) && botLogic::$pr[45] < 1) || self::hp() > 80 ) { - if( rand(0,100) >= 80){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - - - //Полная защита - static function priem45( $i ) { - $su = true; - //Логика использования приема - - //if( rand(0,100) >= 60 || (isset(botLogic::$pr[7]) && botLogic::$pr[7] < 1) || (isset(botLogic::$pr[211]) && botLogic::$pr[211] < 1) || self::hp() > 80 ) { - if( rand(0,100) >= 50){ - $su = false; - } - - if($su == true) { - self::usePriem( $i ); - } - } - - - //Активная защита - static function priem7( $i ) { - //if (rand(0,100) >= 50){$su = true;}else{$su = false;} - - $su = true; - //Логика использования приема - /* Если есть абсолютная защита (агрессивную) и её возможно исопльзовать, а так-же НР менее 70% */ - //if( rand(0,100) >= 50 || (isset(botLogic::$pr[45]) && botLogic::$pr[45] < 1) || (isset(botLogic::$pr[211]) && botLogic::$pr[211] < 1) || self::hp() > 80 ) { - if(rand(0,100) >= 30) { - - $su = false; - - } - if($su == true) { - self::usePriem( $i ); - } - } - - - - - static function hp() { - $p = round((botLogic::$st['hpNow']/botLogic::$st['hpAll']*100),2); - return $p; - } - - //Тест на возможность использования - static function testpriem($pl) { - global $u; - $notr = 0; - - $tr = $u->lookStats($pl['tr']); - $d2 = $u->lookStats($pl['date2']); - - $x = 1; - while( $x <= 7 ) { - if(botLogic::$bot['tactic'.$x] < $pl['tt'.$x] && $x!=7 && $pl['tt'.$x] > 0) { - $notr++; - }elseif($x==7) { - if($pl['tt'.$x]>0 && botLogic::$bot['tactic'.$x]<=0) { - $notr++; - } - } - $x++; - } - - if($pl['xuse']>0) { - $xu = $u->testAction('`vars` = "use_priem_'.botLogic::$bot['battle'].'_'.botLogic::$bot['id'].'" AND `vals` = "'.$pl['id'].'" LIMIT '.$pl['xuse'].'',2); - if($xu[0] >= $pl['xuse']) { - $notr++; - } - } - - $x = 0; - $t = $u->items['tr']; - while($x < count($t)) - { - $n = $t[$x]; - if(isset($tr['tr_'.$n])) - { - if($n=='lvl') - { - if($tr['tr_'.$n] > botLogic::$bot['level']) - { - $notr++; - } - }elseif($tr['tr_'.$n] > botLogic::$st[$n]) - { - $notr++; - } - } - $x++; - } - - if(isset($tr['tr_mpNow'])) - { - if(botLogic::$st['mpNow'] < $tr['tr_mpNow']) - { - $notr++; - } - } - - if($pl['trUser']==1) - { - //требует чтобы пользователь с кем-то разменивался (при ожидании прием гаснит) - $ga = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "'.botLogic::$bot['battle'].'" AND `uid1` = "'.botLogic::$bot['id'].'" AND `uid2` = "'.botLogic::$bot['enemy'].'" LIMIT 1')); - if(isset($ga['id'])) - { - $notr++; - } - } - - //Если прием уже использовали - if(botLogic::$st['prsu'][$pl['id']]>0) { - $notr++; - } - - return $notr; - } - -} -?> \ No newline at end of file diff --git a/_incl_data/class/dealer.php b/_incl_data/class/dealer.php deleted file mode 100644 index 1dbd7fb1..00000000 --- a/_incl_data/class/dealer.php +++ /dev/null @@ -1,294 +0,0 @@ -п»їinit(); - die((($result))); - */ - - -class Model_PartnerProjects_GamedealerReq{ - private $allowIp = array( - '127.0.0.1' - ); - private $gamedealerkey = '12345677'; - var $projectid = 1; - - - - - function init(){ - - $ip = $_SERVER['REMOTE_ADDR']; - if(!in_array($ip,$this->allowIp))return $this->xml(array('status'=>-10,'desc'=>'ErrIP')); - - //рабочий режим - //$xml = file_get_contents('php://input'); - - //тестовый режим. Параметры: check_balance / pay / getpacages / check_login - $xml = $this->testxml('check_balance'); - - $result = $this->parse($xml); - - if(!is_object($result))return $this->xml(array('status'=>-50,'desc'=>'ErrorInitParse')); - - if(isset($result->method)){ - $methodname = 'gamedealer_'.(string)$result->method; - if(!method_exists($this, $methodname))return $this->xml(array('status'=>-20,'desc'=>'ErrMethod')); - try{ - - $resulttry = $this->$methodname($result); - return $this->xml($resulttry); - }catch(Exception $e){} - } - return $this->xml(array('status'=>-10,'desc'=>'MethodError '.$methodname.isset($e)?$e->getMessage():false)); - } - - - - private function _sign($method,$params=array()){ - - return md5(implode($params).$method.md5($this->gamedealerkey)); - } - - - - /*Генератор XML-ответа*/ - function xml($arr=false){ - header("Content-type: text/xml; charset=utf-8"); - - if(!$arr)$arr = array('status'=>-1,'desc'=>"ErrorXML"); - $xml = ''."\n"; - foreach($arr as $k => $v){ - $xml .= '<'.$k.'>'.""; - if(is_array($v)){ - - - foreach($v as $itemkey => $itemvalue){ - if(is_array($itemvalue)){ - $xml .= ' $itemvalue_v)$xml .= ' '.$itemvalue_k.'="'.$itemvalue_v.'" '; - $xml .= '>'."\n"; - }else{ - $xml .= '<'.$itemkey.'>'.$itemvalue.''."\n"; - } - } - }else { - $xml .= $v; - } - $xml .= ''."\n"; - - } - $xml .= ''; - return $xml; - } - - //проверка счета-акканта - function gamedealer_check_login($params){ - - - $bank = isset($params->nick)?(int)$params->nick:false; - $projectid = isset($params->projectid)?(int)$params->projectid:false; - $sign = isset($params->sign)?(string)$params->sign:false; - - $hash = $this->_sign('check_login',array($bank)); - if($sign!=$hash)return array('status'=>-10,'desc'=>'SignError'); - - $check = $this->checkLoginByBank($bank); - if(isset($check['login'])){ - return array('status'=>1,'desc'=>'Счет указан верно','addinfo'=>$check['login']); - } - - - return array('status'=>-100,'desc'=>'Ошибка проверки счета'); - } - - - //запрос РЅР° оплату - function gamedealer_pay($params){ - - - - - $bank = isset($params->nick)?(int)$params->nick:false; - - $projectid = isset($params->projectid)?(int)$params->projectid:false; - $sign = isset($params->sign)?(string)$params->sign:false; - $paymentid = isset($params->payid)?(int)$params->payid:false; // уникальный номер платежа - $amount = isset($params->amount)?number_format((float)$params->amount,'2','.',''):false; //СЃСѓРјРјР° РІ РёРіСЂРѕРІРѕР№ валюте - $pacageid = isset($params->pacageid)?(int)$params->pacageid:''; //идентификатор РїРѕРєСѓРїРєРё опции РІ ГД. если нету - платеж РЅР° счет юзера - $partneritemid = isset($params->partneritemid)?(int)$params->partneritemid:''; //идентификатор продукта РІ вашей системе - $additemid = isset($params->additemid)?(int)$params->additemid:''; //дополнительный идентификатор пакета - $paymethodid = isset($params->paymethodid)?(string)$params->paymethodid:false; //метод оплаты РїРѕ системе геймдилер // может быть пустым) - - - - $hash = $this->_sign('pay',array($bank,$projectid.$pacageid.$amount,$paymentid)); - if($sign!=$hash)return array('status'=>-10,'desc'=>'SignError'); - - if($amount<0.01)return array('status'=>-20,'desc'=>'СЃСѓРјРјР° слишком маленькая'); - - $check = $this->checkLoginByBank($bank); - if(!isset($check['login']))return array('status'=>-10,'desc'=>'Ошибка логина. счет неверный'); //логин перса добываем - - return $this->oldbk_dopayment($paymentid,$bank,$projectid,$pacageid,$partneritemid,$amount,$check['login'],$additemid); - - } - - function gamedealer_check_balance($params){ - $projectid = isset($params->projectid)?(int)$params->projectid:false; - $sign = isset($params->sign)?(string)$params->sign:false; - $method = 'check_balance'; - - if($sign != $this->_sign($method,array('projectid'=>$projectid)))return array('status'=>-10,'desc'=>"errSign"); - $balance = 500; - return array('status'=>1,'desc'=>"Balance: ".$balance,'balance'=>$balance); //баланс РІ РёРіСЂРµ - } - - function gamedealer_getpacages($params){ - $sign = isset($params->sign)?(string)$params->sign:false; - $projectid = isset($params->projectid)?(int)$params->projectid:false; - $method = 'getpacages'; - - - if($sign != $this->_sign($method,array('projectid'=>$projectid)))return array('status'=>-10,'desc'=>"errSign"); - - return array( - 'status'=>1, - 'desc'=>'РЎРїРёСЃРѕРє СЃРЅРёР·Сѓ :)', - 'pacages'=>array( - array( - 'title'=>'Название сильвера', - 'price'=>20, - 'partneritemid'=>1 //РёРґ РІ системе РёРіСЂС‹ - ), - - array( - 'title'=>'Название сильвера 2', - 'price'=>20, - 'partneritemid'=>1 //РёРґ РІ системе РёРіСЂС‹ - ), - ) - ); - } - - - - function parse($xml){ - try{ - return simplexml_load_string($xml); - }catch(Exception $e){ - return false; - } - } - - - - - - - - - //тестовый интерфейс - function testxml($method='check_login'){ - switch($method){ - case 'check_login': - $nick = 243; - - - return ' - - check_login - '.$nick.' - 1 - '.md5($nick.$method.md5($this->gamedealerkey)).' - '; - break; - - - case 'pay': - $amount= 0.01; - $nick = 243; - $projectid = 1; - $payid = 112222; - - //$bank,$projectid.$pacageid.$amount,$paymentid - #echo "$nick.$projectid.$amount.$payid.$method"; - $sign = md5($nick.$projectid.$amount.$payid.$method.md5($this->gamedealerkey)); - - return ' - - pay - '.$nick.' - '.$projectid.' - '.$amount.' - '.$payid.' - '.$sign.' - '; - - break; - - case 'getpacages': - //СЃРїРёСЃРѕРє пакетов - - return ' - - 1 - '.$method.' - '.md5('1'.$method.md5($this->gamedealerkey)).' - '; - break; - - case 'check_balance': - //баланс - - return ' - - 1 - '.$method.' - '.md5('1'.$method.md5($this->gamedealerkey)).' - '; - break; - } - } - - - - - //прием оплаты - private function oldbk_dopayment($paymentid,$bank,$projectid,$pacageid,$partneritemid,$amount,$login,$additemid){ - //$additemid - дополнительный дентификатор пакета. например - ID клана - //если оплата РЅР° клан - projectid = 20099 // pacageid = 25 //partneritemid = 1 (РІ вашей системе)// additemid = 5 //идентификатор клана - //если пакеты - if($pacageid){ - //если РїРѕРєСѓРїРєР° билетов - то количество = amount/price РЅСѓ Рё там округлять, остаток РЅР° счет. - return array('status'=>1,'desc'=>'Сильвер аккаунт успешно оплачен','paymentid'=>1); //уникальный номер платежа РІ системе проекта. - - }else{ - //просто оплата РЅР° баланс РїРѕ счету - return array('status'=>1,'desc'=>'Счет попонен','paymentid'=>1); //уникальный номер платежа РІ системе проекта. - //или - return array('status'=>3,'desc'=>'Аккаунт уже оплачен СЃ таким payid','paymentid'=>1);//уникальный номер платежа РІ системе проекта. - } - - return array('status'=>-10,'desc'=>'Ошибка РїРѕРёСЃРєР° карты/сильвера Рё С‚.Рї. или СЃСѓРјРјР° РЅРµ та'); - - - } - - - //проверка счета - function checkLoginByBank($bank){ - return array('status'=>1,'desc'=>'Bank exissts','login'=>'Администратор'); - } - - - -} -?> \ No newline at end of file diff --git a/_incl_data/class/dialog.class.php b/_incl_data/class/dialog.class.php deleted file mode 100644 index 4e34c5c1..00000000 --- a/_incl_data/class/dialog.class.php +++ /dev/null @@ -1,1501 +0,0 @@ -0,1=>0); - $i = floor($x/$j); - $r = array(0=>$i,1=>$x-($i*$j)); - return $r; - } - - public function objLevel($t,$l) - { - $i = 1; - $r = 0; - while($i<=$l) - { - if(isset($t[$i])) - { - $r = $t[$i]; - } - $i++; - } - return $r; - } - - public function start($id) - { - global $u,$q,$c,$d,$code; - $this->info = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dialog` WHERE `id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1')); - if(isset($this->info['id'])) - { - $pg = 1; - $go = 1; - $txt = ''; - //Переход по страницам - if(isset($_GET['act'])) - { - $ta = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `id` = "'.mysql_real_escape_string((int)$_GET['act']).'" AND `id_dg` = "'.$this->info['id'].'" LIMIT 1')); - if(isset($ta['id'])) - { - $ta['action'] = $this->ltr($ta['action']); - $act = explode('|',$ta['action']); - $go1 = 1; - $needRep = array(); - if($ta['tr'] != '') { - $i = 0; - $x = explode('|',$ta['tr']); - while($i < count($x)) { - //Требования - $k = explode('=',$x[$i]); - if($k[0]=='data') { - $date = explode('-',$k[1]); - $dd1 = $date[0]; - $mm1 = $date[1]; - $dd2 = $date[2]; - $mm2 = $date[3]; - $date1 = strtotime($dd1.'-'.$mm1.'-'.date('Y')); - $date2 = strtotime($dd2.'-'.$mm2.'-'.date('Y')); - - if( $date1 > time() || $date2 < time() ) { - $go1 = 'delete'; - $i = count($x); - } - - }elseif($k[0]=='diact') { - //Действия - //user_id # all # all # lukaqst1 # -1 - if($this->quest_act($k[1])==false) { - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='quest_end') { - //Квест можно выполнять несколько раз в текущей пещере - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { - $go1 = 0; - $txt .= '
    Что-то не так, Вы уже взяли данное задание...'; - $pg = $ta['page']; - } - }elseif($k[0]=='quest_only_one') { - //Квест можно выполнять только один раз - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) { - $go1 = 0; - $txt .= '
    Что-то не так, Вы уже выполняли данное задание...'; - $pg = $ta['page']; - } - }elseif($k[0]=='quest_now') { - //Квест должен быть взят - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad'){}else{ - $go1 = 0; - $txt .= '
    Что-то не так, требуется взять задание...'; - $pg = $ta['page']; - } - }elseif($k[0]=='tr_itm') { - //Квест требует предмет - $qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if($qlst[0] < $k[2]){ - $go1 = 0; - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1')); - if(isset($itmqs['id'])) { - $txt .= '
    Требуется предмет "'.$itmqs['name'].'" (x'.$k[2].').'; - } - $pg = $ta['page']; - } - }elseif($k[0]=='tr_itmodet') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(!isset($qlst['id'])){ - $go1 = 0; - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1')); - if(isset($itmqs['id'])) { - $txt .= '
    Требуется предмет "'.$itmqs['name'].'".'; - } - $pg = $ta['page']; - } - }elseif($k[0]=='tr_noitmodet') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($qlst['id'])){ - $go1 = 0; - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1')); - if(isset($itmqs['id'])) { - $txt .= '
    У вас уже есть требуемый предмет "'.$itmqs['name'].'".'; - } - $pg = $ta['page']; - } - }elseif($k[0]=='tr_noitm') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($qlst['id'])){ - $go1 = 0; - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1')); - if(isset($itmqs['id'])) { - $txt .= '
    У вас уже есть требуемый предмет "'.$itmqs['name'].'".'; - } - $pg = $ta['page']; - } - }elseif($k[0]=='del_itm') { - //Квест удаляет предмет - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($qlst['id'])){ - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1')); - if(isset($itmqs['id'])) { - if(mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$qlst['id'].'" LIMIT 1')) { - $txt .= '
    Вы отдали "'.$itmqs['name'].'"'; - } - } - $pg = $ta['page']; - } - } elseif( $k[0] == 'needRep' ) { - // разговор требует репутации в пещере. - $temp = explode(',', $k[1]); - $needRep = array('city' => $temp[0], 'rep' => (int)$temp[1]); - if( isset($needRep) ) { # Проверяем репутацию. - if($u->rep['rep'.$needRep['city']] < $needRep['rep'] ) { - $swapActStatus = 0; - $go1 = 0; - $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; - $pg = $ta['page']; - } - } - } - $i++; - } - } - if(isset($act[1]) && $go1 == 1){ - $act1 = explode('=',$act[1]); - $act0 = explode('=',$act[0]); - if( $act0[0] == 'fileqst' ) { - if(file_exists('_incl_data/class/quest/'.htmlspecialchars($act0[1]).'.php')) { - require_once('_incl_data/class/quest/'.htmlspecialchars($act0[1]).'.php'); - }else{ - $txt .= '
    Квест не найден в списках NPS...'; - } - $pg = $act[1]; - }elseif( $act[0]=='dialog_act_update') { - $act33 = $this->dialog_act_update($act[2]); - if( $act33[0] == false ) { - if( $act33[1] == '' ) { - $txt .= '
    Что-то пошло не так...'; - }else{ - $txt .= '
    '.$act33[1].''; - } - }else{ - $txt .= '
    '.$act33[1].''; - } - $pg = $act[1]; - }elseif( $act[0]=='quest_act' ) { - $txt .= '
    Вы получили новое задание.'; - mysql_query('INSERT INTO `dialog_act` ( - `uid`,`city`,`time`,`var`,`val`,`btl_bot`,`itms`,`now`,`max`,`info` - ) VALUES ( - "'.$u->info['id'].'","'.$u->info['city'].'","'.time().'","'.mysql_real_escape_string($act1[0]).'","'.mysql_real_escape_string($act1[1]).'" - ,"'.mysql_real_escape_string($act1[3]).'","'.mysql_real_escape_string($act1[4]).'","'.mysql_real_escape_string($act1[5]).'","'.mysql_real_escape_string($act1[6]).'","'.mysql_real_escape_string($act1[7]).'" - )'); - $pg = $act1[2]; - if( $act1[8] != 0 ) { - //Выдаем предмет для квеста - $itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$act1[8].'" LIMIT 1')); - if(isset($itmb['id'])) { - $u->addItem($act1[8],$u->info['id'],'|nodelete=1'); - $txt .= '
    Вы получили предмет "'.$itmb['name'].'"'; - } - } - }elseif( $act[0]=='buyitm' ) { - $itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$act1[0].'" LIMIT 1')); - if(isset($itmb['id'])) { - if( $u->info['money'] < $act1[1] ) { - $txt .= '
    Вам не хватает денег для покупки "'.$itmb['name'].'", требуется '.$act1[1].' кр.'; - }else{ - $act1dt = ''; - $txt .= '
    Вы успешно приобрели "'.$itmb['name'].'"'; - if($act1[1] > 0) { - $txt .= ' за '.$act1[1].' кр.'; - $u->info['money'] -= $act1[1]; - mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - if($act1[2] > 0) { - $txt .= ' за '.$act1[2].' екр.'; - } - if( $act1[3] > 0 ) { - $txt .= ' на срок '.$u->timeOut($act1[3]).''; - $act1dt .= '|srok='.$act1[3].''; - } - $txt .= ''; - - $u->addItem($itmb['id'],$u->info['id'],$act1dt); - $pg = $act1[4]; - } - }else{ - $txt .= '
    Неудалось приобрести предмет...'; - $pg = 1; - } - }elseif( $act1[0]=='quest' ) { - $pg = $act1[1]; - $act2 = explode('=',$act[1]); - if($act2[0] > 0 && $q->testGood($act2[0])==1) { - //выдаем квест - if($act2[1]!='0') { - //Выдача предмета - $ic1 = 0; - $act21 = explode(',',$act2[1]); - while($ic1 < count($act21)) { - $act3 = explode('-',$act21[$ic1]); - $itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$act3[0].'" LIMIT 1')); - if(isset($itmqs['id'])) { - if($act3[2] > 1) { - //несколько - $txt .= '
    Вы получили предмет "'.$itmqs['name'].'" (x'.$act3[2].' шт.).'; - }else{ - //один - $txt .= '
    Вы получили квестовый предмет "'.$itmqs['name'].'".'; - } - $ic2 = 1; - while($ic2 <= $act3[2]) { - $u->addItem($itmqs['id'],$u->info['id'],'|quest_item=1',array('del'=>$act3[3])); - $ic2++; - } - } - $ic1++; - } - } - $q->startq($act2[0]); - $txt .= '
    '.$u->error.'.'; - $u->error = ''; - } else { - $txt .= '
    Не удалось получить задание, не соответствуют условия получения...'; - } - } elseif($act[0]=='go' && $go1 == 1) { - $pg = $act[1]; - } elseif($act[0]=='atackbot' && $go1 == 1) { - //Нападение на монстра - if( round((int)$act[1]) > 0 ) { - $btl_id = 0; - //$expB = -77.77; - $expB = 0; - $btl = array( - 'players'=>'', - 'timeout'=>180, - 'type'=>0, - 'invis'=>0, - 'noinc'=>0, - 'travmChance'=>0, - 'typeBattle'=>0, - 'addExp'=>$expB, - 'money'=>0 - ); - - $ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( - "'.$d->info['id2'].'", - "'.$d->info['id'].'", - "'.$u->info['x'].'", - "'.$u->info['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(); - - if($btl_id > 0) { - //Добавляем ботов - $k = $u->addNewbot(round((int)$act[1]),NULL,NULL,array()); - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `x`="'.$u->info['x'].'",`y`="'.$u->info['y'].'",`team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - - } - header('location: main.php'); - }else{ - echo 'Поединок почему-то не начался...'; - } - die(); - } elseif($act[0]=='goroom' && $go1 == 1) { - $u->info['room'] = $act[1]; - mysql_query('UPDATE `users` SET `room` = "'.$u->info['room'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - header('location: main.php'); - die(); - } elseif($act[0]=='transfer2' && $go1 == 1) { - //Обменник тыквоголового - $txt = ''; - - $xtik = 0; //Требуется тыкв - - if( $act[1] == 1 && true == false ) { - $txt .= 'Обмен 1...'; - $xtik = 10; - $itik = 4465; - - }elseif( $act[1] == 2 ) { - $txt .= 'Обмен 2...'; - $xtik = 15; - $itik = 2143; - - }elseif( $act[1] == 3 ) { - $txt .= 'Обмен 3...'; - $xtik = 15; - $itik = 2144; - - }elseif( $act[1] == 4 && true == false ) { - $txt .= 'Обмен 4...'; - $xtik = 6; - //арт воина - $itik = -1; - - }elseif( $act[1] == 5 && true == false ) { - $txt .= 'Обмен 5...'; - $xtik = 6; - //арт мага - $itik = -2; - - }elseif( $act[1] == 6 ) { - $txt .= 'Обмен 6...'; - $xtik = 50; - //значок 1 - $itik = -3; - - }elseif( $act[1] == 7 ) { - $txt .= 'Обмен 7...'; - $xtik = 70; - //значок 2 - $itik = -4; - - }else{ - $txt .= 'Тыквоголовый не меняет этот хлам...'; - } - - $txt = 'Обменник начнет свою работу 3 ноября'; - - $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - - $t = $this->trnObj($itms[4504],$xtik); - if($t[0] > 0) { - // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды - //удаляем ингридиенты - - $gdtik = 1; - - if( $gdtik == 1 ) { - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" ORDER BY `inGroup` ASC LIMIT '.$xtik.''); - //echo 'UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.$t[0].''; - if($upd) { - if( $itik > 0 ) { - //Выдаем предметы - $u->addItem($itik,$u->info['id'],'|nosale=1|srok='.(7*86400).'',NULL,1); - $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$itik.'" LIMIT 1')); - $txt = 'Вы получили предмет "'.$itm_nm['name'].'"'; - }else{ - //Что-то уникальное - if( $itik == -1 ) { - //Артефакт воин - $arts_1 = array(); - $arts_lvl = $u->info['level']; - if( $arts_lvl < 4 ) { - $arts_lvl = 4; - }elseif( $arts_lvl > 10 ) { - $arts_lvl = 10; - } - $sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl='.$arts_lvl.'%" AND `data` NOT LIKE "%|tr_s5=%" AND `data` NOT LIKE "%|add_s6=%" AND `data` NOT LIKE "%|tr_s6=%"'); - while( $pl1 = mysql_fetch_array($sp1) ) { - $arts_1[] = $pl1['items_id']; - } - $arts_1 = $arts_1[rand(0,count($arts_1)-1)]; - if( $arts_1 > 0 ) { - $u->addItem($arts_1,$u->info['id'],'|sroknext=1|nosale=1|sleep_moroz=1|srok='.(86400/2).'',NULL,100); - } - $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$arts_1.'" LIMIT 1')); - - $txt = 'Вы получили артефакт для воина "'.$itm_nm['name'].'" на срок 12 часов.'; - }elseif( $itik == -2 ) { - //Артефакт мага - $arts_1 = array(); - $arts_lvl = $u->info['level']; - if( $arts_lvl < 4 ) { - $arts_lvl = 4; - }elseif( $arts_lvl > 10 ) { - $arts_lvl = 10; - } - $sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl='.$arts_lvl.'%" AND ( `data` LIKE "%|tr_s6=%" OR `data` LIKE "%|add_s6=%")'); - while( $pl1 = mysql_fetch_array($sp1) ) { - $arts_1[] = $pl1['items_id']; - } - $arts_1 = $arts_1[rand(0,count($arts_1)-1)]; - if( $arts_1 > 0 ) { - $u->addItem($arts_1,$u->info['id'],'|sroknext=1|nosale=1|sleep_moroz=1|srok='.(86400/2).'',NULL,100); - } - $itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$arts_1.'" LIMIT 1')); - - $txt = 'Вы получили артефакт для мага "'.$itm_nm['name'].'" на срок 12 часов.'; - }elseif( $itik == -3 ) { - //Значок +1 - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "'.$u->info['id'].'" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")'); - mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "Хэллоуин`'.date('Y').'
    Обыкновенный собиратель тыкв!", - "helloween_2014m1.gif", - "'.(time()+86400*365).'", - "add_m10=15|add_m11=15", - "1", - "1" - )'); - $txt = 'Вы получили значок "Хэллоуин`'.date('Y').' Обыкновенный"'; - }elseif( $itik == -4 ) { - //Значок +5 - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "'.$u->info['id'].'" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")'); - mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "Хэллоуин`'.date('Y').'
    Лучший собиратель тыкв!", - "helloween_2014m2.gif", - "'.(time()+86400*365).'", - "add_m10=15|add_m11=15", - "1", - "1" - )'); - $txt = 'Вы получили значок "Хэллоуин`'.date('Y').' Лучший"'; - } - } - } - }else{ - $txt = 'Неудалось совершить обмен...'; - } - }else{ - $txt = 'Недостаточно тыкв для обмена...'; - } - - if($txt!=''){ - $txt = '
    '.$txt.''; - } - $pg = 3; - } elseif($act[0]=='transfer1' && $go1 == 1) { - //Меняем гайки и прочий мусор из канализации на жетоны - //ИХ больше у тебя нету... Неси еще, Луке нужно больше ИХ! - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "1002" OR `item_id` = "1003" OR `item_id` = "1004" OR `item_id` = "1005" OR (`item_id` >= "1009" AND`item_id` <= "1014")) AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - //Предметы - $cn = array( - 0 => 3, //кол-во классификаций - 1 => array( - //гайка - 1 => array('n'=>'Гайка',0=>1002,1=>3,7=>9,8=>15), - //болт - 2 => array('n'=>'Болт',0=>1003,1=>1,7=>3,8=>5), - //вентиль - 3 => array('n'=>'Вентиль',0=>1005,1=>(1/3),7=>1,8=>2), - 'add' => array(0=>1006,1=>'Жетон') //предмет вознаграждения, бронзовый жетон - ), //бронза - 2 => array( - //гайка - 1 => array('n'=>'Чистая гайка',0=>1009,1=>3,7=>9,8=>15), - //болт - 2 => array('n'=>'Длинный Болт',0=>1010,1=>1,7=>3,8=>5), - //вентиль - 3 => array('n'=>'Чистый вентиль',0=>1011,1=>(1/3),7=>1,8=>2), - 'add' => array(0=>1007,1=>'Серебряный жетон') //предмет вознаграждения, бронзовый жетон - ), //серебро - 3 => array( - //гайка - 1 => array('n'=>'Гайка с Резьбой',0=>1012,1=>3,7=>9,8=>15), - //болт - 2 => array('n'=>'Нужный болт',0=>1013,1=>1,7=>3,8=>5), - //вентиль - 3 => array('n'=>'Рабочий вентиль',0=>1014,1=>(1/3),7=>1,8=>2), - 'add' => array(0=>1008,1=>'Золотой жетон') //предмет вознаграждения, бронзовый жетон - ) //золото - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($jtrnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level'])); - if($t[0]>0) - { - // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды - //удаляем ингридиенты - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i]['add'][0],$u->info['id'],$data); - $e++; - } - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'
    '; - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - } - $j++; - } - $i++; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - } elseif($act[0]=='transfer3' && $go1 == 1) { - //ИХ больше у тебя нету... Неси еще, Луке нужно больше ИХ! - //Серебро на золото, 3 к 1 - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "1007" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - //Предметы - $cn = array( - 0 => 1, //кол-во классификаций - 1 => array( - //гайка - 1 => array('n'=>'Серебряный жетон',0=>1007,1=>3,7=>3,8=>3), - 'add' => array(0=>1008,1=>'Золотой жетон') //предмет вознаграждения, бронзовый жетон - ) - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($jtrnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level'])); - if($t[0]>0) - { - // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды - //удаляем ингридиенты - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i]['add'][0],$u->info['id'],$data); - $e++; - } - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'
    '; - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - } - $j++; - } - $i++; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - } elseif($act[0]=='transfer4' && $go1 == 1) { - //ИХ больше у тебя нету... Неси еще, мне нужно больше ИХ! - //Засоры к золоту, 20 к 1 - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4728" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - //Предметы - $cn = array( - 0 => 1, //кол-во классификаций - 1 => array( - //гайка - 1 => array('n'=>'Засоры',0=>4728,1=>20,7=>20,8=>20), - 'add' => array(0=>1008,1=>'Золотой жетон') //предмет вознаграждения, бронзовый жетон - ) - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($jtrnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level'])); - if($t[0]>0) - { - // $t[0] - сколько предметов награды даем, $cn[$i]['add'][0] - item_id предмета награды - //удаляем ингридиенты - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i]['add'][0],$u->info['id'],$data); - $e++; - } - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'
    '; - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - } - $j++; - } - $i++; - } - - if( $txt == '' ) { - $txt = 'Необходимо минимум 20 засоров для обмена.'; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - }elseif($act[0]=='transferSpells30' && $go1 == 1) { - - //2553 2554 - - $keypr1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2553" LIMIT 1')); - $keypr2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2554" LIMIT 1')); - - $txt = ''; - - if(isset($keypr1['id'],$keypr2['id'])) { - mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr1['id'].'" OR `id` = "'.$keypr2['id'].'" LIMIT 2'); - $data = '|frompisher='.$d->info['id2']; - $u->addItem(2555,$u->info['id'],$data); - $txt = 'Вы успешно получили "Пирамидальный ключ"'; - } - - if( $txt == '' ) { - $txt = 'Необходимо принести два разных осколка...'; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - - }elseif($act[0]=='transferSpells31' && $go1 == 1) { - - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2560" OR `item_id` = "2564" OR `item_id` = "2568" OR `item_id` = "2572" OR `item_id` = "2576") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - - $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); - if(!isset($keypr['id'])) { - $itms = array(); - $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; - } - - //Предметы - $cn = array( - 0 => 5, //кол-во классификаций - 1 => array( - 1 => array('n'=>'Зачаровать Украшение [0]',0=>2560,8=>3,'add'=>array(2561,'Зачаровать Украшение [1]')), - 2 => array('n'=>'Зачаровать Оружие [0]',0=>2564,8=>3,'add'=>array(2565,'Зачаровать Оружие [1]')), - 3 => array('n'=>'Зачаровать Броню [0]',0=>2568,8=>3,'add'=>array(2569,'Зачаровать Броню [1]')), - 4 => array('n'=>'Зачаровать Перчатки [0]',0=>2572,8=>3,'add'=>array(2573,'Зачаровать Перчатки [1]')), - 5 => array('n'=>'Зачаровать Шлем [0]',0=>2576,8=>3,'add'=>array(2577,'Зачаровать Шлем [1]')) - ) - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($j<=$cn[0]) - { - $t = $cn[$i][$j]; - $t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8)); - if($t[0]>0) - { - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data); - $e++; - } - mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1'); - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'
    '; - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - $i = $cn[0]; - $j = count($cn[$i][$j]); - } - $j++; - } - $i++; - } - - if( $txt == '' ) { - $txt = 'У вас не хватило необходимых предметов...'; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - - }elseif($act[0]=='transferSpells32' && $go1 == 1) { - - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2561" OR `item_id` = "2565" OR `item_id` = "2569" OR `item_id` = "2573" OR `item_id` = "2577") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - - $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); - if(!isset($keypr['id'])) { - $itms = array(); - $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; - } - - //Предметы - $cn = array( - 0 => 5, //кол-во классификаций - 1 => array( - 1 => array('n'=>'Зачаровать Украшение [1]',0=>2561,8=>3,'add'=>array(2562,'Зачаровать Украшение [2]')), - 2 => array('n'=>'Зачаровать Оружие [1]',0=>2565,8=>3,'add'=>array(2566,'Зачаровать Оружие [2]')), - 3 => array('n'=>'Зачаровать Броню [1]',0=>2569,8=>3,'add'=>array(2570,'Зачаровать Броню [2]')), - 4 => array('n'=>'Зачаровать Перчатки [0]',0=>2573,8=>3,'add'=>array(2574,'Зачаровать Перчатки [2]')), - 5 => array('n'=>'Зачаровать Шлем [1]',0=>2577,8=>3,'add'=>array(2578,'Зачаровать Шлем [2]')) - ) - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($j<=$cn[0]) - { - - $t = $cn[$i][$j]; - $t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8)); - if($t[0]>0) - { - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data); - $e++; - } - mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1'); - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'
    '; - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - $i = $cn[0]; - $j = count($cn[$i][$j]); - } - $j++; - } - $i++; - } - - if( $txt == '' ) { - $txt = 'У вас не хватило необходимых предметов...'; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - - }elseif($act[0]=='transferSpells33' && $go1 == 1) { - - $pg = $act[1]; $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2562" OR `item_id` = "2566" OR `item_id` = "2570" OR `item_id` = "2574" OR `item_id` = "2578") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - - $keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1')); - if(!isset($keypr['id'])) { - $itms = array(); - $txt = 'Необходим "Пирамидальный ключ", у вас его нет...'; - } - - //Предметы - $cn = array( - 0 => 5, //кол-во классификаций - 1 => array( - 1 => array('n'=>'Зачаровать Украшение [0]',0=>2562,8=>3,'add'=>array(2563,'Зачаровать Украшение [3]')), - 2 => array('n'=>'Зачаровать Оружие [0]',0=>2566,8=>3,'add'=>array(2567,'Зачаровать Оружие [3]')), - 3 => array('n'=>'Зачаровать Броню [0]',0=>2570,8=>3,'add'=>array(2571,'Зачаровать Броню [3]')), - 4 => array('n'=>'Зачаровать Перчатки [0]',0=>2574,8=>3,'add'=>array(2575,'Зачаровать Перчатки [3]')), - 5 => array('n'=>'Зачаровать Шлем [0]',0=>2578,8=>3,'add'=>array(2579,'Зачаровать Шлем [3]')) - ) - ); - - $i = 1; - while($i<=$cn[0]) - { - $j = 1; - while($j<=$cn[0]) - { - - $t = $cn[$i][$j]; - $t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8)); - if($t[0]>0) - { - $upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).''); - if($upd) - { - $data = '|frompisher='.$d->info['id2']; - $e = 1; - while($e<=$t[0]) - { - $u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data); - $e++; - } - $txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'
    '; - mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1'); - }else{ - $txt .= 'Не удалось обменять предмет "'.$cn[$i][$j]['n'].'", что-то не так ...
    '; - } - $i = $cn[0]; - $j = count($cn[$i][$j]); - } - $j++; - } - $i++; - } - - if( $txt == '' ) { - $txt = 'У вас не хватило необходимых предметов...'; - } - - if($txt!='') { - $txt = '
    '.$txt.''; - } - - }elseif( $act[0] == 'GoHrumpShop' && $go1 == 1) { //отправляемся в магазин Рульфа Хрумпта (пещеры мглы) - mysql_query('UPDATE `stats` SET `x` = "6",`y` = "73" WHERE `id` = "'.$u->info['id'].'" AND `dnow` = "'.$u->info['dnow'].'" LIMIT 1'); - header('location: main.php'); - die(); - }elseif( $act[0] == 'swapItem' && $go1 == 1) { - $txt = ''; - $swapItem = $act[1]; - $swapError = $act[2]; - $swapTrue = $act[3]; - # Обмениваем предметы у Забытого (Мастерская Забытых) - if( !isset($swapActStatus) ) $swapActStatus = 1; # Все окей, проблем нет! - $swapAct = array(); # Собираем данные об обмене. - $temp = explode ("\\", $swapItem); - foreach ( $temp as $t ) { - $t = explode('=', $t); - if( $t[0] == 'tr' ) { // Нужны для обмена - $temp2 = explode(',', $t[1]); $tr_items = array(); - foreach( $temp2 as $t2 ) { - $temp3 = explode('x', $t2); - if( !isset($temp3[1]) ) $temp3[1] = 1; // Если количество не задано, задаем 1ед. - if( isset($temp3[2]) && $temp3[2]=='del' ) $temp3[2] = true; else $temp3[2]=false; // Удаляем даже при неудачной попытке совершить обмен! - $tr_items[] = array('item_id' => $temp3[0], 'colvo' => (int)$temp3[1], 'delete' => $temp3[2]); - } - $swapAct['tr'] = $tr_items; - - } elseif( $t[0] == 'needQuest' ){ // Если нужен какой-то квест для приобретения. - - } elseif( $t[0] == 'needRep' ){ // Если нужна репутация в подземельи - $temp2 = explode(',', $t[1]); $need_rep = array(); - $need_rep[] = array('city' => $temp2[0], 'rep' => (int)$temp2[1]); - - $swapAct['need_rep'] = $need_rep; - - } elseif( $t[0] == 'add' ){ // Какие предметы даем. - $temp2 = explode(',', $t[1]); $add_items = array(); - foreach($temp2 as $t2) { - $temp3 = explode('x', $t2); - if( !isset($temp3[1]) ) $temp3[1] = 1; // Если количество не задано, задаем 1ед. - $add_items[] = array('item_id' => $temp3[0], 'colvo' => (int)$temp3[1]); - } - $swapAct['add'] = $add_items; - } elseif( $t[0] == 'uses' ){ // Если нужна репутация в подземельи - $swapAct['uses'] = $t[1]; - } - } // Цикл обработки данных разговора. - unset($temp,$temp2,$temp3,$t2,$tr_items,$add_items); - - if( $swapActStatus == 0 ) { - $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; - $pg = $swapError; - } elseif ( isset($swapAct['need_rep']) ) { # Проверяем репутацию. - foreach($swapAct['need_rep'] as $rep) { # Если несколько репутаций - if($u->rep['rep'.$rep['city']] < $rep['rep'] ) { - $swapActStatus = 0; - $txt = 'Я тебя раньше здесь не видел, уходи прочь негодник!'; - $pg = $swapError; - } - } - } - - if( isset($swapAct['uses']) ) { # Проверяем количество раз использований. - #$swapAct['uses'] = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `room` = "'.$u->info['room'].'" AND `vals` = "masteryUses'.$u->info['dnow'].'" ORDER BY `id` DESC LIMIT '.$swapAct['uses'] .'')); - if( isset($swapAct['uses']['id']) ) { - $swapActStatus = 0; - $txt = 'Кто-то уже побывал здесь и испортил кузницу, ничего не получится...'; - $pg = 0; - } - } - - if( isset($swapAct['tr']) AND $swapActStatus == 1 ) { # Проверяем необходимые предметы. - foreach($swapAct['tr'] as $item) { # Если несколько предметов. - $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1')); - if( isset($item_info['id']) ) { - $query = mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" LIMIT '.$item['colvo'].''); - $j=0; - while( $t = mysql_fetch_array($query) ) { - $j++; - } - if( $j < $item['colvo'] ) { - $txt .= 'У вас недостаточно предметов "'.$item_info['name'].'"! ('.$item['item_id'].')
    '; - $swapActStatus = 3; - $pg = $swapError; - } elseif( $swapActStatus != 3) { - $swapActStatus = 2; - } - } - } - } - - if( isset($swapAct['tr']) AND $swapActStatus == 3 ) { # Забираем предметы del==true. - $mess = 'Израсходованы ресурсы: '; - $qsw = 0; - foreach($swapAct['tr'] as $item) { # Если несколько предметов. - if ( $item['delete'] == true ){ - $query = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT '.$item['colvo'].''); - if($query){ - $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1')); - if( $qsw > 0 ) $mess .=', '; - $mess .= '"'.$item_info['name'].'"'; - if( $item['colvo'] > 1 ) $mess .= '('.$item['item_id'].'шт)'; - $qsw++; - } - } - } - $mess .= '.
    '; - if( $qsw > 0 ) $txt .= $mess; - } elseif( isset($swapAct['tr']) AND $swapActStatus == 2 ) { # Забираем предметы все. - $mess = 'Израсходованы ресурсы: '; - $qsw = 0; - foreach($swapAct['tr'] as $item) { - $query = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT '.$item['colvo'].''); - if($query) { - $item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1')); - if( $qsw > 0 ) $mess .=', '; - $mess .= '"'.$item_info['name'].'"'; - if( $item['colvo'] > 1 ) $mess .= '('.$item['item_id'].'шт)'; - $qsw++; - } - } - $mess .= '.
    '; - if( $qsw > 0 ) $txt .= $mess; - } - - if( isset($swapAct['add']) AND $swapActStatus == 2 ) { # Выдаем предметы. - foreach($swapAct['add'] as $item) { - $qsw = 0; - while($qsw < $item['colvo']) { - $txt .= '
    Вы получили предмет'; - $u->addItem($item['item_id'],$u->info['id']); - $qsw++; - } - } - - mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("'.$u->info['id'].'","'.time().'","'.$u->info['city'].'","'.$u->info['room'].'", "","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'", "masteryUses'.$u->info['dnow'].'")'); - $pg = $swapTrue; - } - if( $txt != '' ) { - $txt = '
    '.$txt.''; - } - } - } - } - } - - if($this->info['tr_room']!=0 && $this->info['tr_room']!=$u->info['room']) - { - $go = 0; - } - - if($this->info['tr_dn']!=0) { - //требует пещеру - global $d; - if($this->info['tr_dn']!=$d->info['id2']) - { - $go = 0; - }elseif($this->info['x']!=0 || $this->info['y']!=0) - { - if($d->testLike($u->info['x'],$u->info['y'],$this->info['x'],$this->info['y'])!=1) - { - $go = 0; - } - //если бот погиб - $dbot = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `x` = "'.$this->info['x'].'" AND `y` = "'.$this->info['y'].'" LIMIT 1')); - if(!isset($dbot['id2'])) - { - $go = 0; - } - } - } - - if($go==1) { - //dlg_nps:=:3=7 - //квест (с наградой) - $qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:'.$this->info['id'].'='.$pg.'=1=e%" LIMIT 1'); - while($qs_pl = mysql_fetch_array($qs_sp)) { - $q->endq($qs_pl['id'],'win'); - $gsex = explode('=e'.$this->info['id'].$pg.'=',$qs_pl['act_date']); - if($gsex[1] > 0) { - //выдаем добавочный квест - $q->startq($gsex[1]); - $txt .= '
    Задание изменилось'; - } - } - - //квест (без наградой) - $qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:'.$this->info['id'].'='.$pg.'=0=e%" LIMIT 1'); - while($qs_pl = mysql_fetch_array($qs_sp)) { - $q->endq($qs_pl['id'],'end'); - $gsex = explode('=e'.$this->info['id'].$pg.'=',$qs_pl['act_date']); - if($gsex[1] > 0) { - //выдаем добавочный квест $gsex[1] - $q->startq($gsex[1]); - $txt .= '
    Задание изменилось'; - } - } - - $this->title = $this->info['text']; - $this->youInfo = $u->getInfoPers($u->info['id'],1); - $this->youInfo = $this->youInfo[0]; - $this->botInfo = $this->infoBot($this->info['bot_id']); - //Диалог - $qpl = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "1" AND `qid` = "0" AND `id_dg` = "'.$this->info['id'].'" AND `page` = "'.((int)$pg).'" LIMIT 1')); - if( !isset($qpl['id']) ) { - if($txt == '' ){ - $qpl['text'] = 'Диалог не найден ...'; - } else { - $qpl['text'] = $txt.' (уйти)'; - $txt = ''; - } - } else { - $this->pg = $qpl['id']; - } - - if( $u->info['admin'] > 0 ) { - if( isset($_GET['add_new_qid']) ) { - mysql_query('INSERT INTO `dungeon_dlg` (`type`,`qid`,`id_dg`,`text`) VALUES ("0","'.$qpl['id'].'","'.$this->info['id'].'","Новый вариант ответа")'); - } - } - - //Варианты ответа - $a = ''; - $sp = mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `qid` = "'.$qpl['id'].'" AND `id_dg` = "'.$this->info['id'].'" ORDER BY `sort` DESC LIMIT 25'); - while($pl = mysql_fetch_array($sp)) - { - $pl['action'] = $this->ltr($pl['action']); - $act = explode('|',$pl['action']); - if(isset($act[1])) - { - $pl['action'] = 'main.php?talk='.$this->info['id'].'&act='.$pl['id'].'&rnd='.$code; - } - $go1 = ''; - if($pl['tr'] != '') { - $i = 0; - $x = explode('|',$pl['tr']); - while($i < count($x)) { - //Требования - $k = explode('=',$x[$i]); - if($k[0]=='data') { - $date = explode('-',$k[1]); - $dd1 = $date[0]; - $mm1 = $date[1]; - $dd2 = $date[2]; - $mm2 = $date[3]; - $date1 = strtotime($dd1.'-'.$mm1.'-'.date('Y')); - $date2 = strtotime($dd2.'-'.$mm2.'-'.date('Y')); - - if( $date1 > time() || $date2 < time() ) { - $go1 = 'delete'; - $i = count($x); - } - - }elseif($k[0]=='diact') { - //Действия - //user_id # all # all # lukaqst1 # -1 - if($this->quest_act($k[1])==false) { - $go1 = 'delete'; - $i = count($x); - } - - }elseif($k[0]=='quest_end') { - //Квест можно выполнять несколько раз в текущей пещере - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') { - //$go1 .= "Вы уже взяли данное задание\n"; - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='quest_only_one') { - //Квест можно выполнять только один раз - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) { - //$go1 .= "Вы уже взяли данное задание\n"; - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='quest_now') { - //Квест должен быть взят - $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad'){}else{ - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='tr_itm') { - //Квест требует предмет - $qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if($qlst[0] < $k[2]){ - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='tr_itmodet') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(!isset($qlst['id'])){ - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='tr_noitmodet') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `inOdet` > 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($qlst['id'])){ - $go1 = 'delete'; - $i = count($x); - } - }elseif($k[0]=='tr_noitm') { - //Квест требует предмет - $k[1] = str_replace(',','" OR `item_id` = "',$k[1]); - $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($qlst['id'])){ - $go1 = 'delete'; - $i = count($x); - } - } - $i++; - } - } - if($u->info['admin'] > 0) { - $a .= '(ред.)   '; - } - if($go1 == '') { - $a .= '• '.$pl['text'].'
    '; - }elseif($go1 == 'delete') { - if( $u->info['admin'] > 0 ) { - $a .= '• '.$pl['text'].'
    '; - } - }else{ - $a .= ''.$pl['text'].' [?]
    '; - } - } - - - if($u->info['admin'] > 0) { - $a .= 'Добавить вариант ответа'; - } - - $this->dText = $qpl['text'].'
    '.$txt; - $this->aText = $a; - }else{ - $this->aText = '
    Диалог не доступен, вернуться назад
    '; - } - }else{ - $this->aText = '
    Диалог не найден, вернуться назад
    '.((int)$id).'
    '; - } - } - - public function dialog_act_update($data) { - global $u; - $r = array(false,''); - $x = explode('#',$data); - $i = 0; - while( $i < count($x) ) { - $k = explode('=',$x[$i]); - $var = $k[0]; - $val = $k[1]; - if( $var == 'take_item' ) { - //Забираем предмет - $itms = array(); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.mysql_real_escape_string($val).'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100'); - while($pl = mysql_fetch_array($sp)) { - $itms[$pl['item_id']]++; - } - - if($itms[$val] >= $k[2]) { - //$u->deleteItemID($val,$u->info['id'],$k[2]); - - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.mysql_real_escape_string($val).'" AND `uid` = "'.$u->info['id'].'" AND `inShop` = 0 AND `inTransfer` = 0 AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = 0 LIMIT '.round($k[2])); - }else{ - $i = count($x); - $r[0] = false; - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$val.'" LIMIT 1')); - $r[1] = 'У вас нет нужного предмета! Требуется "'.$itm['name'].'"'; - if( $k[2] > 1 ) { - $r[1] .= ' ('.$k[2].' шт.)'; - } - } - // - }elseif( $var == 'add_item' ) { - $data_itm = '|frompisher=1'; - $i1 = 0; - while( $i1 < $k[2] ) { - if( $val == 4797 ) { - //Повестка - if( $u->info['level'] >= 4 && $u->info['level'] <= 7 ) { - $val = 4797; - }elseif( $u->info['level'] >= 8 && $u->info['level'] <= 9 ) { - $val = 4798; - }else{ - $val = 4799; - } - } - $u->addItem($val,$u->info['id'],$data_itm); - $i1++; - } - }elseif( $var == 'up' ) { - $tqst = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "'.$u->info['id'].'" AND `var` = "'.mysql_real_escape_string($val).'" ORDER BY `id` DESC LIMIT 1')); - if(!isset($tqst['id'])) { - mysql_query('INSERT INTO `dialog_act` ( - `uid`,`city`,`time`,`var`,`val` - ) VALUES ( - "'.$u->info['id'].'","'.$u->info['city'].'","'.time().'","'.mysql_real_escape_string($val).'","'.mysql_real_escape_string($k[2]).'" - )'); - }else{ - mysql_query('UPDATE `dialog_act` SET `val` = "'.mysql_real_escape_string($k[2]).'" WHERE `uid` = "'.$u->info['id'].'" AND `var` = "'.mysql_real_escape_string($val).'" ORDER BY `id` DESC LIMIT 1'); - } - }elseif( $var == 'finish' ) { - $r[0] = true; - $r[1] = $val; - } - $i++; - } - return $r; - } - - public function quest_act($data) { - global $u; - // - $r = true; - // - $f = explode('#',$data); - $ql = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `var` = "'.mysql_real_escape_string($f[3]).'" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($ql['id'])) { - //user_id # all # all # lukaqst1 # -1 - if( $f[0] == 'user_id' ) { - $f[0] = $u->info['id']; - } - // - if( $f[0] != $ql['uid'] && $f[0] != 'all' ) { - $r = false; - }elseif( $f[1] != $ql['city'] && $f[1] != 'all' ) { - $r = false; - }elseif( $f[2] != $ql['time'] && $f[2] != 'all' ) { - $r = false; - }elseif( $f[3] != $ql['var'] && $f[3] != 'all' ) { - $r = false; - }elseif( $f[4] == -1 ) { - //Не должен взять задание - $r = false; - }elseif( $f[4] != $ql['val'] ) { - $r = false; - }elseif( $f[5] == 1 && $ql['now'] < $ql['max'] ) { - $r = false; - } - }else{ - if( $f[4] != -1 ) { - $r = false; - } - } - // - return $r; - } - - public function ltr($v) - { - - return $v; - } - - public function infoBot($id) - { - global $c,$code; - $r = ''; - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.((int)$id).'" LIMIT 1')); - if(isset($bot['id'])) - { - //Характеристики от предметов и их изображение - $witm = array(); - $witm[1] = ''; - $witm[2] = ''; - $witm[3] = ''; - $witm[4] = ''; - $witm[7] = ''; - $witm[8] = ''; - $witm[9] = ''; - $witm[10] = ''; - $witm[11] = ''; - $witm[12] = ''; - $witm[13] = ''; - $witm[14] = ''; - $witm[16] = ''; - $witm[17] = ''; - //40-52 слот под магию - $witm[53] = ''; - $witm[54] = ''; - $witm[55] = ''; - $witm[56] = ''; - $witm[57] = ''; - $witm[58] = ''; - - $pb = ''; - $hpmp = '?? '; - $eff = ''; - $anml = ''; - $oi = ''; - $msl = ''; - $witmg = ''; - - if( $bot['level'] < 0 ) { - $bot['level'] = '??'; - } - - $r = '
    '.$bot['login'].' ['.$bot['level'].']
    -
    -
    '.$pb.'
    - - - - - - -
    - - - - - - - - - - - - - - - - -
    '.$witm[1].'
    '.$witm[2].'
    '.$witm[3].'
    '.$witm[4].'
    '.$witm[7].'
    -
    - - - - - - - - - - -
    - - '.$hpmp.' - -
    -
    - -
    -
    '.$eff.'
    '.$anml.' -
    -
    '.$msl.'
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    '.$witm[8].'
    '.$witm[9].'
    - - - - - -
    '.$witm[10].''.$witm[11].''.$witm[12].'
    '.$witm[13].'
    '.$witm[14].'
    '.$witm[16].'
    '.$witm[17].'
    -
    '.$witmg.' -
    '; - }else{ - $r = 'No information'; - } - return $r; - } -} - -$dialog = new dialog; -?> \ No newline at end of file diff --git a/_incl_data/class/dn_editor.php b/_incl_data/class/dn_editor.php deleted file mode 100644 index d5152a6c..00000000 --- a/_incl_data/class/dn_editor.php +++ /dev/null @@ -1,63 +0,0 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - -function GetRealIp() -{ - if(!empty($_SERVER['HTTP_CLIENT_IP'])) { - $ip=$_SERVER['HTTP_CLIENT_IP']; - }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { - $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; - }else{ - $ip=$_SERVER['REMOTE_ADDR']; - } - return $ip; -} - -define('IP',GetRealIp()); -define('GAME',true); - -include_once('_incl_data/__config.php'); -include_once('_incl_data/class/__db_connect.php'); -include_once('_incl_data/class/__user.php'); - -if(!isset($u->info['id']) || $u->info['ip'] != IP || $u->info['admin'] == 1) { - die(''); -} - - -?> - - - - -Визуальный редактор Лабиринтов © new-combats.com - - - - - - - - - - - - - -
    - # 1 - -
    - - diff --git a/_incl_data/class/index.php b/_incl_data/class/index.php deleted file mode 100644 index e69de29b..00000000 diff --git a/_incl_data/class/inf.php b/_incl_data/class/inf.php deleted file mode 100644 index 2c0b61e8..00000000 --- a/_incl_data/class/inf.php +++ /dev/null @@ -1,1122 +0,0 @@ -1) - { - //снимаем хаос - if($inf['haos']info['admin']>0) - { - if(isset($_GET['wipe']) && $u->newAct($_GET['sd4'])==true) - { - $upd = mysql_query('UPDATE `stats` SET `wipe` = "1" WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - if($upd) - { - $uer = 'Сброс характеристик прошел успешно
    '; - }else{ - $uer = 'Ошибка сброса...
    '; - } - } - } - if(($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4) || $u->info['admin']>0) - { - if(isset($_GET['molchMax']) && $u->newAct($_GET['sd4'])==true) - { - $upd = mysql_query('UPDATE `users` SET `molch3` = "'.$inf['molch1'].'" WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - if($upd) - { - $uer = 'Все прошло успешно...
    '; - }else{ - $uer = 'Ошибка...
    '; - } - } - } -} - -if(!isset($inf['id'])) -{ - die(' - - - - Произошла ошибка

    - Произошла ошибка:

    Указанный персонаж не найден...
    -

    Назад -


    -

    (c) '.$c['title'].'

    - '.$c['counters'].' - '); -} - -if($u->info['align'] > 1 && $u->info['align'] < 2) { - -}elseif($u->info['align'] > 3 && $u->info['align'] < 4) { - -}elseif($inf['redirect'] != '0' && $u->info['admin'] == 0 && $u->info['id'] != $inf['id']) { - header('location: '.$inf['redirect']); - die(); -} - - -function zodiak($d,$m,$y) -{ -$dr = $d; -switch($m) -{ - case '03': - $zodiac_id = 12; - if($dr > 20) $zodiac_id = 1; - break; - case '04': - $zodiac_id = 1; - if($dr > 19) $zodiac_id = 2; - break; - case '05': - $zodiac_id = 2; - if($dr > 20) $zodiac_id = 3; - break; - case '06': - $zodiac_id = 3; - if($dr > 21) $zodiac_id = 4; - break; - case '07': - $zodiac_id = 4; - if($dr > 22) $zodiac_id = 5; - break; - case '08': - $zodiac_id = 5; - if($dr > 22) $zodiac_id = 6; - break; - case '09': - $zodiac_id = 6; - if($dr > 22) $zodiac_id = 7; - break; - case '10': - $zodiac_id = 7; - if($dr > 22) $zodiac_id = 8; - break; - case '11': - $zodiac_id = 8; - if($dr > 21) $zodiac_id = 9; - break; - case '12': - $zodiac_id = 9; - if($dr > 21) $zodiac_id = 10; - break; - case '01': - $zodiac_id = 10; - if($dr > 19) $zodiac_id = 11; - break; - case '02': - $zodiac_id = 11; - if($dr > 18) $zodiac_id = 12; - break; - } - return $zodiac_id; -} -$id_zodiak = null; -$bday = explode('.',$inf['bithday']); -if(isset($bday[0],$bday[1],$bday[2])) -{ -$id_zodiak = zodiak($bday[0],$bday[1],$bday[2]); -} - -if($id_zodiak==null) -{ - $id_zodiak = 1; -} - -$name_zodiak = array(1=>'Овен',2=>'Телец',3=>'Близнецы',4=>'Рак',5=>'Лев',6=>'Дева',7=>'Весы',8=>'Скорпион',9=>'Стрелец',10=>'Козерог',11=>'Водолей',12=>'Рыбы'); -$name_zodiak = $name_zodiak[$id_zodiak]; - -function statInfo($s) -{ - global $st,$st2; - $st[$s] = 0+$st[$s]; - $st2[$s] = 0+$st2[$s]; - if($st[$s]!=$st2[$s]) - { - $s1 = '+'; - if($st2[$s]>$st[$s]) - { - $s1 = '-'; - } - -$cl = array( -0=>"#000000", -33=>"#004000", -34=>"#006000", -35=>"#006100", -36=>"#006200", -37=>"#006300", -38=>"#006400", -39=>"#006500", -40=>"#006600", -41=>"#006700", -42=>"#006800", -43=>"#006900", -44=>"#006A00", -45=>"#006B00", -46=>"#006C00", -47=>"#006D00", -48=>"#006E00", -49=>"#006F00", -50=>"#007000", -51=>"#007100", -52=>"#007100", -53=>"#007200", -54=>"#007300", -55=>"#007400", -56=>"#007500", -57=>"#007600", -58=>"#007700", -59=>"#007800", -60=>"#007900", -61=>"#007A00", -62=>"#007B00", -63=>"#007C00", -64=>"#007D00", -65=>"#007E00", -66=>"#007F00", -67=>"#008000", -68=>"#008100", -69=>"#008200", -70=>"#008300", -71=>"#008400", -72=>"#008500", -73=>"#008600", -74=>"#008700", -75=>"#008700", -76=>"#008800", -77=>"#008900", -78=>"#008A00", -79=>"#008B00", -80=>"#008C00", -81=>"#008D00", -82=>"#008E00", -83=>"#008F00", -84=>"#009000", -85=>"#009100", -86=>"#009200", -87=>"#009300", -88=>"#009400", -89=>"#009500", -90=>"#009600", -91=>"#009700", -92=>"#009800", -93=>"#009900", -94=>"#009A00", -95=>"#009B00", -96=>"#009C00", -97=>"#009D00", -98=>"#009E00", -99=>"#009F00", -100=>"#00A000" -); - - - //$cl = array(0=>'#003C00',1=>'green',2=>'#0DAC0D',3=>'#752415',4=>''); - $si = 4; - if($s1=='-') - { - $si = 0; - } - $t = $st[$s]; - $j = $st[$s]-$st2[$s]; - $t = $t-$j; - if($j>0) - { - if($t==0) - { - $t = 1; - } - if($t==0) - { - $t = 1; - } - $d = $j*100/$t; - if($d<0 && $t+$j>=0) - { - $d = 100; - } - if($d < 33) - { - $si = 0; - }elseif($d > 100) - { - $si = 100; - } - }elseif($j<0) - { - $si = 3; - } - echo ''.$st[$s].' ('.$st2[$s].' '.$s1.' '.abs($st[$s]-$st2[$s]).')'; - }else{ - echo ''.$st[$s].''; - } -} - -$room = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `id`="'.$inf['room'].'" LIMIT 1')); - -if($inf['clan']>0) -{ - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="'.$inf['clan'].'" LIMIT 1')); -} - -if(isset($_GET['short'])) -{ - $n = ' -'; - $o = 0; - if($inf['online']>time()-520) - { - $o = 1; - } - $sh = ''; - $sh .= 'id='.$inf['id'].$n; - $sh .= 'login='.$inf['login'].$n; - $sh .= 'level='.$inf['level'].$n; - $sh .= 'align='.$inf['align'].$n; - $sh .= 'clan='.$pc['name_mini'].$n; - $sh .= 'city='.$inf['city'].$n; - $sh .= 'city_reg='.$inf['cityreg'].$n; - $sh .= 'room_name='.$room['name'].$n; - $sh .= 'online='.$o.$n; - die($sh); -} -?> - - - - - -Информация о <? echo $inf['login']; ?> - - - - - - - - - - - - -'.$uer.'

    '; } ?> - - - -
    - - - - '; - } - echo '

    getStats($inf['id'],1); $st2 = $st[1]; $st = $st[0]; $rgd = $u->regen($inf['id'],$st,1); $us = $u->getInfoPers($inf['id'],1,$st); if($us!=false){ echo $us[0]; }else{ echo 'information is lost.'; } ?>
    -
    - '.$u->city_name[$inf['city']].'
    '; - if($inf['online']>time()-520 && $inf['banned']==0) - { - echo 'Персонаж сейчас находится в клубе.
    "'.$room['name'].'"'; - }else{ - if($inf['admin']==0 || $inf['admin']==2) - { - if($inf['online']==0) - { - $inf['online'] = $inf['timeREG']; - } - echo 'Персонаж не в клубе, но был тут:
    '.date('d.m.Y H:i',$inf['online']).''; - $out = ''; - $time_still = time()-$inf['online']; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/604800); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - $out = $time_still.' сек.'; - } - echo '
    ('.$out.' назад)'; - }elseif($inf['admin']>0) - { - echo 'Персонаж не в клубе.'; - } - } - if($inf['inUser']>0) - { - echo '
    Персонаж вселился в бота'; - } - if($inf['battle']>0) - { - $btl3 = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = '.$inf['battle'].'')); - if(isset($btl3['id']) && $btl3['time_over']==0) - { - echo '
    Персонаж сейчас в поединке'; - } - } - echo '
    '; - ?> -
    - - -
    Сила:
    - Ловкость:
    - Интуиция:
    - Выносливость:
    - 3 || $st['s5']!=0){ ?>Интеллект:
    - 6 || $st['s6']!=0){ ?>Мудрость:
    - 9 || $st['s7']!=0){ ?>Духовность:
    - 11 || $st['s8']!=0){ ?>Воля:
    - 14 || $st['s9']!=0){ ?>Свобода духа:
    - 19 || $st['s10']!=0){ ?>Божественность:
    -
    - Уровень:
    - Побед: '.number_format($inf['win'], 0, ",", " ").''; } ?>
    - Поражений:
    - Ничьих:
    - Орден Алхимиков'; if($inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '
    '; } ?> - 1 && $inf['align']<2){ echo 'Орден Паладинов - '.$u->mod_nm[1][$inf['align']]; if($inf['align']!='1.99' && $inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '
    '; } ?> - 3 && $inf['align']<4){ echo 'Армада - '.$u->mod_nm[3][$inf['align']]; if($inf['align']!='3.99' && $inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '
    '; } ?> - 0) - { - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="'.$inf['clan'].'" LIMIT 1')); - if(isset($pc['id'])) - { - $pc['img'] = $pc['name_mini'].'.gif'; - if($inf['clan_prava']=='glava') - { - $inf['mod_zvanie'] = '- глава клана'; - }elseif($inf['mod_zvanie']!='') - { - $inf['mod_zvanie'] = '- '.htmlspecialchars($inf['mod_zvanie'],NULL,'cp1251'); - } - echo 'Клан: '.$pc['name'].' '.$inf['mod_zvanie'].'
    '; - } - } ?> - Место рождения: city_name[$inf['cityreg']]; }else{ echo $inf['cityreg2']; } ?>
    - '.$u->city_name[$inf['city2']].'
    '; } ?> - День рождения персонажа:
    - 0) - { - $names .= '                      '; - } - $names .= '\''.$pl['login'].'\' до '.date('d.m.Y H:i',$pl['time']).'
    '; - $i++; - } - if($names!='') - { - echo 'История имен: '.$names.''; - } - ?> -
    -
    - - - '; - } - } - - - //значок регистратора - /*$uref = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `host_reg` = "'.$inf['id'].'" AND `level` > 0 LIMIT 1000')); - $uref = $uref[0]; - if($uref>9) - { - $rico = 0; - if($uref>=30){ $rico = 19; - }elseif($uref>=20){ $rico = 20; - }elseif($uref>=10){ $rico = 21; } - - if($rico>0) - { - $stp = array(21=>'XXI степень
    новичок', - 20=>'XX степень
    новичок', - 19=>'IXX степень
    новичок'); - echo ''; - } - } - */ - - $sp = mysql_query('SELECT * FROM `users_ico` WHERE `uid` = "'.$inf['id'].'" AND (`endTime` = 0 OR `endTime` > '.time().') LIMIT 50'); - $ico = ''; - //сильвер - if($st['silver']>0) { - echo ' '; - } - - //«» - while($pl = mysql_fetch_array($sp)) - { - $ico .= ''; - } - echo $ico; - unset($ico); - - $irep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "'.$inf['id'].'" LIMIT 1')); - if(isset($irep['id'])) - { - //capitalcity - if($irep['repcapitalcity']>24999) - { - echo ''; - }elseif($irep['repcapitalcity']>9999) - { - echo ''; - } - - //angelscity - if($irep['repangelscity']>24999) - { - echo ''; - }elseif($irep['repangelscity']>9999) - { - echo ''; - } - - //demonscity - if($irep['repdemonscity']>24999) - { - echo ''; - }elseif($irep['repdemonscity']>9999) - { - echo ''; - } - - //devilscity - if($irep['repdevilscity']>24999) - { - echo ''; - }elseif($irep['repdevilscity']>9999) - { - echo ''; - } - - //suncity - if($irep['repsuncity']>24999) - { - echo ''; - }elseif($irep['repsuncity']>9999) - { - echo ''; - } - - //emeraldscity - if($irep['repemeraldscity']>24999) - { - echo ''; - }elseif($irep['repemeraldscity']>9999) - { - echo ''; - } - - //sandcity - if($irep['repsandcity']>24999) - { - echo ''; - }elseif($irep['repsandcity']>9999) - { - echo ''; - } - - //mooncity - if($irep['repmooncity']>24999) - { - echo ''; - }elseif($irep['repmooncity']>9999) - { - echo ''; - } - - //Алтарь крови - if($irep['rep2']>99) - { - echo ''; - } - - //Храм знаний - if($irep['rep1']>9999) - { - echo ''; - }elseif($irep['rep1']>999) - { - echo ''; - }elseif($irep['rep1']>99) - { - echo ''; - } - } - - function timeOut($ttm,$travm=false) - { - if($travm==false){ - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/604800); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - }else{ - } - return $out; - } - - echo ''; - if($inf['jail']>time()) - { - echo '
    Персонаж находится в заточении еще '.timeOut($inf['jail']-time()).' '; - } - if($inf['molch1']>time()) - { - echo '
    На персонажа наложено заклятие молчания. Будет молчать еще '.timeOut($inf['molch1']-time()).' '; - } - if($inf['molch2']>time()) - { - echo '
    На персонажа наложено заклятие молчания на форуме. Будет молчать еще '.timeOut($inf['molch2']-time()).' '; - } - //Если у персонажа есть травмы, физ. и маг. травмы - $sp = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$inf['id'].'" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6'); - while($pl = mysql_fetch_array($sp)) - { - //$pln = array(); - //$pln = array(0=>$pln[0],1=>$pln[1]); - echo '
    У персонажа - "'.$pl['name'].'" еще '.$u->timeOut($pl['timeUse']-time()+$pl['timeAce']); - } - - //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек. - if($inf['level']>=4) - { - $nn = 0; - while($nn Персонаж ослаблен из-за смерти в бою, еще '.timeOut($st['effects'][$nn]['timeUse']+$st['effects'][$nn]['timeAce']+$osl['actionTime']-time()).' '; - $nn = count($st['effects'])+1; - } - $nn++; - } - } - - echo '
    '; - - if(($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) || $inf['banned']>0) - { - $to = ''; - if($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) - { - $to = 'хаос'; - } - if($inf['banned']>0) - { - if($to='') - { - $to = 'блок'; - }else{ - $to = $to.'/блок'; - } - } - $fm = mysql_fetch_array(mysql_query('SELECT * FROM `users_delo` WHERE `uid` = "'.$inf['id'].'" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1')); - echo '

    '; - if(isset($fm['id'])) - { - $from = 'паладинов'; - if($fm['hd']==2) - { - $from = 'Ангелов'; - }elseif($fm['hd']==3) - { - $from = 'тарманов'; - } - echo 'Сообщение от '.$from.' о причине отправки в '.$to.':
    '; - //$fm['text'] = ltrim($fm['text'],"Ангел \"\;".$fm['login']."\"\; \сообщает\<\/b\>\:"); - echo ''.$fm['text'].'
    '; - } - if($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) - { - if($inf['haos']==1) - { - echo 'Хаос бессрочно.'; - }else{ - echo 'Хаос еще '.timeOut($inf['haos']-time()).''; - } - } - } - - //подарки - if(($inf['info_delete']info['align']>1 && $u->info['align']<2 || $u->info['align']>3 && $u->info['align']<4 || $u->info['admin']>0)){ - $gs = array('','',''); $glim = 10; $i = 0; - $_GET['maxgift']=1; - if(isset($_GET['maxgift'])) - { - $glim = 1000; - } - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "63" OR `im`.`type` = "64") AND `iu`.`uid` = "'.$inf['id'].'" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT '.$glim); - while($pl = mysql_fetch_array($sp)) - { - if($pl['type'] == 28) { - //Букеты - $gs[2] .= ''; - }elseif($pl['type'] == 63) { - //открытки - $gs[1] .= ''; - }else{ - //подарки - $gs[0] .= ''; - } - } - - if($gs[0]!='' || $gs[1]!='' || $gs[2]!=''){ - if($gs[2] != '') { - $gs[2] = '
    Букеты:
    '.$gs[2].'
    '.$gs[2].'
    Подарки:
    '.$gs[0].'
    '.$gs[1].'
    '; - if(!isset($_GET['maxgift'])){ - //echo 'Нажмите сюда, чтобы увидеть все подарки...'; - }else{ - //echo 'Нажмите сюда, чтобы скрыть подарки'; - } - } - - } - //темные делишки :D - if(($u->info['align']>=1.1 && $u->info['align']<=1.99 && $inf['admin']<1) || ($u->info['align']>=3.05 && $u->info['align']<=3.99 && $inf['admin']<1) || $u->info['admin']>0) - { - $mults = ''; - $bIP = array(); - if($inf['id']!=42526 && $inf['id']!=1254){ - $spl = mysql_query('SELECT * FROM `mults` WHERE (`uid` = "'.$inf['id'].'" OR `uid2` = "'.$inf['id'].'") AND `uid`!="0" AND `uid2`!="0"'); - } - while($pls = mysql_fetch_array($spl)) - { - $usr = $pls['uid']; - if($usr==$inf['id']) - { - $usr = $pls['uid2']; - } - if(!isset($bIP[$usr]) && $usr!=$inf['id']) - { - $si = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "'.mysql_real_escape_string($usr).'" LIMIT 1')); - if(isset($si['id'])) - { - if($si['admin']==0 || $u->info['admin']>0) - { - $mults .= $u->microLogin($si['id'],1).', '; - } - } - } - } - - if($inf['city']!=$u->info['city'] && $u->info['align']>=1.1 && $u->info['align']<1.9) - { - echo '

    Персонаж в другом городе...

    '; - } elseif ($inf['city']!=$u->info['city'] && $u->info['align']>=3.01 && $u->info['align']<3.09) - { - echo '

    Персонаж в другом городе...

    '; - } elseif ($u->info['admin']==0 && (($u->info['admin']==0 && (floor($u->info['align'])==1 && $inf['align']>=3.01 && $inf['align']<=3.99) || (floor($u->info['align'])==3 && $inf['align']>=1.1 && $inf['align']<=1.99)) || ($u->info['admin']==0 && $inf['admin']>0))) - { - echo '

    Персонаж носит вражескую склонность...

    '; - }else{ - echo '

    За игроком замечены следующие темные делишки:
    '; - if(!isset($_GET['mod_inf'])) { - echo 'Показать личноое дело'; - }else{ - //Личное дело персонажа - $log = mysql_query('SELECT * FROM `users_delo` WHERE `uid`="'.$inf['id'].'" AND `type`="0" ORDER by `id` DESC LIMIT 21'); - $i = 0; - while ($log_w = mysql_fetch_array($log)) - { - echo ''.date("d.m.Y H:i:s",$log_w['time']).' '.$log_w['text'].'
    '; - $i++; - } - echo 'Скрыть личноое дело'; - } - echo '

    '; - //Информация для паладинов\тарманов\ангелов - if(($u->info['align']>=1.4 && $u->info['align']<=1.99 && $u->info['align']!=1.6 && $u->info['align']!=1.75 && $inf['admin']<1) || ($u->info['align']>=3.05 && $u->info['align']<=3.99 && $u->info['align']!=3.06 && $inf['admin']<1) || $u->info['admin']>0) - { - if ((int)$u->info['align']==1) - { - $rang = 'Паладинов'; - } elseif ((int)$u->info['align']==3) - { - $rang = 'Тарманов'; - } else - { - $rang = 'Ангелов'; - } - - /* - $pr1 = mysql_fetch_array(mysql_query('SELECT * FROM `register_code` WHERE `reg_id` = "'.$inf['id'].'" LIMIT 1')); - $pr = array('login'=>''); - if(isset($pr1['id'])) - { - $pr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level` FROM `users` WHERE `id` = "'.$pr1['uid'].'" LIMIT 1')); - if(isset($pr['id'])) - { - $pr['login'] = 'Персонажа пригласили: '.$pr['login'].' ['.$pr['level'].']
    '; - }else{ - $pr['login'] = 'Персонажа пригласили: #'.$pr1['uid'].'
    '; - } - } - */ - - if((int)$inf['host_reg'] >= 1){ - $inf['ref'] = $u->microLogin((int)$inf['host_reg'],1); - }else{ - $inf['ref'] = '--'; - } - if(!isset($inf['ipReg'])){ $inf['ipReg'] = '--'; } - echo ' -
    - Только для '.$rang.'
    - День рождения: '.$inf['bithday'].'
    - E-mail: '.$inf['mail'].'
    - Персонажа пригласили: '.$inf['ref'].'
    - Последний раз заходил в клуб: '.date('d.m.Y H:i',$inf['online']).'
    - '.$pr['login'].'IP при регистрации: '.$inf['ipReg'].'
    '; - if($inf['no_ip'] == '' || $u->info['admin']>0) { - echo 'IP последние: '.$inf['ip'].''; - $auth = mysql_query('SELECT * FROM `logs_auth` WHERE `uid`="'.$inf['id'].'" AND `type`="1" ORDER by `id` DESC LIMIT 10'); - $country = ''; - while ($auth_w = mysql_fetch_array($auth)) { - echo '
    '.$auth_w['ip'].' ('.date('d.m.Y H:i',$auth_w['time']).')'; - } - }else{ - echo 'IP последние: '.$inf['no_ip'].''; - } - echo' -
    - Браузер: '.$inf['dateEnter'].'
    - '; - - if($inf['no_ip'] == '' || $u->info['admin']>0) { - if($mults!='') - { - $mults = trim($mults,', '); - echo 'Другие ники этого бойца: '.$mults.'
    '; - } - } - - if($u->info['admin']>0) - { - echo 'Доп. возможности: сбросить характеристики
    '; - $on1 = mysql_fetch_array(mysql_query('SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "'.$inf['id'].'" LIMIT 1')); - echo 'Время в онлайне (всего): '.timeOut($on1['time_all']).'
    Время в онлайне (сегодня): '.timeOut($on1['time_today']).'
    '; - } - if($inf['molch3']Запретить персонажу отправлять сообщения с молчанкой
    '; - } - echo' - Опыт: '.$inf['exp'].'
    - Число неиспользованных UP-ов: '.$inf['ability'].'
    - Кредитов: '.$inf['money'].''; - if($u->info['admin']>0 && $inf['admin']>0) - { - echo '
    admin: '.$inf['admin'].''; - } - if($inf['active']!=''){ - echo '
    Внимание!Если персонаж не получает письма с активацией отправте ему письмо вручную.'; - echo '
    '; - echo "

    "; - } - echo '
    '; - } - } - } - ?> -
    - -
    -
    - - - - - - - - - -
     Поиск по нику: 
    -
    -
    - */ ?> - - - - -
    - /i/zodiac/.gif' border=0>
    - 1 && $inf['align']<2) { ?> - /' target='_blank'>/i/flag_light.gif' border=0>
    - /' target='_blank'>paladins. - =3.01 && $inf['align']<=3.99) { ?> - /'>/i/flag_dark.gif' border=0>
    - /' target='_blank'>tarmans. - =2 && $inf['align']<3) { ?> - /'>/i/flag_haos.gif' border=0>
    - .com/' target='_blank'> - - /'> /i/flag_gray.gif'>
    - /' target='_blank'>events.
    - -
    - - - -
    - -

    Персонаж обезличен 1){ echo 'до '.date('d.m.Y H:i',$inf['info_delete']).'.'; }else{ echo '.'; } ?>

    -info['align']>1 && $u->info['align']<2 || $u->info['align']>3 && $u->info['align']<4 || $u->info['admin']>0) - { - echo '
    '; - } -} -if($inf['info_delete']==0 || (($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4) || $u->info['admin']>0)) -{ -?> -
    -

    Анкетные данные

    -Имя:
    -Пол:
    -Город:
    -0 && $inf['icq_hide']==0){ echo 'ICQ: '.$inf['icq'].'
    '; } ?> -4) { -$url = ((substr($inf['homepage'],0,4)=='https'?"":"https://").$inf['homepage']); -?> - Домашняя страница:
    -Девиз:
    - -Увлечения / хобби:
    -',$inf['hobby']); - } - if($inf['info_delete']!=0) - { - echo '
    '; - } -} -echo '

    '.$c['counters_noFrm'].'
    '; -?> -
    -

    - - diff --git a/_incl_data/class/items_info.php b/_incl_data/class/items_info.php deleted file mode 100644 index c87e636e..00000000 --- a/_incl_data/class/items_info.php +++ /dev/null @@ -1,1295 +0,0 @@ - 0, - 26 => 1, - 30 => 2, - 29 => 3, - 5 => 4, - 6 => 4, - 2 => 5, - 3 => 6, - 15 => 7, - 12 => 8, - 7 => 9, - 14 => 10, - 8 => 11, - 4 => 12, - 1 => 13, - //28 => 14, - 20 => 15, - 18 => 16, - 21 => 17, - 22 => 18, - 19 => 19, - 28 => 20, - //00 => 21, - //00 => 22, - 38 => 23, - 39 => 23, - 37 => 23, - 13 => 24, - 11 => 25, - 10 => 26, - 9 => 27, - 62 => 22, - 67 => 28, // 67 разное - 32 => 22, // 32 ингридиенты, маг.предметы - 34 => 28 // 34 ключи, разное -); - -/* Пользователь */ -if (isset($_COOKIE['login'])) -{ -$u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_COOKIE['login']).'" AND `pass` = "'.mysql_real_escape_string($_COOKIE['pass']).'" LIMIT 1')); -} -/* Предмет */ -$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($_GET['id']).'" LIMIT 1')); - - - function timeOut($ttm) { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - /* - $tmp = floor($time_still/604800); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - */ - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - return $out; - } - - function lookStats($m) - { - $ist = array(); - $di = explode('|',$m); - $i = 0; $de = false; - while($i array('lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','a1','a2','a3','a4','a5','a6','a7','mg1','mg2','mg3','mg4','mg5','mg6','mg7','mall','m2all','aall'), - 'add' => array('min_heal_proc','no_yv1','no_bl1','no_pr1','no_yv2','no_bl2','no_pr2','silver','pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','yron_min','yron_max','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','m21','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','speed_dungeon','antm3'), - 'sv' => array('pza','pza1','pza2','pza3','pza4','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','m21','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','min_use_mp','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','free_stats','tya1','tya2','tya3','tya4','tym1','tym2','tym3','tym4','tym5','tym6','tym7') - ); - -$is = array('oza'=>'Защита от урона','oza1'=>'Защита от колющего урона','oza2'=>'Защита от рубящего урона','oza3'=>'Защита от дробящего урона','oza4'=>'Защита от режущего урона','hpAll'=>'Уровень жизни (HP)','mpAll'=>'Уровень маны','sex'=>'Пол','lvl'=>'Уровень','s1'=>'Сила','s2'=>'Ловкость','s3'=>'Интуиция','s4'=>'Выносливость','s5'=>'Интелект','s6'=>'Мудрость','s7'=>'Духовность','s8'=>'Воля','s9'=>'Свобода духа','s10'=>'Божественность','m1'=>'Мф. критического удара (%)','m2'=>'Мф. против критического удара (%)','m3'=>'Мф. мощности критического удара (%)','m4'=>'Мф. увертывания (%)','m5'=>'Мф. против увертывания (%)','m6'=>'Мф. контрудара (%)','m7'=>'Мф. парирования (%)','m8'=>'Мф. блока щитом (%)','m9'=>'Мф. пробоя брони (%)','m14'=>'Мф. абс. критического удара (%)','m15'=>'Мф. абс. увертывания (%)','m16'=>'Мф. абс. парирования (%)','m17'=>'Мф. абс. контрудара (%)','m18'=>'Мф. абс. блока щитом (%)','m19'=>'Мф. абс. магический промах (%)','m20'=>'Мф. удача (%)','m21'=>'Мф. абс. попадания (%)','a1'=>'Мастерство владения ножами, кинжалами','a2'=>'Мастерство владения топорами, секирами','a3'=>'Мастерство владения дубинами, молотами','a4'=>'Мастерство владения мечами','a5'=>'Мастерство владения магическими посохами','a6'=>'Мастерство владения луками','a7'=>'Мастерство владения арбалетами','aall'=>'Мастерство владения оружием','mall'=>'Мастерство владения магией стихий','m2all'=>'Мастерство владения магией','mg1'=>'Мастерство владения магией огня','mg2'=>'Мастерство владения магией воздуха','mg3'=>'Мастерство владения магией воды','mg4'=>'Мастерство владения магией земли','mg5'=>'Мастерство владения магией Света','mg6'=>'Мастерство владения магией Тьмы','mg7'=>'Мастерство владения серой магией','tj'=>'Тяжелая броня','lh'=>'Легкая броня','minAtack'=>'Минимальный урон','maxAtack'=>'Максимальный урон','m10'=>'Мф. мощности урона','m11'=>'Мф. мощности магии стихий','m11a'=>'Мф. мощности магии','pa1'=>'Мф. мощности колющего урона','pa2'=>'Мф. мощности рубящего урона','pa3'=>'Мф. мощности дробящий урона','pa4'=>'Мф. мощности режущий урона','pm1'=>'Мф. мощности магии огня','pm2'=>'Мф. мощности магии воздуха','pm3'=>'Мф. мощности магии воды','pm4'=>'Мф. мощности магии земли','pm5'=>'Мф. мощности магии Света','pm6'=>'Мф. мощности магии Тьмы','pm7'=>'Мф. мощности серой магии','za'=>'Защита от урона','zm'=>'Защита от магии стихий','zma'=>'Защита от магии','za1'=>'Защита от колющего урона','za2'=>'Защита от рубящего урона','za3'=>'Защита от дробящий урона','za4'=>'Защита от режущий урона','zm1'=>'Защита от магии огня','zm2'=>'Защита от магии воздуха','zm3'=>'Защита от магии воды','zm4'=>'Защита от магии земли','zm5'=>'Защита от магии Света','zm6'=>'Защита от магии Тьмы','zm7'=>'Защита от серой магии','pza'=>'Понижение защиты от урона','pzm'=>'Понижение защиты от магии','pza1'=>'Понижение защиты от колющего урона','min_heal_proc'=>'Эффект лечения (%)','silver'=>'Премиум','notravma'=>'Защита от травм','yron_min'=>'Минимальный урон','yron_max'=>'Максимальный урон','pza2'=>'Понижение защиты от рубящего урона','pza3'=>'Понижение защиты от дробящего урона','pza4'=>'Понижение защиты от режущего урона','pzm1'=>'Понижение защиты от магии огня','pzm2'=>'Понижение защиты от магии воздуха','pzm3'=>'Понижение защиты от магии воды','pzm4'=>'Понижение защиты от магии земли','pzm5'=>'Понижение защиты от магии Света','pzm6'=>'Понижение защиты от магии Тьмы','pzm7'=>'Понижение защиты от серой магии','speedhp'=>'Регенерация здоровья (НР)','speedmp'=>'Регенерация маны (МР)','tya1'=>'Колющие атаки','tya2'=>'Рубящие атаки','tya3'=>'Дробящие атаки','tya4'=>'Режущие атаки','tym1'=>'Огненные атаки','tym2'=>'Электрические атаки','tym3'=>'Ледяные атаки','tym4'=>'Земляные атаки','tym5'=>'Атаки Света','tym6'=>'Атаки Тьмы','tym7'=>'Серые атаки','min_use_mp'=>'Уменьшает расход маны','pog'=>'Поглощение урона','maxves'=>'Увеличивает рюкзак','zona'=>'Дополнительная зона атаки','zaproc'=>'Блокировка физического Урона(%)','zmproc'=>'Блокировка магического Урона (%)','speed_dungeon'=>'Скорость перемещения по пещерам','free_stats'=>'Свободных распределений','antm3'=>'Мф. против пощности крит. удара'); - -if( !file_exists('/home/newcom1/public_html/img.new-combats.com/i/encicl/pict_'.$rz[$rt[$itm['type']]][0].'.jpg') == true ) { - //subject - $rz[$rt[$itm['type']]][0] = 'subject'; -} - -if( !isset($rz[$rt[$itm['type']]][1])) { - $rz[$rt[$itm['type']]][1] = 'Прочие предметы'; -} - -?> - - - - -Бойцовский клуб | Библиотека <? if(isset($itm['id'])) { ?> | <?=$rz[$rt[$itm['type']]][1]?> | <?=$itm['name']?><? } ?> - - - - - - - - -
    - - - -
    - - - - - - - - - - - - - - - -
    -

    -
    -

    » Предметы / / -

    - -

    - -
    - - - - - - - - - - - - - - - - -
      
    -
    - -

     

    -
    - - - -
    - - - - - - -
    - - -Редактировать предмет    '; - echo $crd; - } - - if($itm['massa']>0) - { - echo '(Масса: '.$itm['massa'].') '; - } - if(isset($itd['art']) && $itd['art'] > 0) - { - echo 'Артефактная вещь '; - } - - if(isset($po['sudba']) && $po['sudba'] > 0) - { - echo ' '; - } - - if($itm['price1'] > 0) { - echo '
    Цена: '.$itm['price1'].' кр.'; - } - - if($itm['price2'] > 0) { - echo '
    Цена: '.$itm['price2'].' екр.'; - } - - if($itm['iznosMAXi'] >= 999999999) { - echo '
    Долговечность: неразрушимо'; - }elseif($itm['iznosMAXi'] > 0) { - echo '
    Долговечность: 0/'.$itm['iznosMAXi'].''; - } - - - //Срок годности предмета - if(isset($itd['srok']) && $itd['srok'] > 0) - { - $itm['srok'] = $itd['srok']; - } - if($itm['srok'] > 0) - { - echo '
    Срок годности: '.timeOut($itm['srok']); - } - - //Продолжительность действия магии: - if((int)$itm['magic_inci'] > 0) - { - $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.((int)$itm['magic_inci']).'" LIMIT 1')); - if(isset($efi['id2']) && $efi['actionTime']>0) - { - echo '
    Продолжительность действия: '.timeOut($efi['actionTime']); - } - } - - -/* требования */ -$tr = ''; - -$t = $items['tr']; -$x = 0; -while($xТребуется минимальное:'.$tr; -} - -/* действует на */ -$tr = ''; - -$t = $items['add']; -$x = 0; -while($x'головы',2=>'корпуса',3=>'пояса',4=>'ног'); - while($i<=4) - { - if(isset($itd['add_mab'.$i]) && $itd['add_mab'.$i]>0) - { - if($itd['add_mab'.$i]==$itd['add_mib'.$i]) - { - $z = '+'; - if($itd['add_mab'.$i]<0) - { - $z = ''; - } - $tr .= '
    • Броня '.$bn[$i].': '.$z.''.$itd['add_mab'.$i]; - }else{ - $tr .= '
    • Броня '.$bn[$i].': '.$itd['add_mib'.$i].'-'.$itd['add_mab'.$i]; - } - } - $i++; - } -if($tr != '') { - echo '
    Действует на:'.$tr; -} -/* свойства предмета */ -$tr = ''; - - if(isset($itd['sv_yron_min'],$itd['sv_yron_max'])) - { - $tr .= '
    • Урон: '.$itd['sv_yron_min'].' - '.$itd['sv_yron_max']; - } - $x = 0; - while($x0) - { - $x = 1; - while($x<=$itd['zonb']) - { - $tr .= '+'; - $x++; - } - }else{ - $tr .= '—'; - } - } - -if($tr != '') { - echo '
    Свойства предмета:'.$tr; -} - -/* особенности */ -$tr = ''; - - $x = 1; - while($x<=4) - { - if(isset($itd['tya'.$x]) && $itd['tya'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tya'.$x]>9) - { - $tyc = 'Редки'; - } - if($itd['tya'.$x]>24) - { - $tyc = 'Малы'; - } - if($itd['tya'.$x]>49) - { - $tyc = 'Временами'; - } - if($itd['tya'.$x]>74) - { - $tyc = 'Регулярны'; - } - if($itd['tya'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tya'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tya'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x<=7) - { - if(isset($itd['tym'.$x]) && $itd['tym'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tym'.$x]>9) - { - $tyc = 'Редки'; - } - if($itd['tym'.$x]>24) - { - $tyc = 'Малы'; - } - if($itd['tym'.$x]>49) - { - $tyc = 'Временами'; - } - if($itd['tym'.$x]>74) - { - $tyc = 'Регулярны'; - } - if($itd['tym'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tym'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tym'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x <= 4) - { - if(isset($itd['add_oza'.$x]) && $itd['add_oza'.$x]>0) - { - $tyc = 'Слабая'; - if($itd['add_oza'.$x] == 4) - { - $tyc = 'Посредственная'; - } - if($itd['add_oza'.$x] == 2) - { - $tyc = 'Нормальная'; - } - if($itd['add_oza'.$x] == 3) - { - $tyc = 'Хорошая'; - } - if($itd['add_oza'.$x] == 5) - { - $tyc = 'Великолепная'; - } - if($tyc != '') { - $tr .= '
    • '.$is['oza'.$x].': '.$tyc; - } - } - $x++; - } - if(isset($itd['free_stats']) && $itd['free_stats']>0){ - echo '
    Свободные распределения:
    • Возможных распределений: '.$itd['free_stats']; - } -if($tr != '') { - echo '
    Особенности:'.$tr; -} - $is2 = ''; - - if(isset($itd['complect'])) - { - $is2 .= '
    Дополнительная информация:'; - } - if(isset($itd['complect'])) - { - //не отображается - $com1 = array('name'=>'Неизвестный Комплект','x'=>0,'text'=>''); - $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "'.$itd['complect'].'" ORDER BY `x` ASC LIMIT 20'); - while($itmc = mysql_fetch_array($spc)) - { - $com1['name'] = $itmc['name']; - $com1['text'] .= '    • '.$itmc['x'].': '; - //действие комплекта - $i1c = 0; $i2c = 0; - $i1e = lookStats($itmc['data']); - while($i1c0) - { - $i3c = '+'.$i3c; - } - if($i2c>0) - { - $com1['text'] .= '    '.$is[$items['add'][$i1c]].': '.$i3c; - }else{ - $com1['text'] .= $is[$items['add'][$i1c]].': '.$i3c; - } - $com1['text'] .= '
    '; - $i2c++; - } - $i1c++; - } - unset($i1c,$i2c,$i3c); - $com1['x']++; - } - $is2 .= '
    • Часть комплекта: '.$com1['name'].'
    '; - $is2 .= $com1['text']; - $is2 .= ''; - } - - $is2 .= ''; - - if($itm['info']!='') - { - $is2 .= '
    Описание:
    '.$itm['info'].'
    '; - } - - if(isset($itd['info']) && $itd['info']!='') - { - $is2 .= '
    '.$itd['info'].'
    '; - } - - if(isset($itm['use_text']) && $itm['max_text']-$itm['use_text'] > 0) { - $is2 .= '
    Количество символов: '.($itm['max_text']-$itm['use_text']).'
    '; - } - - if(isset($itd['noremont']) && $itd['noremont']>0) - { - $is2 .= '
    Предмет не подлежит ремонту
    '; - } - - if(isset($itd['frompisher']) && $itd['frompisher']>0) - { - $is2 .= '
    Предмет из подземелья
    '; - } - - if(isset($itm['dn_delete']) && $itm['dn_delete']>0) - { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; - } - - $is2 .= '
    '; - -echo $is2; - -?> -
    - - - -Требуется минимальное:
    • Уровень: 4
    • Выносливость: 16
    • Сила: 16
    -Действует на:
    • Мф. увертывания (%): +30
    • Интуиция: +3
    • Сила: +5
    -Свойства предмета:
    • Урон: 8 - 18
    • Мф. против увертывания (%): 30
    • Мф. критического удара (%): 50
    • Мастерство владения мечами: 2
    • Зоны блокирования: +
    - -Особенности:
    • Колющие атаки: Малы
    • Рубящие атаки: Временами
    • Дробящие атаки: Редки
    • Режущие атаки: Малы
    - - - -Возможно усиление до 10го уровня
    - -*/ -?> - -
    -<?=$itm['name']?>
    - -
    -

    - -

        
     
    -= 0 ) { - - if($rv == 1) { - //Костыли - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 26'); - }elseif($rv == 3) { - //Свитки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 29 AND `name` NOT LIKE "%Кристаллизатор%"'); - }elseif($rv == 2) { - //Эликсиры - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 30'); - }elseif($rv == 6) { - //Броня тяжелая - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 6'); - }elseif($rv == 32) { - //Броня легкая - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 5'); - }elseif($rv == 7) { - //Венки на голову - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 8) { - //Наручи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 3'); - }elseif($rv == 9) { - //Ботинки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 15'); - }elseif($rv == 10) { - //Перчатки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 12'); - }elseif($rv == 11) { - //Плащи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 7'); - }elseif($rv == 12) { - //Поножи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 14'); - }elseif($rv == 13) { - //Пояса - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 8'); - }elseif($rv == 14) { - //Рубахи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 4'); - }elseif($rv == 15) { - //Шлема - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 1'); - }elseif($rv == 16) { - //Елки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `name` LIKE "%Елка%"'); - }elseif($rv == 17) { - //Дубины - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 20'); - }elseif($rv == 18) { - //Кинжалы - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 18'); - }elseif($rv == 19) { - //Мечи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 21'); - }elseif($rv == 20) { - //Топоры - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 19'); - }elseif($rv == 21) { - //Посохи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 22'); - }elseif($rv == 22) { - //Цветы - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32 AND `img` LIKE "f_%"'); - }elseif($rv == 23) { - //Компоненты - //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 24) { - //Маг.предметы - //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 25) { - //Подарки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 38 OR `type` = 63'); - }elseif($rv == 26) { - //Руны - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 31'); - }elseif($rv == 27) { - //Прочие - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32'); - }elseif($rv == 28) { - //Щиты - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 13'); - }elseif($rv == 29) { - //Кольца - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 11'); - }elseif($rv == 30) { - //Ожерелья - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 10'); - }elseif($rv == 31) { - //Серьги - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 9'); - } - - } - - - -?> - - - - - - - - - - - - - - -
    -

    » Предметы / -

    - -

    - '; - }else{ - - - while( $itm = mysql_fetch_array($sp) ) { - - //if(!isset($itm['id'])) { - $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1')); - $itd = lookStats($itd['data']); - - ?>
    - - - -
    - - - - -
    - - - Редактировать предмет    '; - echo $crd; - } - if($itm['massa']>0) { - echo '(Масса: '.$itm['massa'].') '; - } - if(isset($itd['art']) && $itd['art'] > 0) - { - echo 'Артефактная вещь '; - } - - if(isset($po['sudba'])) - { - echo ' '; - } - - if($itm['price1'] > 0) { - echo '
    Цена: '.$itm['price1'].' кр.'; - } - - if($itm['price2'] > 0) { - echo '
    Цена: '.$itm['price2'].' екр.'; - } - - if($itm['iznosMAXi'] >= 999999999) { - echo '
    Долговечность: неразрушимо'; - }elseif($itm['iznosMAXi'] > 0) { - echo '
    Долговечность: 0/'.$itm['iznosMAXi'].''; - } - - - //Срок годности предмета - if(isset($itd['srok']) && $itd['srok'] > 0) - { - $itm['srok'] = $itd['srok']; - } - if($itm['srok'] > 0) - { - echo '
    Срок годности: '.timeOut($itm['srok']); - } - - //Продолжительность действия магии: - if((int)$itm['magic_inci'] > 0) - { - $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.((int)$itm['magic_inci']).'" LIMIT 1')); - if(isset($efi['id2']) && $efi['actionTime']>0) - { - echo '
    Продолжительность действия: '.timeOut($efi['actionTime']); - } - } - - -/* требования */ -$tr = ''; - -$t = $items['tr']; -$x = 0; -while($xТребуется минимальное:'.$tr; -} - -/* действует на */ -$tr = ''; - -$t = $items['add']; -$x = 0; -while($x'головы',2=>'корпуса',3=>'пояса',4=>'ног'); - while($i<=4) - { - if(isset($itd['add_mab'.$i]) && $itd['add_mab'.$i]>0) - { - if($itd['add_mab'.$i]==$itd['add_mib'.$i]) - { - $z = '+'; - if($itd['add_mab'.$i]<0) - { - $z = ''; - } - $tr .= '
    • Броня '.$bn[$i].': '.$z.''.$itd['add_mab'.$i]; - }else{ - $tr .= '
    • Броня '.$bn[$i].': '.$itd['add_mib'.$i].'-'.$itd['add_mab'.$i]; - } - } - $i++; - } -if($tr != '') { - echo '
    Действует на:'.$tr; -} -/* свойства предмета */ -$tr = ''; - - if(isset($itd['sv_yron_min'],$itd['sv_yron_max'])) - { - $tr .= '
    • Урон: '.$itd['sv_yron_min'].' - '.$itd['sv_yron_max']; - } - $x = 0; - while($x0) - { - $x = 1; - while($x<=$itd['zonb']) - { - $tr .= '+'; - $x++; - } - }else{ - $tr .= '—'; - } - } - -if($tr != '') { - echo '
    Свойства предмета:'.$tr; -} - -/* особенности */ -$tr = ''; - - $x = 1; - while($x<=4) - { - if(isset($itd['tya'.$x]) && $itd['tya'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tya'.$x]>6) - { - $tyc = 'Редки'; - } - if($itd['tya'.$x]>14) - { - $tyc = 'Малы'; - } - if($itd['tya'.$x]>34) - { - $tyc = 'Временами'; - } - if($itd['tya'.$x]>79) - { - $tyc = 'Регулярны'; - } - if($itd['tya'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tya'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tya'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x<=7) - { - if(isset($itd['tym'.$x]) && $itd['tym'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tym'.$x]>6) - { - $tyc = 'Редки'; - } - if($itd['tym'.$x]>14) - { - $tyc = 'Малы'; - } - if($itd['tym'.$x]>34) - { - $tyc = 'Временами'; - } - if($itd['tym'.$x]>79) - { - $tyc = 'Регулярны'; - } - if($itd['tym'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tym'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tym'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x <= 4) - { - if(isset($itd['add_oza'.$x]) && $itd['add_oza'.$x]>0) - { - $tyc = 'Слабая'; - if($itd['add_oza'.$x] == 4) - { - $tyc = 'Посредственная'; - } - if($itd['add_oza'.$x] == 2) - { - $tyc = 'Нормальная'; - } - if($itd['add_oza'.$x] == 3) - { - $tyc = 'Хорошая'; - } - if($itd['add_oza'.$x] == 5) - { - $tyc = 'Великолепная'; - } - if($tyc != '') { - $tr .= '
    • '.$is['oza'.$x].': '.$tyc; - } - } - $x++; - } - if(isset($itd['free_stats']) && $itd['free_stats']>0){ - echo '
    Свободные распределения:
    • Возможных распределений: '.$itd['free_stats']; - } -if($tr != '') { - echo '
    Особенности:'.$tr; -} - $is2 = ''; - - if(isset($itd['complect'])) - { - $is2 .= '
    Дополнительная информация:'; - } - if(isset($itd['complect'])) - { - //не отображается - $com1 = array('name'=>'Неизвестный Комплект','x'=>0,'text'=>''); - $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "'.$itd['complect'].'" ORDER BY `x` ASC LIMIT 20'); - while($itmc = mysql_fetch_array($spc)) - { - $com1['name'] = $itmc['name']; - $com1['text'] .= '    • '.$itmc['x'].': '; - //действие комплекта - $i1c = 0; $i2c = 0; - $i1e = lookStats($itmc['data']); - while($i1c0) - { - $i3c = '+'.$i3c; - } - if($i2c>0) - { - $com1['text'] .= '    '.$is[$items['add'][$i1c]].': '.$i3c; - }else{ - $com1['text'] .= $is[$items['add'][$i1c]].': '.$i3c; - } - $com1['text'] .= '
    '; - $i2c++; - } - $i1c++; - } - unset($i1c,$i2c,$i3c); - $com1['x']++; - } - $is2 .= '
    • Часть комплекта: '.$com1['name'].'
    '; - $is2 .= $com1['text']; - $is2 .= ''; - } - - $is2 .= ''; - - if($itm['info']!='') - { - $is2 .= '
    Описание:
    '.$itm['info'].'
    '; - } - - if(isset($itd['info']) && $itd['info']!='') - { - $is2 .= '
    '.$itd['info'].'
    '; - } - - if(isset($itm['use_text']) && $itm['max_text']-$itm['use_text'] > 0) { - $is2 .= '
    Количество символов: '.($itm['max_text']-$itm['use_text']).'
    '; - } - - if(isset($itd['noremont']) && $itd['noremont']>0) - { - $is2 .= '
    Предмет не подлежит ремонту
    '; - } - - if(isset($itd['frompisher']) && $itd['frompisher']>0) - { - $is2 .= '
    Предмет из подземелья
    '; - } - - if(isset($itm['dn_delete']) && $itm['dn_delete']>0) - { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; - } - - $is2 .= '
    '; - -echo $is2; - -?> -
    - Требуется минимальное:
    • Уровень: 4
    • Выносливость: 16
    • Сила: 16
    -Действует на:
    • Мф. увертывания (%): +30
    • Интуиция: +3
    • Сила: +5
    -Свойства предмета:
    • Урон: 8 - 18
    • Мф. против увертывания (%): 30
    • Мф. критического удара (%): 50
    • Мастерство владения мечами: 2
    • Зоны блокирования: +
    - -Особенности:
    • Колющие атаки: Малы
    • Рубящие атаки: Временами
    • Дробящие атаки: Редки
    • Режущие атаки: Малы
    - - - -Возможно усиление до 10го уровня
    - -*/ -?>
    <?=$itm['name']?>
    -
    - -

     

    -
    -

    - -

        
    - - - - Предметы
    - - - - - - -

    - Амуниция
    -    · Костыли 
    -    · Эликсиры и еда 
    - Заклинания
    -    · Заклинания 
    - Одежда
    -    · Тяжелая броня 
    -    · Легкая броня 
    -    · Венки 
    -    · Наручи 
    -    · Обувь 
    -    · Перчатки 
    -    · Плащи 
    -    · Поножи 
    -    · Пояса 
    -    · Рубахи 
    -    · Шлемы 
    - Оружие
    -    · Ёлки 
    -    · Дубины 
    -    · Кинжалы 
    -    · Мечи 
    -    · Топоры 
    -    · Посохи 
    -    · Цветы и Букеты 
    - Разное
    -    · Компоненты 
    -    · Магические предметы 
    -    · Подарки 
    -    · Руны 
    -    · Прочие предметы 
    - Щиты
    -    · Щиты 
    - Ювелирные товары
    -    · Кольца 
    -    · Ожерелья 
    -    · Серьги 
    -


    - - -
     
    - - - - - - - - - - - - - - -
    -  -
    Copyright © «www.new-combats.com»

    - - diff --git a/_incl_data/class/magic/Elemental/Fire.php b/_incl_data/class/magic/Elemental/Fire.php new file mode 100644 index 00000000..179e79b0 --- /dev/null +++ b/_incl_data/class/magic/Elemental/Fire.php @@ -0,0 +1,45 @@ +btl = $btl; + } + + /** Вспышка. Приёмы: 34(8), 67(9), 68 (10), 69(11) + * @param $level + * @param $fireTargetMultiplier + * @return array + */ + public function Flash($level, $fireTargetMultiplier = 0) + { + $baseDamage = [ + 8 => [40, 40], + 9 => [45, 45], + 10 => [50, 50], + 11 => [60, 60], + ]; + if (!is_numeric($fireTargetMultiplier)) { + $fireTargetMultiplier = 0; + } + $rawDamage = mt_rand($baseDamage[$level][0], $baseDamage[$level][1]); + $rawDamage = Math::addPercent($rawDamage, $fireTargetMultiplier); + return [ + 'name' => "Вспышка [$level]", + 'damage' => $rawDamage, + 'color' => $this->color, + 'colorCrit' => $this->colorCrit, + 'colorMiss' => $this->colorMiss, + ]; + } +} \ No newline at end of file diff --git a/_incl_data/class/magic/__magic.php b/_incl_data/class/magic/__magic.php index f3c02f4c..8088eb26 100644 --- a/_incl_data/class/magic/__magic.php +++ b/_incl_data/class/magic/__magic.php @@ -4,7 +4,7 @@ if(!defined('GAME')) die(); } -class Magic +class Magic2 { public $youuse = 0; diff --git a/_incl_data/class/magic/yarostzvezd.php b/_incl_data/class/magic/yarostzvezd.php index 6f5b7226..aabe48b3 100644 --- a/_incl_data/class/magic/yarostzvezd.php +++ b/_incl_data/class/magic/yarostzvezd.php @@ -1,50 +1,69 @@ stats['hpNow'] < 1 ) { - $u->error = 'Вы поглибли и не можете воспользоваться свитком...'; - }elseif( $u->info['tactic7'] < $pvr['trs7'] ) { - $u->error = 'Недостаточно духа, необходимо '.$pvr['trs7'].'...'; - }elseif( isset($btl->info['id']) ) { - /* - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], - '', - '{tm1} {u1} использовал заклятие "'.$itm['name'].'".', - ($btl->hodID) - ); - */ - - mysql_query('UPDATE `stats` SET `tactic7` = `tactic7` - "'.$pvr['trs7'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['tactic7'] = $u->info['tactic7']-$pvr['trs7']; - $u->stats['tactic7'] = $u->stats['tactic7']-$pvr['trs7']; - - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 325'); - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '".$u->info['id']."', 'Ярость Холодных Звезд', 'add_acestar=1', 0, 77, 0, '".$u->info['id']."', 0, 'priem', 325, 'elementalcrit.gif', 1, -1, 'яростьхолодныхзвезд', 0, 0, '', 0, 0, 0, 1, 0); +if ($itm['magic_inci'] == 'yarostzvezd') { + $pvr = []; + + //Действие при клике + $pvr['trs7'] = 5; + if ($u->stats['hpNow'] < 1) { + $u->error = 'Вы поглибли и не можете воспользоваться свитком...'; + } elseif ($u->info['tactic7'] < $pvr['trs7']) { + $u->error = 'Недостаточно духа, необходимо ' . $pvr['trs7'] . '...'; + } elseif (isset($btl->info['id'])) { + /* + $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], + '', + '{tm1} {u1} использовал заклятие "'.$itm['name'].'".', + ($btl->hodID) + ); + */ + + mysql_query('UPDATE `stats` SET `tactic7` = `tactic7` - "' . $pvr['trs7'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['tactic7'] = $u->info['tactic7'] - $pvr['trs7']; + $u->stats['tactic7'] = $u->stats['tactic7'] - $pvr['trs7']; + + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 325'); + mysql_query(" + INSERT INTO `eff_users` ( + `id_eff`, + `uid`, + `name`, + `data`, + `overType`, + `timeUse`, + `timeAce`, + `user_use`, + `delete`, + `v1`, + `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + ( + 22, + '" . $u->info['id'] . "', + 'Ярость Холодных Звезд', + 'add_acestar=1', + 0, + 77, + 0, + '" . $u->info['id'] . "', + 0, + 'priem', + 325, + 'elementalcrit.gif', 1, -1, 'яростьхолодныхзвезд', 0, 0, '', 0, 0, 0, 1, 0); "); - - $u->error = 'Вы почувствовали силу... '; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - - }else{ - $u->error = 'Свиток возможно использовать только в бою'; - } - - //Отнимаем тактики - //$this->mintr($pl); - - unset($pvr); + + $u->error = 'Вы почувствовали силу... '; + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); + } else { + $u->error = 'Свиток возможно использовать только в бою'; + } + + //Отнимаем тактики + //$this->mintr($pl); + + unset($pvr); } ?> \ No newline at end of file diff --git a/_incl_data/class/mobile.php b/_incl_data/class/mobile.php deleted file mode 100644 index 6492a04c..00000000 --- a/_incl_data/class/mobile.php +++ /dev/null @@ -1,1231 +0,0 @@ -, Nick Ilyin - * Original author: Victor Stanciu - * - * @license Code and contributions have 'MIT License' - * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt - * - * @link Homepage: http://mobiledetect.net - * GitHub Repo: https://github.com/serbanghita/Mobile-Detect - * Google Code: http://code.google.com/p/php-mobile-detect/ - * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md - * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples - * - * @version 2.8.2 - */ - -class Mobile_Detect -{ - /** - * Mobile detection type. - * - * @deprecated since version 2.6.9 - */ - const DETECTION_TYPE_MOBILE = 'mobile'; - - /** - * Extended detection type. - * - * @deprecated since version 2.6.9 - */ - const DETECTION_TYPE_EXTENDED = 'extended'; - - /** - * A frequently used regular expression to extract version #s. - * - * @deprecated since version 2.6.9 - */ - const VER = '([\w._\+]+)'; - - /** - * Top-level device. - */ - const MOBILE_GRADE_A = 'A'; - - /** - * Mid-level device. - */ - const MOBILE_GRADE_B = 'B'; - - /** - * Low-level device. - */ - const MOBILE_GRADE_C = 'C'; - - /** - * Stores the version number of the current release. - */ - const VERSION = '2.8.2'; - - /** - * A type for the version() method indicating a string return value. - */ - const VERSION_TYPE_STRING = 'text'; - - /** - * A type for the version() method indicating a float return value. - */ - const VERSION_TYPE_FLOAT = 'float'; - - /** - * The User-Agent HTTP header is stored in here. - * @var string - */ - protected $userAgent = null; - - /** - * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE. - * @var array - */ - protected $httpHeaders = array(); - - /** - * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED. - * - * @deprecated since version 2.6.9 - * - * @var string - */ - protected $detectionType = self::DETECTION_TYPE_MOBILE; - - /** - * HTTP headers that trigger the 'isMobile' detection - * to be true. - * - * @var array - */ - protected static $mobileHeaders = array( - - 'HTTP_ACCEPT' => array('matches' => array( - // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/ - 'application/x-obml2d', - // BlackBerry devices. - 'application/vnd.rim.html', - 'text/vnd.wap.wml', - 'application/vnd.wap.xhtml+xml' - )), - 'HTTP_X_WAP_PROFILE' => null, - 'HTTP_X_WAP_CLIENTID' => null, - 'HTTP_WAP_CONNECTION' => null, - 'HTTP_PROFILE' => null, - // Reported by Opera on Nokia devices (eg. C3). - 'HTTP_X_OPERAMINI_PHONE_UA' => null, - 'HTTP_X_NOKIA_GATEWAY_ID' => null, - 'HTTP_X_ORANGE_ID' => null, - 'HTTP_X_VODAFONE_3GPDPCONTEXT' => null, - 'HTTP_X_HUAWEI_USERID' => null, - // Reported by Windows Smartphones. - 'HTTP_UA_OS' => null, - // Reported by Verizon, Vodafone proxy system. - 'HTTP_X_MOBILE_GATEWAY' => null, - // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e. - 'HTTP_X_ATT_DEVICEID' => null, - // Seen this on a HTC. - 'HTTP_UA_CPU' => array('matches' => array('ARM')), - ); - - /** - * List of mobile devices (phones). - * - * @var array - */ - protected static $phoneDevices = array( - 'iPhone' => '\biPhone.*Mobile|\biPod', // |\biTunes - 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+', - 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m', - 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile', - // @todo: Is 'Dell Streak' a tablet or a phone? ;) - 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b', - 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925', - 'Samsung' => 'Samsung|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E', - 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)', - 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i', - 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile', - // @ref: http://www.micromaxinfo.com/mobiles/smartphones - // Added because the codes might conflict with Acer Tablets. - 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b', - 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. - 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) - // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH) - // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android. - 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790', - // @ref: http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones. - 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250', - 'iMobile' => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)', - // Added simvalley mobile just for fun. They have some interesting devices. - // @ref: http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html - 'SimValley' => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b', - // @Tapatalk is a mobile app; @ref: http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039 - 'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser' - ); - - /** - * List of tablet devices. - * - * @var array - */ - protected static $tabletDevices = array( - 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. - 'NexusTablet' => 'Android.*Nexus[\s]+(7|10)|^.*Android.*Nexus(?:(?!Mobile).)*$', - 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. - // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/ - 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE)\b', - // Only the Surface tablets with Windows RT are considered mobile. - // @ref: http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx - 'SurfaceTablet' => 'Windows NT [0-9.]+; ARM;', - // @ref: http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT - 'HPTablet' => 'HP Slate 7|HP ElitePad 900|hp-tablet|EliteBook.*Touch', - // @note: watch out for PadFone, see #132 - 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|TX201LA', - 'BlackBerryTablet' => 'PlayBook|RIM Tablet', - 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', - 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', - 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2', - // @ref: http://www.acer.ro/ac/ro/RO/content/drivers - // @ref: http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer) - // @ref: http://us.acer.com/ac/en/US/content/group/tablets - // @note: Can conflict with Micromax and Motorola phones codes. - 'AcerTablet' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810)\b|W3-810|\bA3-A10\b', - // @ref: http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/ - // @ref: http://us.toshiba.com/tablets/tablet-finder - // @ref: http://www.toshiba.co.jp/regza/tablet/ - 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO', - // @ref: http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html - 'LGTablet' => '\bL-06C|LG-V900|LG-V500|LG-V909\b', - 'FujitsuTablet' => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b', - // Prestigio Tablets http://www.prestigio.com/support - 'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD', - // @ref: http://support.lenovo.com/en_GB/downloads/default.page?# - 'LenovoTablet' => 'IdeaTab|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A1000|A2107|A2109|A1107|B6000|B8000|B8080-F)', - // @ref: http://www.yarvik.com/en/matrix/tablets/ - 'YarvikTablet' => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b', - 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB', - 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT', - // http://www.intenso.de/kategorie_en.php?kategorie=33 - // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate - 'IntensoTablet' => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab', - // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/ - 'IRUTablet' => 'M702pro', - 'MegafonTablet' => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b', - // @ref: http://www.e-boda.ro/tablete-pc.html - 'EbodaTablet' => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)', - // @ref: http://www.allview.ro/produse/droseries/lista-tablete-pc/ - 'AllViewTablet' => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)', - // @reference: http://wiki.archosfans.com/index.php?title=Main_Page - 'ArchosTablet' => '\b(101G9|80G9|A101IT)\b|Qilive 97R|ARCHOS 101G10', - // @ref: http://www.ainol.com/plugin.php?identifier=ainol&module=product - 'AinolTablet' => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark', - // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER - // @ref: Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser - // @ref: http://www.sony.jp/support/tablet/ - 'SonyTablet' => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551', - // @ref: db + http://www.cube-tablet.com/buy-products.html - 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT', - // @ref: http://www.cobyusa.com/?p=pcat&pcat_id=3001 - 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010', - // @ref: http://www.match.net.cn/products.asp - 'MIDTablet' => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733', - // @ref: http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets) - // @ref: http://www.imp3.net/14/show.php?itemid=20454 - 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)', - // @ref: http://www.rock-chips.com/index.php?do=prod&pid=2 - 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A', - // @ref: http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/ - 'FlyTablet' => 'IQ310|Fly Vision', - // @ref: http://www.bqreaders.com/gb/tablets-prices-sale.html - 'bqTablet' => 'bq.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant)|Maxwell.*Lite|Maxwell.*Plus', - // @ref: http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290 - // @ref: http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets) - 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim', - // Nec or Medias Tab - 'NecTablet' => '\bN-06D|\bN-08D', - // Pantech Tablets: http://www.pantechusa.com/phones/ - 'PantechTablet' => 'Pantech.*P4100', - // Broncho Tablets: http://www.broncho.cn/ (hard to find) - 'BronchoTablet' => 'Broncho.*(N701|N708|N802|a710)', - // @ref: http://versusuk.com/support.html - 'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b', - // @ref: http://www.zync.in/index.php/our-products/tablet-phablets - 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900', - // @ref: http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/ - 'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA', - // @ref: https://www.nabitablet.com/ - 'NabiTablet' => 'Android.*\bNabi', - 'KoboTablet' => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build', - // French Danew Tablets http://www.danew.com/produits-tablette.php - 'DanewTablet' => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b', - // Texet Tablets and Readers http://www.texet.ru/tablet/ - 'TexetTablet' => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE', - // @note: Avoid detecting 'PLAYSTATION 3' as mobile. - 'PlaystationTablet' => 'Playstation.*(Portable|Vita)', - // @ref: http://www.trekstor.de/surftabs.html - 'TrekstorTablet' => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2', - // @ref: http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets - 'PyleAudioTablet' => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b', - // @ref: http://www.advandigital.com/index.php?link=content-product&jns=JP001 - // @Note: because of the short codenames we have to include whitespaces to reduce the possible conflicts. - 'AdvanTablet' => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ', - // @ref: http://www.danytech.com/category/tablet-pc - 'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1', - // @ref: http://www.galapad.net/product.html - 'GalapadTablet' => 'Android.*\bG1\b', - // @ref: http://www.micromaxinfo.com/tablet/funbook - 'MicromaxTablet' => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b', - // http://www.karbonnmobiles.com/products_tablet.php - 'KarbonnTablet' => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b', - // @ref: http://www.myallfine.com/Products.asp - 'AllFineTablet' => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide', - // @ref: http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr= - 'PROSCANTablet' => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b', - // @ref: http://www.yonesnav.com/products/products.php - 'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026', - // @ref: http://www.cjshowroom.com/eproducts.aspx?classcode=004001001 - // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html) - 'ChangJiaTablet' => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503', - // @ref: http://www.gloryunion.cn/products.asp - // @ref: http://www.allwinnertech.com/en/apply/mobile.html - // @ref: http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB) - // @todo: Softwiner tablets? - // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions. - 'GUTablet' => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G - // @ref: http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118 - 'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10', - // @ref: http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/ - // @todo: add more tests. - 'OvermaxTablet' => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)', - // @ref: http://hclmetablet.com/India/index.php - 'HCLTablet' => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync', - // @ref: http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html - 'DPSTablet' => 'DPS Dream 9|DPS Dual 7', - // @ref: http://www.visture.com/index.asp - 'VistureTablet' => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10', - // @ref: http://www.mijncresta.nl/tablet - 'CrestaTablet' => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989', - // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309 - 'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b', - // Concorde tab - 'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan', - // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/ - 'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042', - // Modecom Tablets - http://www.modecom.eu/tablets/portal/ - 'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003', - // Vonino Tablets - http://www.vonino.eu/tablets - 'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b', - // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0 - 'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1', - // Storex Tablets - http://storex.fr/espace_client/support.html - // @note: no need to add all the tablet codes since they are guided by the first regex. - 'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab', - // Generic Vodafone tablets. - 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10', - // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb - // Aka: http://www.essentielb.fr/ - 'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2', - // Ross & Moor - http://ross-moor.ru/ - 'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711', - // i-mobile http://product.i-mobilephone.com/Mobile_Device - 'iMobileTablet' => 'i-mobile i-note', - // @ref: http://www.tolino.de/de/vergleichen/ - 'TolinoTablet' => 'tolino tab [0-9.]+|tolino shine', - // AudioSonic - a Kmart brand - // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72¤tPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1 - 'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b', - // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/ - // @todo: add them gradually to avoid conflicts. - 'AMPETablet' => 'Android.* A78 ', - // Skk Mobile - http://skkmobile.com.ph/product_tablets.php - 'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)', - // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1 - 'TecnoTablet' => 'TECNO P9', - // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3 - 'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b', - // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/ - 'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)', - // @ref: http://www.tesco.com/direct/hudl/ - 'Hudl' => 'Hudl HT7S3', - // @ref: http://www.telstra.com.au/home-phone/thub-2/ - 'TelstraTablet' => 'T-Hub2', - 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|ViewPad7|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab', - ); - - /** - * List of mobile Operating Systems. - * - * @var array - */ - protected static $operatingSystems = array( - 'AndroidOS' => 'Android', - 'BlackBerryOS' => 'blackberry|\bBB10\b|rim tablet os', - 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino', - 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b', - // @reference: http://en.wikipedia.org/wiki/Windows_Mobile - 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;', - // @reference: http://en.wikipedia.org/wiki/Windows_Phone - // http://wifeng.cn/?r=blog&a=view&id=106 - // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx - 'WindowsPhoneOS' => 'Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7', - 'iOS' => '\biPhone.*Mobile|\biPod|\biPad', - // http://en.wikipedia.org/wiki/MeeGo - // @todo: research MeeGo in UAs - 'MeeGoOS' => 'MeeGo', - // http://en.wikipedia.org/wiki/Maemo - // @todo: research Maemo in UAs - 'MaemoOS' => 'Maemo', - 'JavaOS' => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135 - 'webOS' => 'webOS|hpwOS', - 'badaOS' => '\bBada\b', - 'BREWOS' => 'BREW', - ); - - /** - * List of mobile User Agents. - * - * @var array - */ - protected static $browsers = array( - // @reference: https://developers.google.com/chrome/mobile/docs/user-agent - 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?', - 'Dolfin' => '\bDolfin\b', - 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+', - 'Skyfire' => 'Skyfire', - 'IE' => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+ - 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', - 'Bolt' => 'bolt', - 'TeaShark' => 'teashark', - 'Blazer' => 'Blazer', - // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3 - 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile', - // @ref: http://en.wikipedia.org/wiki/Midori_(web_browser) - //'Midori' => 'midori', - 'Tizen' => 'Tizen', - 'UCBrowser' => 'UC.*Browser|UCWEB', - // @ref: https://github.com/serbanghita/Mobile-Detect/issues/7 - 'DiigoBrowser' => 'DiigoBrowser', - // http://www.puffinbrowser.com/index.php - 'Puffin' => 'Puffin', - // @ref: http://mercury-browser.com/index.html - 'Mercury' => '\bMercury\b', - // @reference: http://en.wikipedia.org/wiki/Minimo - // http://en.wikipedia.org/wiki/Vision_Mobile_Browser - 'GenericBrowser' => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger' - ); - - /** - * Utilities. - * - * @var array - */ - protected static $utilities = array( - // Experimental. When a mobile device wants to switch to 'Desktop Mode'. - // @ref: http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/ - // @ref: https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011 - 'DesktopMode' => 'WPDesktop', - 'TV' => 'SonyDTV|HbbTV', // experimental - 'WebKit' => '(webkit)[ /]([\w.]+)', - 'Bot' => 'Googlebot|DoCoMo|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit', - 'MobileBot' => 'Googlebot-Mobile|DoCoMo|YahooSeeker/M1A1-R2D2', - // @todo: Include JXD consoles. - 'Console' => '\b(Nintendo|Nintendo WiiU|PLAYSTATION|Xbox)\b', - 'Watch' => 'SM-V700', - ); - - /** - * All possible HTTP headers that represent the - * User-Agent string. - * - * @var array - */ - protected static $uaHttpHeaders = array( - // The default User-Agent string. - 'HTTP_USER_AGENT', - // Header can occur on devices using Opera Mini. - 'HTTP_X_OPERAMINI_PHONE_UA', - // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/ - 'HTTP_X_DEVICE_USER_AGENT', - 'HTTP_X_ORIGINAL_USER_AGENT', - 'HTTP_X_SKYFIRE_PHONE', - 'HTTP_X_BOLT_PHONE_UA', - 'HTTP_DEVICE_STOCK_UA', - 'HTTP_X_UCBROWSER_DEVICE_UA' - ); - - /** - * The individual segments that could exist in a User-Agent string. VER refers to the regular - * expression defined in the constant self::VER. - * - * @var array - */ - protected static $properties = array( - - // Build - 'Mobile' => 'Mobile/[VER]', - 'Build' => 'Build/[VER]', - 'Version' => 'Version/[VER]', - 'VendorID' => 'VendorID/[VER]', - - // Devices - 'iPad' => 'iPad.*CPU[a-z ]+[VER]', - 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]', - 'iPod' => 'iPod.*CPU[a-z ]+[VER]', - //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'), - 'Kindle' => 'Kindle/[VER]', - - // Browser - 'Chrome' => array('Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'), - 'Coast' => array('Coast/[VER]'), - 'Dolfin' => 'Dolfin/[VER]', - // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference - 'Firefox' => 'Firefox/[VER]', - 'Fennec' => 'Fennec/[VER]', - // @reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx - 'IE' => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];'), - // http://en.wikipedia.org/wiki/NetFront - 'NetFront' => 'NetFront/[VER]', - 'NokiaBrowser' => 'NokiaBrowser/[VER]', - 'Opera' => array( ' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]' ), - 'Opera Mini' => 'Opera Mini/[VER]', - 'Opera Mobi' => 'Version/[VER]', - 'UC Browser' => 'UC Browser[VER]', - 'MQQBrowser' => 'MQQBrowser/[VER]', - 'MicroMessenger' => 'MicroMessenger/[VER]', - // @note: Safari 7534.48.3 is actually Version 5.1. - // @note: On BlackBerry the Version is overwriten by the OS. - 'Safari' => array( 'Version/[VER]', 'Safari/[VER]' ), - 'Skyfire' => 'Skyfire/[VER]', - 'Tizen' => 'Tizen/[VER]', - 'Webkit' => 'webkit[ /][VER]', - - // Engine - 'Gecko' => 'Gecko/[VER]', - 'Trident' => 'Trident/[VER]', - 'Presto' => 'Presto/[VER]', - - // OS - 'iOS' => ' \bOS\b [VER] ', - 'Android' => 'Android [VER]', - 'BlackBerry' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'), - 'BREW' => 'BREW [VER]', - 'Java' => 'Java/[VER]', - // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx - // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases - 'Windows Phone OS' => array( 'Windows Phone OS [VER]', 'Windows Phone [VER]'), - 'Windows Phone' => 'Windows Phone [VER]', - 'Windows CE' => 'Windows CE/[VER]', - // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd - 'Windows NT' => 'Windows NT [VER]', - 'Symbian' => array('SymbianOS/[VER]', 'Symbian/[VER]'), - 'webOS' => array('webOS/[VER]', 'hpwOS/[VER];'), - ); - - /** - * Construct an instance of this class. - * - * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored. - * If left empty, will use the global _SERVER['HTTP_*'] vars instead. - * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT - * from the $headers array instead. - */ - public function __construct( - array $headers = null, - $userAgent = null - ){ - $this->setHttpHeaders($headers); - $this->setUserAgent($userAgent); - } - - /** - * Get the current script version. - * This is useful for the demo.php file, - * so people can check on what version they are testing - * for mobile devices. - * - * @return string The version number in semantic version format. - */ - public static function getScriptVersion() - { - return self::VERSION; - } - - /** - * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. - * - * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract - * the headers. The default null is left for backwards compatibilty. - */ - public function setHttpHeaders($httpHeaders = null) - { - //use global _SERVER if $httpHeaders aren't defined - if (!is_array($httpHeaders) || !count($httpHeaders)) { - $httpHeaders = $_SERVER; - } - - //clear existing headers - $this->httpHeaders = array(); - - //Only save HTTP headers. In PHP land, that means only _SERVER vars that - //start with HTTP_. - foreach ($httpHeaders as $key => $value) { - if (substr($key,0,5) == 'HTTP_') { - $this->httpHeaders[$key] = $value; - } - } - } - - /** - * Retrieves the HTTP headers. - * - * @return array - */ - public function getHttpHeaders() - { - return $this->httpHeaders; - } - - /** - * Retrieves a particular header. If it doesn't exist, no exception/error is caused. - * Simply null is returned. - * - * @param string $header The name of the header to retrieve. Can be HTTP compliant such as - * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the - * all-caps, HTTP_ prefixed, underscore seperated awesomeness. - * - * @return string|null The value of the header. - */ - public function getHttpHeader($header) - { - //are we using PHP-flavored headers? - if (strpos($header, '_') === false) { - $header = str_replace('-', '_', $header); - $header = strtoupper($header); - } - - //test the alternate, too - $altHeader = 'HTTP_' . $header; - - //Test both the regular and the HTTP_ prefix - if (isset($this->httpHeaders[$header])) { - return $this->httpHeaders[$header]; - } elseif (isset($this->httpHeaders[$altHeader])) { - return $this->httpHeaders[$altHeader]; - } - } - - public function getMobileHeaders() - { - return self::$mobileHeaders; - } - - /** - * Get all possible HTTP headers that - * can contain the User-Agent string. - * - * @return array List of HTTP headers. - */ - public function getUaHttpHeaders() - { - return self::$uaHttpHeaders; - } - - /** - * Set the User-Agent to be used. - * - * @param string $userAgent The user agent string to set. - */ - public function setUserAgent($userAgent = null) - { - if (!empty($userAgent)) { - return $this->userAgent = $userAgent; - } else { - - $this->userAgent = null; - - foreach($this->getUaHttpHeaders() as $altHeader){ - if(!empty($this->httpHeaders[$altHeader])){ // @todo: should use getHttpHeader(), but it would be slow. (Serban) - $this->userAgent .= $this->httpHeaders[$altHeader] . " "; - } - } - - return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null); - - } - } - - /** - * Retrieve the User-Agent. - * - * @return string|null The user agent if it's set. - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or - * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set. - * - * @deprecated since version 2.6.9 - * - * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default - * parameter is null which will default to self::DETECTION_TYPE_MOBILE. - */ - public function setDetectionType($type = null) - { - if ($type === null) { - $type = self::DETECTION_TYPE_MOBILE; - } - - if ($type != self::DETECTION_TYPE_MOBILE && $type != self::DETECTION_TYPE_EXTENDED) { - return; - } - - $this->detectionType = $type; - } - - /** - * Retrieve the list of known phone devices. - * - * @return array List of phone devices. - */ - public static function getPhoneDevices() - { - return self::$phoneDevices; - } - - /** - * Retrieve the list of known tablet devices. - * - * @return array List of tablet devices. - */ - public static function getTabletDevices() - { - return self::$tabletDevices; - } - - /** - * Alias for getBrowsers() method. - * - * @return array List of user agents. - */ - public static function getUserAgents() - { - return self::getBrowsers(); - } - - /** - * Retrieve the list of known browsers. Specifically, the user agents. - * - * @return array List of browsers / user agents. - */ - public static function getBrowsers() - { - return self::$browsers; - } - - /** - * Retrieve the list of known utilities. - * - * @return array List of utilities. - */ - public static function getUtilities() - { - return self::$utilities; - } - - /** - * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). - * - * @deprecated since version 2.6.9 - * - * @return array All the rules (but not extended). - */ - public static function getMobileDetectionRules() - { - static $rules; - - if (!$rules) { - $rules = array_merge( - self::$phoneDevices, - self::$tabletDevices, - self::$operatingSystems, - self::$browsers - ); - } - - return $rules; - - } - - /** - * Method gets the mobile detection rules + utilities. - * The reason this is separate is because utilities rules - * don't necessary imply mobile. This method is used inside - * the new $detect->is('stuff') method. - * - * @deprecated since version 2.6.9 - * - * @return array All the rules + extended. - */ - public function getMobileDetectionRulesExtended() - { - static $rules; - - if (!$rules) { - // Merge all rules together. - $rules = array_merge( - self::$phoneDevices, - self::$tabletDevices, - self::$operatingSystems, - self::$browsers, - self::$utilities - ); - } - - return $rules; - } - - /** - * Retrieve the current set of rules. - * - * @deprecated since version 2.6.9 - * - * @return array - */ - public function getRules() - { - if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) { - return self::getMobileDetectionRulesExtended(); - } else { - return self::getMobileDetectionRules(); - } - } - - /** - * Retrieve the list of mobile operating systems. - * - * @return array The list of mobile operating systems. - */ - public static function getOperatingSystems() - { - return self::$operatingSystems; - } - - /** - * Check the HTTP headers for signs of mobile. - * This is the fastest mobile check possible; it's used - * inside isMobile() method. - * - * @return bool - */ - public function checkHttpHeadersForMobile() - { - - foreach($this->getMobileHeaders() as $mobileHeader => $matchType){ - if( isset($this->httpHeaders[$mobileHeader]) ){ - if( is_array($matchType['matches']) ){ - foreach($matchType['matches'] as $_match){ - if( strpos($this->httpHeaders[$mobileHeader], $_match) !== false ){ - return true; - } - } - return false; - } else { - return true; - } - } - } - - return false; - - } - - /** - * Magic overloading method. - * - * @method boolean is[...]() - * @param string $name - * @param array $arguments - * @return mixed - * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is' - */ - public function __call($name, $arguments) - { - //make sure the name starts with 'is', otherwise - if (substr($name, 0, 2) != 'is') { - throw new BadMethodCallException("No such method exists: $name"); - } - - $this->setDetectionType(self::DETECTION_TYPE_MOBILE); - - $key = substr($name, 2); - - return $this->matchUAAgainstKey($key); - } - - /** - * Find a detection rule that matches the current User-agent. - * - * @param null $userAgent deprecated - * @return boolean - */ - protected function matchDetectionRulesAgainstUA($userAgent = null) - { - // Begin general search. - foreach ($this->getRules() as $_regex) { - if (empty($_regex)) { - continue; - } - if ($this->match($_regex, $userAgent)) { - return true; - } - } - - return false; - } - - /** - * Search for a certain key in the rules array. - * If the key is found the try to match the corresponding - * regex agains the User-Agent. - * - * @param string $key - * @param null $userAgent deprecated - * @return mixed - */ - protected function matchUAAgainstKey($key, $userAgent = null) - { - // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc. - $key = strtolower($key); - - //change the keys to lower case - $_rules = array_change_key_case($this->getRules()); - - if (array_key_exists($key, $_rules)) { - if (empty($_rules[$key])) { - return null; - } - - return $this->match($_rules[$key], $userAgent); - } - - return false; - } - - /** - * Check if the device is mobile. - * Returns true if any type of mobile device detected, including special ones - * @param null $userAgent deprecated - * @param null $httpHeaders deprecated - * @return bool - */ - public function isMobile($userAgent = null, $httpHeaders = null) - { - - if ($httpHeaders) { - $this->setHttpHeaders($httpHeaders); - } - - if ($userAgent) { - $this->setUserAgent($userAgent); - } - - $this->setDetectionType(self::DETECTION_TYPE_MOBILE); - - if ($this->checkHttpHeadersForMobile()) { - return true; - } else { - return $this->matchDetectionRulesAgainstUA(); - } - - } - - /** - * Check if the device is a tablet. - * Return true if any type of tablet device is detected. - * - * @param string $userAgent deprecated - * @param array $httpHeaders deprecated - * @return bool - */ - public function isTablet($userAgent = null, $httpHeaders = null) - { - $this->setDetectionType(self::DETECTION_TYPE_MOBILE); - - foreach (self::$tabletDevices as $_regex) { - if ($this->match($_regex, $userAgent)) { - return true; - } - } - - return false; - } - - /** - * This method checks for a certain property in the - * userAgent. - * @todo: The httpHeaders part is not yet used. - * - * @param $key - * @param string $userAgent deprecated - * @param string $httpHeaders deprecated - * @return bool|int|null - */ - public function is($key, $userAgent = null, $httpHeaders = null) - { - // Set the UA and HTTP headers only if needed (eg. batch mode). - if ($httpHeaders) { - $this->setHttpHeaders($httpHeaders); - } - - if ($userAgent) { - $this->setUserAgent($userAgent); - } - - $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); - - return $this->matchUAAgainstKey($key); - } - - /** - * Some detection rules are relative (not standard), - * because of the diversity of devices, vendors and - * their conventions in representing the User-Agent or - * the HTTP headers. - * - * This method will be used to check custom regexes against - * the User-Agent string. - * - * @param $regex - * @param string $userAgent - * @return bool - * - * @todo: search in the HTTP headers too. - */ - public function match($regex, $userAgent = null) - { - // Escape the special character which is the delimiter. - $regex = str_replace('/', '\/', $regex); - - return (bool) preg_match('/'.$regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent)); - } - - /** - * Get the properties array. - * - * @return array - */ - public static function getProperties() - { - return self::$properties; - } - - /** - * Prepare the version number. - * - * @todo Remove the error supression from str_replace() call. - * - * @param string $ver The string version, like "2.6.21.2152"; - * - * @return float - */ - public function prepareVersionNo($ver) - { - $ver = str_replace(array('_', ' ', '/'), '.', $ver); - $arrVer = explode('.', $ver, 2); - - if (isset($arrVer[1])) { - $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions. - } - - return (float) implode('.', $arrVer); - } - - /** - * Check the version of the given property in the User-Agent. - * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) - * - * @param string $propertyName The name of the property. See self::getProperties() array - * keys for all possible properties. - * @param string $type Either self::VERSION_TYPE_STRING to get a string value or - * self::VERSION_TYPE_FLOAT indicating a float value. This parameter - * is optional and defaults to self::VERSION_TYPE_STRING. Passing an - * invalid parameter will default to the this type as well. - * - * @return string|float The version of the property we are trying to extract. - */ - public function version($propertyName, $type = self::VERSION_TYPE_STRING) - { - if (empty($propertyName)) { - return false; - } - - //set the $type to the default if we don't recognize the type - if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) { - $type = self::VERSION_TYPE_STRING; - } - - $properties = self::getProperties(); - - // Check if the property exists in the properties array. - if (array_key_exists($propertyName, $properties)) { - - // Prepare the pattern to be matched. - // Make sure we always deal with an array (string is converted). - $properties[$propertyName] = (array) $properties[$propertyName]; - - foreach ($properties[$propertyName] as $propertyMatchString) { - - $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); - - // Escape the special character which is the delimiter. - $propertyPattern = str_replace('/', '\/', $propertyPattern); - - // Identify and extract the version. - preg_match('/'.$propertyPattern.'/is', $this->userAgent, $match); - - if (!empty($match[1])) { - $version = ( $type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1] ); - - return $version; - } - - } - - } - - return false; - } - - /** - * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants. - * - * @return string One of the self::MOBILE_GRADE_* constants. - */ - public function mobileGrade() - { - $isMobile = $this->isMobile(); - - if ( - // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) - $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)>=4.3 || - $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)>=3.1 || - $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)>=3.1 || - - // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) - // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM - // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices - // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 - ( $this->version('Android', self::VERSION_TYPE_FLOAT)>2.1 && $this->is('Webkit') ) || - - // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 - $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT)>=7.0 || - - // Blackberry 7 - Tested on BlackBerry Torch 9810 - // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 - $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=6.0 || - // Blackberry Playbook (1.0-2.0) - Tested on PlayBook - $this->match('Playbook.*Tablet') || - - // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) - ( $this->version('webOS', self::VERSION_TYPE_FLOAT)>=1.4 && $this->match('Palm|Pre|Pixi') ) || - // Palm WebOS 3.0 - Tested on HP TouchPad - $this->match('hp.*TouchPad') || - - // Firefox Mobile (12 Beta) - Tested on Android 2.3 device - ( $this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=12 ) || - - // Chrome for Android - Tested on Android 4.0, 4.1 device - ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=4.0 ) || - - // Skyfire 4.1 - Tested on Android 2.3 device - ( $this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT)>=4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) || - - // Opera Mobile 11.5-12: Tested on Android 2.3 - ( $this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>11 && $this->is('AndroidOS') ) || - - // Meego 1.2 - Tested on Nokia 950 and N9 - $this->is('MeeGoOS') || - - // Tizen (pre-release) - Tested on early hardware - $this->is('Tizen') || - - // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser - // @todo: more tests here! - $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT)>=2.0 || - - // UC Browser - Tested on Android 2.3 device - ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) || - - // Kindle 3 and Fire - Tested on the built-in WebKit browser for each - ( $this->match('Kindle Fire') || - $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT)>=3.0 ) || - - // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet - $this->is('AndroidOS') && $this->is('NookTablet') || - - // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 - $this->version('Chrome', self::VERSION_TYPE_FLOAT)>=11 && !$isMobile || - - // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 - $this->version('Safari', self::VERSION_TYPE_FLOAT)>=5.0 && !$isMobile || - - // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 - $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=4.0 && !$isMobile || - - // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 - $this->version('MSIE', self::VERSION_TYPE_FLOAT)>=7.0 && !$isMobile || - - // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 - // @reference: http://my.opera.com/community/openweb/idopera/ - $this->version('Opera', self::VERSION_TYPE_FLOAT)>=10 && !$isMobile - - ){ - return self::MOBILE_GRADE_A; - } - - if ( - $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 || - $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<3.1 || - $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)<3.1 || - - // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 - $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<6 || - - //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 - ( $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)>=5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)<=6.5 && - ($this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 || $this->is('iOS')) ) || - - // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) - $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || - - // @todo: report this (tested on Nokia N71) - $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>=11 && $this->is('SymbianOS') - ){ - return self::MOBILE_GRADE_B; - } - - if ( - // Blackberry 4.x - Tested on the Curve 8330 - $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<5.0 || - // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) - $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT)<=5.2 - - ){ - return self::MOBILE_GRADE_C; - } - - //All older smartphone platforms and featurephones - Any device that doesn't support media queries - //will receive the basic, C grade experience. - return self::MOBILE_GRADE_C; - } -} -?> \ No newline at end of file diff --git a/_incl_data/class/noob.quests.php b/_incl_data/class/noob.quests.php deleted file mode 100644 index 965fc6c1..00000000 --- a/_incl_data/class/noob.quests.php +++ /dev/null @@ -1,196 +0,0 @@ -info['id'].'" AND `inOdet` = "'.mysql_real_escape_string($var[1]).'" AND `delete` = 0 LIMIT 1')); - if(isset($test['id'])) { - if($var[2] == 0 || $var[2] == $test['item_id'] ) { - $r = true; - } - } - } - return $r; - } - - /* - Проверки квеста - */ - public static function testAll() { - global $u; - //Доп проверки - $go = 1; - //Опыт - $ex = explode('>',self::$info['module']); - if( $ex[0] == 'exp' ) { - if( $ex[1] < $u->info['exp'] ) { - self::$info['module'] = ''; - } - } - $ex = explode('<',self::$info['module']); - if( $ex[0] == 'exp' ) { - if( $ex[1] < $u->info['exp'] ) { - mysql_query('UPDATE `users` SET `fnq` = "'.self::$info['next'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - self::$info['module'] = ''; - } - } - //Остальное - $ex = explode('=',self::$info['module']); - if( $ex[0] == 'slots' ) { - //Надетые предметы в слоты - $ex2 = explode(',',$ex[1]); - $i = 0; $gd = 1; - while( $i < count($ex2) ) { - if( !isset($u->stats['wp' . $ex2[$i] . 'id']) ) { - $gd = 0; - } - $i++; - } - if( $gd == 1 ) { - self::$info['module'] = ''; - } - } - // - $go = 1; - //Требования - $e1 = explode('|',self::$info['tr']); - $i = 0; - while( $i < count($e1) ) { - $ex = explode('=',$e1[$i]); - // - if( $ex[0] == 'exp' ) { - if( $ex[1] == '>' ) { - if( $ex[2] > $u->info['exp'] ) { - $go = 0; - } - }elseif( $ex[1] == '<' ) { - if( $ex[2] < $u->info['exp'] ) { - $go = 0; - } - } - } - // - $i++; - } - // - // - return $go; - } - - - /* - Начало проверки обучения - */ - public static function start() { - global $u; - if( $u->info['fnq'] == 0 ) { - $u->info['fnq'] = 1; - mysql_query('UPDATE `users` SET `fnq` = "'.$u->info['fnq'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }else{ - if( $u->info['level'] > 2 ) { - mysql_query('UPDATE `users` SET `fnq` = "-1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - if( $u->info['fnq'] == 0 ) { - //Начало обучения - /*$humor = array( - 0 => array( - ':maniac: Сильно не бейте ;)',':beggar: Будет попрошайничать - бейте!',':pal: Возможно светлый!', - ':vamp: Возможно темный!',':susel: Судя по здоровенному б - ':friday: Не долго думав он начал искать собутыльника!',':doc: Лекарь: Новичок! Да, да! Ты! Если тебя сломают - у знахаря тебя соберут обратно!' - ), - 1 => array( - ':maniac: Помните! Девочек не бьем ;)',':nail: Она красит ногти, не отвлекайте все сразу ;)',':pal: Возможно светлая!', - ':vamp: Возможно темная!',':rev: Судя по красивой одежде - это женщина!',':hug: И сразу же кинулась всех целовать!', - ':angel2: Ангел сошел с небес...' - ) - ); - $humor = $humor[$u->info['sex']]; - */ - $u->info['fnq'] = 1; - mysql_query('UPDATE `users` SET `fnq` = "'.$u->info['fnq'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Отправляем сообщение в чат о новичке - //$u->send('','','','','','В нашем мире появился новый игрок "' . $u->info['login'] . '"! '.$humor[rand(0,count($humor)-1)].'',time(),6,0,0,0,1,0); - }else{ - self::$info = mysql_fetch_array(mysql_query('SELECT * FROM `an_quest` WHERE `id` = "'.$u->info['fnq'].'" LIMIT 1')); - if(isset(self::$info['id'])) { - //Тестируем квест - $go = self::testAll(); - if( $go == 0 ) { - //Требования не подходят - self::$info = array(); - }elseif( $u->info['marker'] == self::$info['module'] || self::$info['module'] == '' || (self::$info['module'] == 'next' && isset($_GET['nextfnq'])) || self::test1(self::$info['module']) == true ) { - //Квест выполнен, действие сделано! - if( self::$info['room'] == '' || self::$info['room'] == $u->room['name'] ) { - //Выдаем награду - $nag = explode('|',self::$info['win']); - if( $nag[3] != '0' ) { - //Выдаем предмет - $ng = explode(',',$nag[3]); - $i = 0; - while( $i < count($ng) ) { - $ngi = explode(',',$ng[$i]); - $j = 0; - while( $j < count($ngi) ) { - $ngj = explode('=',$ngi[$j]); - // id = srok = data - $ngjs = ''; - if( $ngj[1] > 0 ) { - $ngjs .= '|srok='.$ngj[1].''; - } - $u->addItem($ngj[0], $u->info['id'], $ngjs); - $j++; - } - $i++; - } - } - if( $nag[4] != '0' ) { - //Выдаем зубы - $u->info['money4'] += $nag[4]; - mysql_query('UPDATE `users` SET `money4` = "'.$u->info['money4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - $u->info['fnq'] = self::$info['next']; - mysql_query('UPDATE `users` SET `fnq` = "'.$u->info['fnq'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - self::$info = mysql_fetch_array(mysql_query('SELECT * FROM `an_quest` WHERE `id` = "'.$u->info['fnq'].'" LIMIT 1')); - $go = self::testAll(); - if( $go == 0 || self::$info['act'] == 'deadline' ) { - //Требования не подходят - self::$info = array(); - } - } - }else{ - //Текущий квест - } - - if(isset(self::$info['id'])) { - self::$info['info'] = str_replace('{login}',$u->info['login'],self::$info['info']); - self::$info['info'] = str_replace('{level}',$u->info['level'],self::$info['info']); - self::$info['info'] = str_replace("\r\n",'
    ',self::$info['info']); - echo ''; - }else{ - echo ''; - } - }else{ - //Квест не найден - echo ''; - } - // - } - } - -} - -?> \ No newline at end of file diff --git a/_incl_data/class/pay.php b/_incl_data/class/pay.php deleted file mode 100644 index 554d326e..00000000 --- a/_incl_data/class/pay.php +++ /dev/null @@ -1,243 +0,0 @@ - 'pay_operations', //Таблица в которую заносятся данные - 'db_host' => 'localhost', - 'db_user' => 'newcom1_abk', - 'db_pass' => '4nWYsIM[c?}P', - 'db_base' => 'newcom1_abk', - /* Настройки платежей */ - 'ip_list' => array('127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'), //Указывать через запятую (Разрешенные IP) - 'key' => 'qtzl0igb', //gamedealer key - 'id' => '65643' //ID проекта - ), - $ip = '', - $BACK = array(); //Результат который возвращаем в конце - - //Кодируем из ЮТФ-8 в Кирилицу - public function in($text) { - return iconv("UTF-8","cp1251",$text); - } - - //Кодируем из Кирилицу в ЮТФ-8 - public function out($text) { - return iconv("cp1251","UTF-8",$text); - } - - //Добавляем данные в базу данных - public function add($type,$value,$money) { - mysql_query('INSERT INTO `'.$this->c['db_name'].'` (`time`,`type`,`ip`,`value`,`money`,`project`) VALUES ("'.time().'","'.mysql_real_escape_string($type).'","'.$_SERVER['HTTP_X_REAL_IP'].'","'.mysql_real_escape_string($value).'","'.mysql_real_escape_string($money).'","'.mysql_real_escape_string($this->id).'")'); - } - - //Подключаемся к базе данных - public function connect_db() { - $db = mysql_connect($this->c['db_host'],$this->c['db_user'],$this->c['db_pass']) or die('Ошибка подключения к MySQL серверу!'); - mysql_select_db($this->c['db_base'],$db) or die('Ошибка подключения к базе данных!'); - mysql_query('SET NAMES cp1251'); - } - - public function output($a,$v = NULL) { - $r = ''; - $i = 0; - while($i < count($a)) { - $rn = ''; - $tb = ''; - if($v != NULL) { - $rn = "\r\n"; - $tb = " "; - } - $r .= $rn.'<'.$a[$i][0].'>'; - if(!is_array($a[$i][1])) { - $rn = ''; - $tb = ''; - $r .= $rn.$tb.($this->out($a[$i][1])); - }else{ - if($i > 0) { - $r .= $rn; - } - $r .= $tb.($this->output($a[$i][1],1)); - } - $r .= $rn.''; - $i++; - } - return $r; - } - - //Генерируем XML-файл - public function backInformation() { - header('Content-Type: text/html/force-download'); - echo ''; - echo $this->output($this->BACK,1); - } - - //Проверка существования персонажа - public function test_accaunt($nick) { - $r = false; - $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `id` = "'.mysql_real_escape_string($nick).'" LIMIT 1')); - if(isset($nick['id'])) { - $r = true; - } - return $r; - } - - //Получает счет в банке по логину - public function getBank($nick) { - $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "'.mysql_real_escape_string($nick).'" LIMIT 1')); - $nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `uid` = "'.mysql_real_escape_string($nick['id']).'" LIMIT 1')); - return $nick['id']; - } - - //Поиск логина - public function bank_user($nick) { - $nick = mysql_fetch_array(mysql_query('SELECT `id`,`uid FROM `bank` WHERE `id` = "'.mysql_real_escape_string($nick).'" LIMIT 1')); - $nick = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `login` = "'.mysql_real_escape_string($nick['uid']).'" LIMIT 1')); - return $nick['login']; - } - - //Начинаем обработку запросов - public function start_session() { - - $this->ip = $_SERVER['HTTP_X_REAL_IP']; - - //Подключаемся к БД - $this->connect_db(); - - //Получаем данные запроса - //$xml = file_get_contents('php://input'); - - //Парсинг XML запроса - if(function_exists('simplexml_load_string')) { - $xml = simplexml_load_string($xml); - }else{ - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Не удалось произвести обработку запроса')))); - die($this->backInformation()); - } - - $this->id = $xml->projectid; - - if(!in_array($this->ip,$this->c['ip_list'])) { - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Нет доступа с данного IP')))); - die($this->backInformation()); - } - - //Обработка запросов - if($xml->method == 'check_balance') { - //MD5(method+MD5(gdKey)) - - $sign = md5($xml->method.md5($this->c['key'])); - - if($sign == $xml->sign) { - //Баланс дилера - $balance = 1000000; - $this->BACK = array(array('gdanswer',array(array('status','1'),array('desc','Баланс дилера: '.$balance),array('balance',$balance)))); - $this->add('4','check:'.$xml->nick.':1'.$r,0); - } - - }elseif($xml->method == 'check') { - /* - nick - логин персонажа MD5(nick+method+MD5(gdKey)) */ - - $sign = md5($xml->nick.$xml->method.md5($this->c['key'])); - - if($sign == $xml->sign) { - $xml->nick = $this->in($xml->nick); - if($this->test_accaunt($xml->nick) == true) { - //Персонаж найден и зачисляем ему игровую валюту - $this->BACK = array(array('gdanswer',array(array('status','1'),array('desc','Банковский счет найден')))); - $this->add('3','check:'.$xml->nick.':1'.$r,0); - }else{ - //Персонаж не найден - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Платеж не обработан. Банковский счет не найден.')))); - $this->add('-1','Персонаж не найден:pay:'.$xml->nick.':0',0); - } - } - }elseif($xml->method == 'pay') { - /* Проводим платеж - nick - логин аккаунта , projectid - id проекта , sign , amount - деньги , payid - id платежа */ - - $sign = md5($xml->nick.$xml->projectid.$xml->amount.$xml->payid.$xml->method.md5($this->c['key'])); - - if($sign == $xml->sign) { - $xml->nick = $this->in($xml->nick); - if($this->test_accaunt($xml->nick) == true) { - //Персонаж найден и зачисляем ему игровую валюту - $bank = $this->test_accaunt($xml->nick); - if($bank > 0) { - mysql_query('UPDATE `bank` SET `money2` = `money2` + '.mysql_real_escape_string($xml->amount).' WHERE `id` = "'.mysql_real_escape_string($xml->nick).'" LIMIT 1'); - $this->BACK = array(array('gdanswer',array(array('status','1'),array('desc','Платеж прошел успешно'),array('id',$this->c['id'])))); - $this->add('2','pay:'.$xml->nick.':'.$xml->projectid.':'.$xml->sign.':'.$xml->amount.':'.$xml->payid.':'.$bank['id'],$xml->amount); - - $user = mysql_fetch_array(mysql_query('SELECT `id`,`uid` FROM `bank` WHERE `id` = "'.mysql_real_escape_string($xml->nick).'" LIMIT 1')); - $user = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`city`,`sex`,`room` FROM `users` WHERE `id` = "'.mysql_real_escape_string($user['uid']).'" LIMIT 1')); - - mysql_query('UPDATE `users` SET `catch` = `catch` + '.mysql_real_escape_string(floor($xml->amount)).' WHERE `id` = "'.mysql_real_escape_string($xml->nick).'" LIMIT 1'); - - $r = ''.date('d.m.Y H:i').' Алхимик Enchanter / Автоматическая оплата сообщает: '; - - if($user['sex'] == 1) { - $r .= 'Уважаемая'; - }else{ - $r .= 'Уважаемый'; - } - - $r .= ' '.$user['login'].', на Ваш банковский счет №'.$bank.' зачислено '.$xml->amount.' Ekr. Благодарим Вас за покупку!'; - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$user['city']."','".$user['room']."','','".$user['login']."','".$r."','-1','5','0')"); - - }else{ - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','У пользователя отсутствует банк'),array('id',$this->c['id'])))); - $this->add('-1','У персонажа отсутствует банк:pay:'.$xml->nick.':'.$xml->projectid.':'.$xml->sign.':'.$xml->amount.':'.$xml->payid.':'.$bank['id'],$xml->amount); - } - }else{ - //Персонаж не найден - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Платеж не обработан. Персонаж не найден.')))); - $this->add('-1','Персонаж не найден:pay:'.$xml->nick.':0',0); - } - }else{ - //Ошибка сигнатуры - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Ошибка сигнатуры')))); - $this->add('-1','Ошибка сигнатуры:pay:'.$xml->nick.':0',0); - } - }elseif($xml->method == 'check_login') { - /* Проверка аккаунта - nick - логин аккаунта , projectid - id проекта , sign */ - $sign = md5($xml->nick.$xml->method.md5($this->c['key'])); - - if($sign == $xml->sign) { - $xml->nick = $this->in($xml->nick); - if($this->test_accaunt($xml->nick) == true) { - //Персонаж найден - $this->BACK = array(array('gdanswer',array(array('status','1'),array('desc','Счет найден'),array('addinfo',$this->bank_user($xml->nick))))); - $this->add('1','check_login:'.$xml->nick.':1'.$r,0); - }else{ - //Персонаж не найден - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Счет не найден')))); - $this->add('-1','Персонаж не найден:check_login:'.$xml->nick.':0',0); - } - }else{ - //Ошибка сигнатуры - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Ошибка сигнатуры')))); - $this->add('-1','Ошибка сигнатуры:pay:'.$xml->nick.':0',0); - } - }else{ - $this->BACK = array(array('gdanswer',array(array('status','-1'),array('desc','Неизвестный тип запроса')))); - $this->add('-1','Неизвестный тип запроса:error_method:gamedealer',0); - } - - //Заносим информацию - /* Пример результата запроса - $this->BACK = array( - array('gdanswer',array(array('status',-100),array('desc','Описание запроса'))) - ); - */ - - //Возвращаем результат - $this->backInformation(); - } -} - -$pay = new GameDealerClass; -$pay->start_session(); -?> diff --git a/_incl_data/class/priem/100.php b/_incl_data/class/priem/100.php index 5451f4ec..96afd57d 100644 --- a/_incl_data/class/priem/100.php +++ b/_incl_data/class/priem/100.php @@ -27,8 +27,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; @@ -102,8 +102,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/101.php b/_incl_data/class/priem/101.php index ca48a966..7b9fb481 100644 --- a/_incl_data/class/priem/101.php +++ b/_incl_data/class/priem/101.php @@ -27,8 +27,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; @@ -102,8 +102,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/108.php b/_incl_data/class/priem/108.php index 68286610..4402c613 100644 --- a/_incl_data/class/priem/108.php +++ b/_incl_data/class/priem/108.php @@ -38,8 +38,8 @@ while( $pvr['ix'] < count($btl->users) ) { $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/109.php b/_incl_data/class/priem/109.php index 051e67ce..b6952036 100644 --- a/_incl_data/class/priem/109.php +++ b/_incl_data/class/priem/109.php @@ -38,8 +38,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/110.php b/_incl_data/class/priem/110.php index 9ecff908..8e5b1754 100644 --- a/_incl_data/class/priem/110.php +++ b/_incl_data/class/priem/110.php @@ -38,8 +38,8 @@ while( $pvr['ix'] < count($btl->users) ) { $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/121.php b/_incl_data/class/priem/121.php index c60fc915..6b801fff 100644 --- a/_incl_data/class/priem/121.php +++ b/_incl_data/class/priem/121.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/122.php b/_incl_data/class/priem/122.php index 8d31cdd8..aac70b39 100644 --- a/_incl_data/class/priem/122.php +++ b/_incl_data/class/priem/122.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/123.php b/_incl_data/class/priem/123.php index 146c2263..b9f0296e 100644 --- a/_incl_data/class/priem/123.php +++ b/_incl_data/class/priem/123.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/124.php b/_incl_data/class/priem/124.php index 84875ed0..f18b0b0c 100644 --- a/_incl_data/class/priem/124.php +++ b/_incl_data/class/priem/124.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/125.php b/_incl_data/class/priem/125.php index 37f998da..d6a4baf3 100644 --- a/_incl_data/class/priem/125.php +++ b/_incl_data/class/priem/125.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/141.php b/_incl_data/class/priem/141.php index 2f2383e5..bd87861d 100644 --- a/_incl_data/class/priem/141.php +++ b/_incl_data/class/priem/141.php @@ -1,130 +1,90 @@ -stats[$btl->uids[$uid]]['um_priem'][$j_id])) { - global $u, $btl; - $yron = $yron/4; - $btl->priemAddLogFast( $uid, 0, "Призрачная защита", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() ); - if( $yron < 0 ) { - $yron = 1; - } - $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; - } - return round($yron); - }; -}elseif( isset($pr_tested_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - /* - if((!isset($btl->atacks[$id]['newsf5']) || $btl->atacks[$id]['newsf5'] == false) && (!isset($btl->atacks[$id]['stopfx']) || $btl->atacks[$id]['stopfx'] == false)) { - if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1'); - unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); - $btl->stats[$btl->uids[$uid]]['u_priem'][$j_id] = false; - } - } - */ - // - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - $j = 0; $k = 0; $wp = 3; - while($j < count($at['p'][$a]['atack'])) { - if( isset($at['p'][$a]['atack'][$j]['yron']) && ( - $at['p'][$a]['atack'][$j][1] == 1 || - $at['p'][$a]['atack'][$j][1] == 4 || - $at['p'][$a]['atack'][$j][1] == 5 )) { - //if( !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - // - $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/4); - $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/4); - $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/4); - $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/4); - $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/4); - // - if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; } - // - /*if( $pvr['used'] == 0 ) { - $at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', - "Призрачная защита", - "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", - '.($btl->hodID + 1).' );'; - }*/ - // спасение - $btl->spaCheck($u1); - // спасение - // - $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); - $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); - // - $at['p'][$a]['priems']['kill'][$uid][$j_id] = true; - //} - } - $j++; - } - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - //Действие при клике - $this->addEffPr($pl,$id); +$pvr = []; +if (isset($pr_momental_this)) { + $fx_moment = function ($uid, $enemy, $j_id, $yron, $profil) { + if (!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { + global $btl; + $btl->priemAddLogFast($uid, 0, "Призрачная защита", + '{tm1} ' . $btl->addlt(1, 17, $btl->users[$btl->uids[$uid]]['sex'], null), + 0, time()); + + //$yron = max($yron / 4, 1); + $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; + } + return round($yron); + }; +} elseif (isset($pr_tested_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + return $at; + }; + unset($pr_used_this); +} elseif (isset($pr_used_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема + global $u, $btl; + // + //Параметры приема + $pvr['used'] = 0; + // +// $uid1 = $btl->atacks[$id]['uid1']; +// $uid2 = $btl->atacks[$id]['uid2']; +// if ($uid == $uid2) { +// $a = 1; +// $b = 2; +// $u1 = $uid1; +// $u2 = $uid2; +// } elseif ($uid == $uid1) { +// $a = 2; +// $b = 1; +// $u1 = $uid2; +// $u2 = $uid1; +// } +// if ($a > 0) { +// $j = 0; +// $k = 0; +// $wp = 3; +// while ($j < count($at['p'][$a]['atack'])) { +// if ( +// isset($at['p'][$a]['atack'][$j]['yron']) && +// ( +// $at['p'][$a]['atack'][$j][1] == 1 || +// $at['p'][$a]['atack'][$j][1] == 4 || +// $at['p'][$a]['atack'][$j][1] == 5 +// ) +// ) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = max(round($at['p'][$a]['atack'][$j]['yron']['y'] / 4), 1); +// $at['p'][$a]['atack'][$j]['yron']['r'] = min(round($at['p'][$a]['atack'][$j]['yron']['r'] / 4), -1); +// $at['p'][$a]['atack'][$j]['yron']['k'] = max(round($at['p'][$a]['atack'][$j]['yron']['k'] / 4), 1); +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = max(round($at['p'][$a]['atack'][$j]['yron']['m_k'] / 4), 1); +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = max(round($at['p'][$a]['atack'][$j]['yron']['m_y'] / 4), 1); +// +// // спасение +// $btl->spaCheck($u1); +// // спасение +// // +// $at['p'][$a]['atack'][$j]['yron']['used'][] = [$j_id, $uid, $pvr['used']]; +// $at['p'][$a]['atack'][$j]['yron']['kill'][] = [$j_id, $uid, $pvr['kill']]; +// // +// $at['p'][$a]['priems']['kill'][$uid][$j_id] = true; +// //} +// } +// $j++; +// } +// } +// // -- конец приема + return $at; + }; + unset($pr_used_this); +} else { + //Действие при клике + $this->addEffPr($pl, $id); } unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/142.php b/_incl_data/class/priem/142.php index ff01a68f..40c7874f 100644 --- a/_incl_data/class/priem/142.php +++ b/_incl_data/class/priem/142.php @@ -1,127 +1,140 @@ stats[$btl->uids[$uid]]['um_priem'][$j_id])) { - global $u, $btl; - if( $profil == 5 ) { - $yron = $yron/2; - /*$btl->priemAddLogFast( $uid, 0, "Призрачный огонь", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() );*/ - if( $yron < 0 ) { - $yron = 1; - } - $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; - } - } - return round($yron); - }; -}elseif( isset($pr_tested_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1'); - unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); - } - // - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - $j = 0; $k = 0; $wp = 3; - while($j < count($at['p'][$a]['atack'])) { - if( isset($at['p'][$a]['atack'][$j]['yron']) && ( - $at['p'][$a]['atack'][$j][1] == 1 || - $at['p'][$a]['atack'][$j][1] == 4 || - $at['p'][$a]['atack'][$j][1] == 5 )) { - if( !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - // - if( $at['p'][$a]['atack'][$j]['yron']['w_type'] == 5 ) { - $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/2); - $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/2); - $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/2); - // - if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; } - // - if( $pvr['used'] == 0 ) { - /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', - "Призрачный огонь", - "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", - '.($btl->hodID + 1).' );';*/ - } - // - $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); - $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); - // - //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; - } - // - } - } - $j++; - } - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - //Действие при клике - $this->addEffPr($pl,$id); +$pvr = []; +if (isset($pr_momental_this)) { + $fx_moment = function ($uid, $enemy, $j_id, $yron, $profil) { + if (!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { + global $u, $btl; + if ($profil == 5) { + //$yron = $yron / 2; + /*$btl->priemAddLogFast( $uid, 0, "Призрачный огонь", + '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', + 0, time() );*/ +// if ($yron < 0) { +// $yron = 1; +// } + $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; + } + } + return round($yron); + }; +} elseif (isset($pr_tested_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема + global $u, $btl; + // + //Параметры приема + $pvr['used'] = 0; + // + $uid1 = $btl->atacks[$id]['uid1']; + $uid2 = $btl->atacks[$id]['uid2']; + if ($uid == $uid2) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } elseif ($uid == $uid1) { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3] . '" AND `uid` = "' . $uid . '" LIMIT 1'); + unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); + } + // + // -- конец приема + return $at; + }; + unset($pr_used_this); +} elseif (isset($pr_used_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема +// global $u, $btl; +// // +// //Параметры приема +// $pvr['used'] = 0; +// // +// $uid1 = $btl->atacks[$id]['uid1']; +// $uid2 = $btl->atacks[$id]['uid2']; +// if ($uid == $uid2) { +// $a = 1; +// $b = 2; +// $u1 = ${'uid1'}; +// $u2 = ${'uid2'}; +// } elseif ($uid == $uid1) { +// $a = 2; +// $b = 1; +// $u1 = ${'uid2'}; +// $u2 = ${'uid1'}; +// } +// if ($a > 0) { +// $j = 0; +// $k = 0; +// $wp = 3; +// while ($j < count($at['p'][$a]['atack'])) { +// if (isset($at['p'][$a]['atack'][$j]['yron']) && ( +// $at['p'][$a]['atack'][$j][1] == 1 || +// $at['p'][$a]['atack'][$j][1] == 4 || +// $at['p'][$a]['atack'][$j][1] == 5)) { +// if (!isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { +// // +// if ($at['p'][$a]['atack'][$j]['yron']['w_type'] == 5) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y'] / 2); +// // +// if ($at['p'][$a]['atack'][$j]['yron']['y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['r'] >= 0) { +// $at['p'][$a]['atack'][$j]['yron']['r'] = -1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; +// } +// // +// if ($pvr['used'] == 0) { +// /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', +// "Призрачный огонь", +// "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", +// '.($btl->hodID + 1).' );';*/ +// } +// // +// $at['p'][$a]['atack'][$j]['yron']['used'][] = [$j_id, $uid, $pvr['used']]; +// $at['p'][$a]['atack'][$j]['yron']['kill'][] = [$j_id, $uid, $pvr['kill']]; +// // +// //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; +// } +// // +// } +// } +// $j++; +// } +// } +// // -- конец приема + return $at; + }; + unset($pr_used_this); +} else { + //Действие при клике + $this->addEffPr($pl, $id); } unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/144.php b/_incl_data/class/priem/144.php index 522cdd4b..838de628 100644 --- a/_incl_data/class/priem/144.php +++ b/_incl_data/class/priem/144.php @@ -1,127 +1,140 @@ stats[$btl->uids[$uid]]['um_priem'][$j_id])) { - global $u, $btl; - if( $profil == 6 ) { - $yron = $yron/2; - /*$btl->priemAddLogFast( $uid, 0, "Призрачный воздух", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() );*/ - if( $yron < 0 ) { - $yron = 1; - } - $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; - } - } - return round($yron); - }; -}elseif( isset($pr_tested_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1'); - unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); - } - // - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - $j = 0; $k = 0; $wp = 3; - while($j < count($at['p'][$a]['atack'])) { - if( isset($at['p'][$a]['atack'][$j]['yron']) && ( - $at['p'][$a]['atack'][$j][1] == 1 || - $at['p'][$a]['atack'][$j][1] == 4 || - $at['p'][$a]['atack'][$j][1] == 5 )) { - if( !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - // - if( $at['p'][$a]['atack'][$j]['yron']['w_type'] == 6 ) { - $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/2); - $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/2); - $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/2); - // - if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; } - // - if( $pvr['used'] == 0 ) { - /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', - "Призрачный воздух", - "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", - '.($btl->hodID + 1).' );';*/ - } - // - $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); - $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); - // - //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; - } - // - } - } - $j++; - } - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - //Действие при клике - $this->addEffPr($pl,$id); +$pvr = []; +if (isset($pr_momental_this)) { + $fx_moment = function ($uid, $enemy, $j_id, $yron, $profil) { + if (!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { + global $u, $btl; + if ($profil == 6) { + //$yron = $yron / 2; + /*$btl->priemAddLogFast( $uid, 0, "Призрачный воздух", + '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', + 0, time() );*/ +// if ($yron < 0) { +// $yron = 1; +// } + $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; + } + } + return round($yron); + }; +} elseif (isset($pr_tested_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема + global $u, $btl; + // + //Параметры приема + $pvr['used'] = 0; + // + $uid1 = $btl->atacks[$id]['uid1']; + $uid2 = $btl->atacks[$id]['uid2']; + if ($uid == $uid2) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } elseif ($uid == $uid1) { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3] . '" AND `uid` = "' . $uid . '" LIMIT 1'); + unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); + } + // + // -- конец приема + return $at; + }; + unset($pr_used_this); +} elseif (isset($pr_used_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { +// // -- начало приема +// global $u, $btl; +// // +// //Параметры приема +// $pvr['used'] = 0; +// // +// $uid1 = $btl->atacks[$id]['uid1']; +// $uid2 = $btl->atacks[$id]['uid2']; +// if ($uid == $uid2) { +// $a = 1; +// $b = 2; +// $u1 = ${'uid1'}; +// $u2 = ${'uid2'}; +// } elseif ($uid == $uid1) { +// $a = 2; +// $b = 1; +// $u1 = ${'uid2'}; +// $u2 = ${'uid1'}; +// } +// if ($a > 0) { +// $j = 0; +// $k = 0; +// $wp = 3; +// while ($j < count($at['p'][$a]['atack'])) { +// if (isset($at['p'][$a]['atack'][$j]['yron']) && ( +// $at['p'][$a]['atack'][$j][1] == 1 || +// $at['p'][$a]['atack'][$j][1] == 4 || +// $at['p'][$a]['atack'][$j][1] == 5)) { +// if (!isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { +// // +// if ($at['p'][$a]['atack'][$j]['yron']['w_type'] == 6) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y'] / 2); +// // +// if ($at['p'][$a]['atack'][$j]['yron']['y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['r'] >= 0) { +// $at['p'][$a]['atack'][$j]['yron']['r'] = -1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; +// } +// // +// if ($pvr['used'] == 0) { +// /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', +// "Призрачный воздух", +// "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", +// '.($btl->hodID + 1).' );';*/ +// } +// // +// $at['p'][$a]['atack'][$j]['yron']['used'][] = [$j_id, $uid, $pvr['used']]; +// $at['p'][$a]['atack'][$j]['yron']['kill'][] = [$j_id, $uid, $pvr['kill']]; +// // +// //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; +// } +// // +// } +// } +// $j++; +// } +// } +// // -- конец приема + return $at; + }; + unset($pr_used_this); +} else { + //Действие при клике + $this->addEffPr($pl, $id); } unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/145.php b/_incl_data/class/priem/145.php index 149805ae..1be22be9 100644 --- a/_incl_data/class/priem/145.php +++ b/_incl_data/class/priem/145.php @@ -1,127 +1,140 @@ stats[$btl->uids[$uid]]['um_priem'][$j_id])) { - global $u, $btl; - if( $profil == 7 ) { - $yron = $yron/2; - /*$btl->priemAddLogFast( $uid, 0, "Призрачная вода", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() );*/ - if( $yron < 0 ) { - $yron = 1; - } - $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; - } - } - return round($yron); - }; -}elseif( isset($pr_tested_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1'); - unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); - } - // - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - $j = 0; $k = 0; $wp = 3; - while($j < count($at['p'][$a]['atack'])) { - if( isset($at['p'][$a]['atack'][$j]['yron']) && ( - $at['p'][$a]['atack'][$j][1] == 1 || - $at['p'][$a]['atack'][$j][1] == 4 || - $at['p'][$a]['atack'][$j][1] == 5 )) { - if( !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - // - if( $at['p'][$a]['atack'][$j]['yron']['w_type'] == 7 ) { - $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/2); - $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/2); - $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/2); - // - if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; } - // - if( $pvr['used'] == 0 ) { - /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', - "Призрачная вода", - "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", - '.($btl->hodID + 1).' );';*/ - } - // - $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); - $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); - // - //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; - } - // - } - } - $j++; - } - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - //Действие при клике - $this->addEffPr($pl,$id); +$pvr = []; +if (isset($pr_momental_this)) { + $fx_moment = function ($uid, $enemy, $j_id, $yron, $profil) { + if (!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { + global $u, $btl; + if ($profil == 7) { + //$yron = $yron / 2; + /*$btl->priemAddLogFast( $uid, 0, "Призрачная вода", + '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', + 0, time() );*/ +// if ($yron < 0) { +// $yron = 1; +// } + $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; + } + } + return round($yron); + }; +} elseif (isset($pr_tested_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема + global $u, $btl; + // + //Параметры приема + $pvr['used'] = 0; + // + $uid1 = $btl->atacks[$id]['uid1']; + $uid2 = $btl->atacks[$id]['uid2']; + if ($uid == $uid2) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } elseif ($uid == $uid1) { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3] . '" AND `uid` = "' . $uid . '" LIMIT 1'); + unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); + } + // + // -- конец приема + return $at; + }; + unset($pr_used_this); +} elseif (isset($pr_used_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема +// global $u, $btl; +// // +// //Параметры приема +// $pvr['used'] = 0; +// // +// $uid1 = $btl->atacks[$id]['uid1']; +// $uid2 = $btl->atacks[$id]['uid2']; +// if ($uid == $uid2) { +// $a = 1; +// $b = 2; +// $u1 = ${'uid1'}; +// $u2 = ${'uid2'}; +// } elseif ($uid == $uid1) { +// $a = 2; +// $b = 1; +// $u1 = ${'uid2'}; +// $u2 = ${'uid1'}; +// } +// if ($a > 0) { +// $j = 0; +// $k = 0; +// $wp = 3; +// while ($j < count($at['p'][$a]['atack'])) { +// if (isset($at['p'][$a]['atack'][$j]['yron']) && ( +// $at['p'][$a]['atack'][$j][1] == 1 || +// $at['p'][$a]['atack'][$j][1] == 4 || +// $at['p'][$a]['atack'][$j][1] == 5)) { +// if (!isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { +// // +// if ($at['p'][$a]['atack'][$j]['yron']['w_type'] == 7) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y'] / 2); +// // +// if ($at['p'][$a]['atack'][$j]['yron']['y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['r'] >= 0) { +// $at['p'][$a]['atack'][$j]['yron']['r'] = -1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; +// } +// // +// if ($pvr['used'] == 0) { +// /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', +// "Призрачная вода", +// "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", +// '.($btl->hodID + 1).' );';*/ +// } +// // +// $at['p'][$a]['atack'][$j]['yron']['used'][] = [$j_id, $uid, $pvr['used']]; +// $at['p'][$a]['atack'][$j]['yron']['kill'][] = [$j_id, $uid, $pvr['kill']]; +// // +// //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; +// } +// // +// } +// } +// $j++; +// } +// } +// // -- конец приема + return $at; + }; + unset($pr_used_this); +} else { + //Действие при клике + $this->addEffPr($pl, $id); } unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/146.php b/_incl_data/class/priem/146.php index 63f76a90..d1b22a29 100644 --- a/_incl_data/class/priem/146.php +++ b/_incl_data/class/priem/146.php @@ -1,127 +1,140 @@ stats[$btl->uids[$uid]]['um_priem'][$j_id])) { - global $u, $btl; - if( $profil == 8 ) { - $yron = $yron/2; - /*$btl->priemAddLogFast( $uid, 0, "Призрачная земля", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() );*/ - if( $yron < 0 ) { - $yron = 1; - } - $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; - } - } - return round($yron); - }; -}elseif( isset($pr_tested_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1'); - unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); - } - // - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) ) { - $fx_priem = function( $id , $at , $uid, $j_id ) { - // -- начало приема - global $u, $btl; - // - //Параметры приема - $pvr['used'] = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid2 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid1 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - $j = 0; $k = 0; $wp = 3; - while($j < count($at['p'][$a]['atack'])) { - if( isset($at['p'][$a]['atack'][$j]['yron']) && ( - $at['p'][$a]['atack'][$j][1] == 1 || - $at['p'][$a]['atack'][$j][1] == 4 || - $at['p'][$a]['atack'][$j][1] == 5 )) { - if( !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) { - // - if( $at['p'][$a]['atack'][$j]['yron']['w_type'] == 8 ) { - $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/2); - $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/2); - $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/2); - $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/2); - // - if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } - if( $at['p'][$a]['atack'][$j]['yron']['m_y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; } - // - if( $pvr['used'] == 0 ) { - /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', - "Призрачная земля", - "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", - '.($btl->hodID + 1).' );';*/ - } - // - $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); - $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); - // - //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; - } - // - } - } - $j++; - } - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - //Действие при клике - $this->addEffPr($pl,$id); +$pvr = []; +if (isset($pr_momental_this)) { + $fx_moment = function ($uid, $enemy, $j_id, $yron, $profil) { + if (!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { + global $u, $btl; + if ($profil == 8) { + //$yron = $yron / 2; + /*$btl->priemAddLogFast( $uid, 0, "Призрачная земля", + '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', + 0, time() );*/ +// if ($yron < 0) { +// $yron = 1; +// } + $btl->stats[$btl->uids[$uid]]['um_priem'][$j_id] = true; + } + } + return round($yron); + }; +} elseif (isset($pr_tested_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема + global $u, $btl; + // + //Параметры приема + $pvr['used'] = 0; + // + $uid1 = $btl->atacks[$id]['uid1']; + $uid2 = $btl->atacks[$id]['uid2']; + if ($uid == $uid2) { + $a = 1; + $b = 2; + $u1 = ${'uid1'}; + $u2 = ${'uid2'}; + } elseif ($uid == $uid1) { + $a = 2; + $b = 1; + $u1 = ${'uid2'}; + $u2 = ${'uid1'}; + } + if (isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { + mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3] . '" AND `uid` = "' . $uid . '" LIMIT 1'); + unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]); + } + // + // -- конец приема + return $at; + }; + unset($pr_used_this); +} elseif (isset($pr_used_this)) { + $fx_priem = function ($id, $at, $uid, $j_id) { + // -- начало приема +// global $u, $btl; +// // +// //Параметры приема +// $pvr['used'] = 0; +// // +// $uid1 = $btl->atacks[$id]['uid1']; +// $uid2 = $btl->atacks[$id]['uid2']; +// if ($uid == $uid2) { +// $a = 1; +// $b = 2; +// $u1 = ${'uid1'}; +// $u2 = ${'uid2'}; +// } elseif ($uid == $uid1) { +// $a = 2; +// $b = 1; +// $u1 = ${'uid2'}; +// $u2 = ${'uid1'}; +// } +// if ($a > 0) { +// $j = 0; +// $k = 0; +// $wp = 3; +// while ($j < count($at['p'][$a]['atack'])) { +// if (isset($at['p'][$a]['atack'][$j]['yron']) && ( +// $at['p'][$a]['atack'][$j][1] == 1 || +// $at['p'][$a]['atack'][$j][1] == 4 || +// $at['p'][$a]['atack'][$j][1] == 5)) { +// if (!isset($at['p'][$a]['priems']['kill'][$uid][$j_id])) { +// // +// if ($at['p'][$a]['atack'][$j]['yron']['w_type'] == 8) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k'] / 2); +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y'] / 2); +// // +// if ($at['p'][$a]['atack'][$j]['yron']['y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['y'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['r'] >= 0) { +// $at['p'][$a]['atack'][$j]['yron']['r'] = -1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_k'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; +// } +// if ($at['p'][$a]['atack'][$j]['yron']['m_y'] < 1) { +// $at['p'][$a]['atack'][$j]['yron']['m_y'] = 1; +// } +// // +// if ($pvr['used'] == 0) { +// /*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', +// "Призрачная земля", +// "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", +// '.($btl->hodID + 1).' );';*/ +// } +// // +// $at['p'][$a]['atack'][$j]['yron']['used'][] = [$j_id, $uid, $pvr['used']]; +// $at['p'][$a]['atack'][$j]['yron']['kill'][] = [$j_id, $uid, $pvr['kill']]; +// // +// //$at['p'][$a]['priems']['kill'][$uid][$j_id] = true; +// } +// // +// } +// } +// $j++; +// } +// } +// // -- конец приема + return $at; + }; + unset($pr_used_this); +} else { + //Действие при клике + $this->addEffPr($pl, $id); } unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/15.php b/_incl_data/class/priem/15.php index 69b18853..dbe7806d 100644 --- a/_incl_data/class/priem/15.php +++ b/_incl_data/class/priem/15.php @@ -56,8 +56,6 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/16.php b/_incl_data/class/priem/16.php index 21505d3a..08517832 100644 --- a/_incl_data/class/priem/16.php +++ b/_incl_data/class/priem/16.php @@ -55,8 +55,7 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + $prv['text2'] = '{tm1} '.$prv['text'].'. '.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/161.php b/_incl_data/class/priem/161.php index 4f3691d8..b3e2c835 100644 --- a/_incl_data/class/priem/161.php +++ b/_incl_data/class/priem/161.php @@ -36,7 +36,7 @@ $pvr = array(); //Используем проверку на урон приемов $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 5, true ); - if( $pvr['krit'] == false ) { + if(!$pvr['krit']) { if( $pvr['hp'] > $pvr['lim'] ) { $pvr['hp'] = $pvr['lim']; } @@ -48,8 +48,7 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; @@ -62,8 +61,8 @@ $pvr = array(); mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { + if(!$pvr['promah']) { + if(!$pvr['krit']) { $prv['color2'] = '006699'; if(isset($btl->mcolor[$btl->mname['огонь']])) { $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; @@ -96,12 +95,7 @@ $pvr = array(); ($btl->hodID + 1) ); - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + // $pvr['xx']++; } @@ -110,12 +104,6 @@ $pvr = array(); $btl->delPriem($pvr['x5'],$btl->users[$btl->uids[$this->ue['id']]],2); // - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/162.php b/_incl_data/class/priem/162.php index 6318513f..d9ad76d3 100644 --- a/_incl_data/class/priem/162.php +++ b/_incl_data/class/priem/162.php @@ -49,7 +49,7 @@ $pvr = array(); $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/163.php b/_incl_data/class/priem/163.php index e1342d1f..d21f4145 100644 --- a/_incl_data/class/priem/163.php +++ b/_incl_data/class/priem/163.php @@ -49,7 +49,7 @@ $pvr = array(); $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/17.php b/_incl_data/class/priem/17.php index 76a05220..69edf156 100644 --- a/_incl_data/class/priem/17.php +++ b/_incl_data/class/priem/17.php @@ -55,8 +55,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { @@ -76,5 +76,6 @@ $pvr = array(); //Отнимаем тактики //$this->mintr($pl); + unset($pvr); ?> \ No newline at end of file diff --git a/_incl_data/class/priem/18.php b/_incl_data/class/priem/18.php index 5a98d893..cc93f4ab 100644 --- a/_incl_data/class/priem/18.php +++ b/_incl_data/class/priem/18.php @@ -55,8 +55,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/180.php b/_incl_data/class/priem/180.php index 5853af34..163e5c97 100644 --- a/_incl_data/class/priem/180.php +++ b/_incl_data/class/priem/180.php @@ -11,7 +11,7 @@ $pvr['x5'] = mysql_fetch_array(mysql_query('SELECT `id`,`x` FROM `eff_users` WHE if( $pvr['x5']['x'] < 5 ) { $prv['x'] = ''; if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; + $prv['x'] = ' x'.($pvr['x5']['x']+1); } // $this->addEffPr($pl,$id); diff --git a/_incl_data/class/priem/21.php b/_incl_data/class/priem/21.php index 4ed87b06..66cce764 100644 --- a/_incl_data/class/priem/21.php +++ b/_incl_data/class/priem/21.php @@ -59,11 +59,9 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; - //$pvr['hp'] = $pvr['hp'][0]; $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/22.php b/_incl_data/class/priem/22.php index ecd7afa1..d2c542ee 100644 --- a/_incl_data/class/priem/22.php +++ b/_incl_data/class/priem/22.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/23.php b/_incl_data/class/priem/23.php index 698b4f80..87464437 100644 --- a/_incl_data/class/priem/23.php +++ b/_incl_data/class/priem/23.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/243.php b/_incl_data/class/priem/243.php index 021ff33b..0dbf6f04 100644 --- a/_incl_data/class/priem/243.php +++ b/_incl_data/class/priem/243.php @@ -1,214 +1,6 @@ -users[$btl->uids[$this->ue['id']]]['id'].'" AND `bj` = "пожирающеепламя" AND `user_use` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); -if( isset($pvr['mg']['id']) ) { - //Действие при клике - $pvr['hp'] = 0; - $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - - $pvr['hp23'] = $pvr['hp']; - - $pvr['hp'] = round($pvr['hp']*5); - $pvr['hp'] = round($pvr['hp']/100*33); - - $pvr['hp24'] = $pvr['hp']; - - //$pvr['hp'] = floor($pvr['hp']/20*$u->stats['mg3']);//умелки - //$pvr['hp'] = floor($pvr['hp']/200*$u->stats['s5']);//Интелект - /*if( $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] < floor($btl->stats[$btl->uids[$this->ue['id']]]['hpAll']/100*33) ) { - $pvr['hp'] = floor( $pvr['hp'] + ($pvr['hp']/100*(33*$pvr['mg']['x'])) ); - }*/ - - /* - $pvr['hp_test'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = $pvr['hp_test'][3]; - $pvr['promah'] = $pvr['hp_test'][2]; - $pvr['krit'] = $pvr['hp_test'][1]; - */ - //$pvr['hp'] = $pvr['hp_test'][0]; - - - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true ); - - $pvr['hp25'] = $pvr['hp']; - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - $pvr['hp26'] = $pvr['hp']; - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].'] (Базовый урон: '.$pvr['hp23'].'/'.$pvr['hp24'].'/'.$pvr['hp25'].'/'.$pvr['hp26'].' ед.)'; - if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пылающий Взрыв', - $prv['text2'], - ($btl->hodID + 1) - ); - - // - //Действие при клике - //$pvr['rx'] = rand(80,80); - //$pvr['rx'] = floor($pvr['rx']/10); - $pvr['uen'] = $this->ue['id']; - $pvr['rx'] = 4; - $pvr['xx'] = 0; - $pvr['ix'] = 0; - while( $pvr['ix'] < count($btl->users) ) { - if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { - // - $pvr['uid'] = $btl->users[$pvr['ix']]['id']; - $pvr['hp'] = floor($pvr['hp']); - /* - $pvr['hp'] = $this->magatack( $u->info['id'], $pvr['uid'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - */ - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$pvr['uid']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$pvr['uid']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 6, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); - - // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - // - - // - //$prv['color2'] = $btl->mcolor[$btl->mname['земля']]; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - if( $pvr['promah_type'] == 2 ) { - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - }else{ - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $pvr['uid'], - 'Пылающий Взрыв', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); - // - $pvr['xx']++; - } - $pvr['ix']++; - } - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],242,'add_notactic=1|add_nousepriem=1',2,77,2,$u->info['id'],3,'пылающийужас',0,0,1); - - //Удаляем оледенение - $pvr['mg']['priem']['id'] = $pvr['mg']['id']; - $btl->delPriem($pvr['mg'],$btl->users[$btl->uids[$this->ue['id']]],2); - - //Отнимаем тактики - $this->mintr($pl); -}else{ - echo 'На персонаже нет пожирающего пламени (Вашего заклятия)'; - $cup = true; -} -unset($pvr); -?> \ No newline at end of file +$this->addPriem($this->u->info['id'],243,'add_acestar=1',2,77,1,$this->u->info['id'],1,'',0,0,1); diff --git a/_incl_data/class/priem/244.php b/_incl_data/class/priem/244.php index 769f75dc..fe12ed7a 100644 --- a/_incl_data/class/priem/244.php +++ b/_incl_data/class/priem/244.php @@ -1,125 +1,85 @@ -users[$btl->uids[$this->ue['id']]]['id'].'" AND `bj` = "пожирающеепламя" AND `user_use` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); -if( $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] > round($btl->stats[$btl->uids[$this->ue['id']]]['hpAll']/100*33) ) { - echo 'Уровень здоровья цели должен быть ниже 33%'; - $cup = true; -}elseif( isset($pvr['mg']['id']) ) { - //Действие при клике - $pvr['hp'] = 0; - $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - - $pvr['hp23'] = $pvr['hp']; - - //$pvr['hp'] = round(((5*$pvr['hp'])/100)*150); - $pvr['hp'] = 450; - - $pvr['hp24'] = $pvr['hp']; - - //$pvr['hp'] = floor($pvr['hp']/20*$u->stats['mg3']);//умелки - //$pvr['hp'] = floor($pvr['hp']/200*$u->stats['s5']);//Интелект - //if( $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] < floor($btl->stats[$btl->uids[$this->ue['id']]]['hpAll']/100*30) ) { - //$pvr['hp'] = floor( $pvr['hp'] + ($pvr['hp']/100*(50*$pvr['mg']['x'])) ); - //} - - $pvr['hp_test'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = 0; - $pvr['promah'] = false; - $pvr['krit'] = $pvr['hp_test'][1]; - if( $pvr['krit'] == true ) { - $pvr['hp'] = round($pvr['hp']*2); - } - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; - - $pvr['hp25'] = $pvr['hp']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true ); - - $pvr['hp26'] = $pvr['hp']; - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. '.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>--
    ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пылающая Смерть', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],242,'add_notactic=1|add_nousepriem=1',2,77,2,$u->info['id'],3,'пылающийужас',0,0,1); - - //Удаляем оледенение - $pvr['mg']['priem']['id'] = $pvr['mg']['id']; - $btl->delPriem($pvr['mg'],$btl->users[$btl->uids[$this->ue['id']]],2); - - //Отнимаем тактики - $this->mintr($pl); -}else{ - echo 'На персонаже нет пожирающего пламени (Вашего заклятия)'; - $cup = true; +$pvr = []; +$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $btl->users[$btl->uids[$this->ue['id']]]['id'] . ' AND `bj` = "пожирающеепламя" AND `user_use` = ' . $u->info['id'] . ' ORDER BY `id` DESC LIMIT 1')); +if ( + $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] > round($btl->stats[$btl->uids[$this->ue['id']]]['hpAll'] / 100 * 33) +) { + echo 'Уровень здоровья цели должен быть ниже 33%'; + $cup = true; +} elseif (!isset($pvr['mg']['id'])) { + echo 'На персонаже нет пожирающего пламени (Вашего заклятия)'; + $cup = true; +} else { + //Действие при клике + $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); + $pvr['name'] = $pvr['mg']['name']; + + // Урон = 150% оставшегося урона (урон за ход * количество ходов * 150/100). + $pvr['hp'] = floor($pvr['data']['atgm'] * $pvr['mg']['hod'] * 1.5); + + // Мы должны смочь критовать, но мы не должны ещё раз модифицировать урон! + $pvr['hp_test'] = $this->magatack($u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 1); + + + $pvr['krit'] = $pvr['hp_test'][1]; + if ($pvr['krit']) { + $pvr['hp'] = round($pvr['hp'] * 2); + } + $pvr['hpSee'] = '--'; + $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); + $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; + + $pvr['hp25'] = $pvr['hp']; + + //Используем проверку на урон приемов + $pvr['hp'] = $btl->testYronPriem($u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true); + + $pvr['hp26'] = $pvr['hp']; + + $pvr['hpSee'] = '-' . $pvr['hp']; + $pvr['hpNow'] -= $pvr['hp']; + $btl->priemYronSave($u->info['id'], $this->ue['id'], $pvr['hp'], 0); + + if ($pvr['hpNow'] > $pvr['hpAll']) { + $pvr['hpNow'] = $pvr['hpAll']; + } elseif ($pvr['hpNow'] < 0) { + $pvr['hpNow'] = 0; + } + $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; + + mysql_query('UPDATE `stats` SET `hpNow` = ' . $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] . ' WHERE `id` = ' . $this->ue['id']); + + $prv['text'] = $btl->addlt(1, 19, $btl->users[$btl->uids[$u->info['id']]]['sex'], null); + + + $prv['color'] = $pvr['krit'] ? "f00" : "a00"; + + $prv['text2'] = '{tm1} ' . $prv['text'] . '. ' . $pvr['hpSee'] . ' [' . $pvr['hpNow'] . '/' . $pvr['hpAll'] . ']'; + + $btl->priemAddLog($id, 1, 2, $u->info['id'], $this->ue['id'], + 'Пылающая Смерть', + $prv['text2'], + ($btl->hodID + 1) + ); + + //Удаляем оледенение + $pvr['mg']['priem']['id'] = $pvr['mg']['id']; + $btl->delPriem($pvr['mg'], $btl->users[$btl->uids[$this->ue['id']]], 2); + + //Отнимаем тактики + $this->mintr($pl); } unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/25.php b/_incl_data/class/priem/25.php index 55910488..7a782c01 100644 --- a/_incl_data/class/priem/25.php +++ b/_incl_data/class/priem/25.php @@ -1,76 +1,14 @@ -ue['id'].'" AND `v2` = 25 AND `delete` = 0 LIMIT 1')); -if( $pvr['x5']['x'] < 5 ) { - $prv['x'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; - } - // - $this->addEffPr($pl,$id); - // - $prv['effx'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); - if( isset($prv['eff']['id']) ) { - //Разбираем дату $prv['eff']['data'] - $prv['eda'] = $prv['eff']['data']; - } - }else{ - //Разбираем дату $pl['date3'] - $prv['eda'] = $pl['date3']; - } - // - if( isset($prv['eda']) ) { - $prv['d'] = $u->lookStats($prv['eda']); - $prv['j'] = $u->lookStats($this->redate($prv['eda'],$u->info['id'])); - $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 - $prv['i'] = 0; $prv['inf'] = ''; - while($prv['i']is[$prv['vi']]!='') { - if($prv['j'][$prv['v'][$prv['i']]]>0) { - $prv['inf'] .= $u->is[$prv['vi']].': +'.($prv['j'][$prv['v'][$prv['i']]]*(1+$pvr['x5']['x'])).', '; - }elseif($prv['j'][$prv['v'][$prv['i']]]<0){ - $prv['inf'] .= $u->is[$prv['vi']].': '.($prv['j'][$prv['v'][$prv['i']]]*(1+$prv['x5']['x'])).', '; - } - } - $prv['i']++; - } - $prv['effx'] = rtrim($prv['inf'],', '); - } - // - if( $prv['effx'] != '' ) { - $prv['effx'] = ' ('.$prv['effx'].')'; - } - // - $prv['color2'] = '000000'; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'.$prv['effx']; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Цель воды'.$prv['x'].'', - $prv['text2'], - ($btl->hodID + 0) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/10).'',0,77,-1,$u->info['id'],5,'цельводы',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); -}else{ - $cup = true; - echo 'На пероснаже достигнуто максиальное колличество целей'; -} +/** + * Прием: Цель {стихия} + * @var $this Priems + * @var $btl Battle + * @var $id + * @var $pl + */ -unset($pvr); -?> \ No newline at end of file +if (!$id) { + exit(); +} +$cup = $this->magicTarget('water', $pl, $id, $btl); diff --git a/_incl_data/class/priem/250.php b/_incl_data/class/priem/250.php index 1bfd9060..2f05b58f 100644 --- a/_incl_data/class/priem/250.php +++ b/_incl_data/class/priem/250.php @@ -11,14 +11,14 @@ $pvr['x5'] = mysql_fetch_array(mysql_query('SELECT `id`,`x` FROM `eff_users` WHE if( $pvr['x5']['x'] < 5 ) { $prv['x'] = ''; if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; + $prv['x'] = ' x'.($pvr['x5']['x']+1); } // $this->addEffPr($pl,$id); // $prv['effx'] = ''; if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); + $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = '.$pvr['x5']['id'])); if( isset($prv['eff']['id']) ) { //Разбираем дату $prv['eff']['data'] $prv['eda'] = $prv['eff']['data']; @@ -34,7 +34,7 @@ if( $pvr['x5']['x'] < 5 ) { $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 $prv['i'] = 0; $prv['inf'] = ''; while($prv['i']is[$prv['vi']]!='') { if($prv['j'][$prv['v'][$prv['i']]]>0) { diff --git a/_incl_data/class/priem/252.php b/_incl_data/class/priem/252.php index c77edc24..51cd9f8e 100644 --- a/_incl_data/class/priem/252.php +++ b/_incl_data/class/priem/252.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['mp'] = floor($pvr['mp']*$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['mpSee'] = '--'; $pvr['mpNow'] = floor($btl->stats[$btl->uids[$u1]]['mpNow']); $pvr['mpAll'] = $btl->stats[$btl->uids[$u1]]['mpAll']; diff --git a/_incl_data/class/priem/255.php b/_incl_data/class/priem/255.php index 5c811279..563d5683 100644 --- a/_incl_data/class/priem/255.php +++ b/_incl_data/class/priem/255.php @@ -99,7 +99,8 @@ if( isset($pr_momental_this)) { // //if( $at['p'][$a]['atack'][$j]['yron']['y'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['y'] = 0; } if( $at['p'][$a]['atack'][$j]['yron']['r'] >= 0 ) { $at['p'][$a]['atack'][$j]['yron']['r'] = -1; } - $priem->mg2static_points( $u1 , $btl->stats[$btl->uids[$u1]] ); + $priem->addAirStaticPoints($u1); + /* if( $at['p'][$a]['atack'][$j]['yron']['k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['k'] = 1; } if( $at['p'][$a]['atack'][$j]['yron']['m_k'] < 1 ) { $at['p'][$a]['atack'][$j]['yron']['m_k'] = 1; } diff --git a/_incl_data/class/priem/256.php b/_incl_data/class/priem/256.php index de87b389..bbc3cbe2 100644 --- a/_incl_data/class/priem/256.php +++ b/_incl_data/class/priem/256.php @@ -1,14 +1,4 @@ -addEffPr($pl,$id); - -unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/259.php b/_incl_data/class/priem/259.php index ce28a39f..06903431 100644 --- a/_incl_data/class/priem/259.php +++ b/_incl_data/class/priem/259.php @@ -115,8 +115,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints(); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/26.php b/_incl_data/class/priem/26.php index 691719ce..141c0e89 100644 --- a/_incl_data/class/priem/26.php +++ b/_incl_data/class/priem/26.php @@ -1,76 +1,14 @@ -ue['id'].'" AND `v2` = 26 AND `delete` = 0 LIMIT 1')); -if( $pvr['x5']['x'] < 5 ) { - $prv['x'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; - } - // - $this->addEffPr($pl,$id); - // - $prv['effx'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); - if( isset($prv['eff']['id']) ) { - //Разбираем дату $prv['eff']['data'] - $prv['eda'] = $prv['eff']['data']; - } - }else{ - //Разбираем дату $pl['date3'] - $prv['eda'] = $pl['date3']; - } - // - if( isset($prv['eda']) ) { - $prv['d'] = $u->lookStats($prv['eda']); - $prv['j'] = $u->lookStats($this->redate($prv['eda'],$u->info['id'])); - $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 - $prv['i'] = 0; $prv['inf'] = ''; - while($prv['i']is[$prv['vi']]!='') { - if($prv['j'][$prv['v'][$prv['i']]]>0) { - $prv['inf'] .= $u->is[$prv['vi']].': +'.($prv['j'][$prv['v'][$prv['i']]]*(1+$pvr['x5']['x'])).', '; - }elseif($prv['j'][$prv['v'][$prv['i']]]<0){ - $prv['inf'] .= $u->is[$prv['vi']].': '.($prv['j'][$prv['v'][$prv['i']]]*(1+$prv['x5']['x'])).', '; - } - } - $prv['i']++; - } - $prv['effx'] = rtrim($prv['inf'],', '); - } - // - if( $prv['effx'] != '' ) { - $prv['effx'] = ' ('.$prv['effx'].')'; - } - // - $prv['color2'] = '000000'; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'.$prv['effx']; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Цель огня'.$prv['x'].'', - $prv['text2'], - ($btl->hodID + 0) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/10).'',0,77,-1,$u->info['id'],5,'цельводы',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); -}else{ - $cup = true; - echo 'На пероснаже достигнуто максиальное колличество целей'; -} +/** + * Прием: Цель {стихия} + * @var $this Priems + * @var $btl Battle + * @var $id + * @var $pl + */ -unset($pvr); -?> \ No newline at end of file +if (!$id) { + exit(); +} +$cup = $this->magicTarget('fire', $pl, $id, $btl); diff --git a/_incl_data/class/priem/260.php b/_incl_data/class/priem/260.php index 775c788d..d2382c6e 100644 --- a/_incl_data/class/priem/260.php +++ b/_incl_data/class/priem/260.php @@ -1,65 +1,27 @@ -ue['id'].'" AND `v2` = 260 AND `delete` = 0 LIMIT 1')); -if( $pvr['x5']['x'] < 5 ) { - $prv['x'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; - } - // - $this->addEffPr($pl,$id); - // - $prv['effx'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); - if( isset($prv['eff']['id']) ) { - $prv['eda'] = $prv['eff']['data']; - } - }else{ - $prv['eda'] = $pl['date3']; - } - // - if( isset($prv['eda']) ) { - $prv['d'] = $u->lookStats($prv['eda']); - $prv['j'] = $u->lookStats($this->redate($prv['eda'],$u->info['id'])); - $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 - $prv['i'] = 0; $prv['inf'] = ''; - while($prv['i']is[$prv['vi']]!='') { - if($prv['j'][$prv['v'][$prv['i']]]>0) { - $prv['inf'] .= $u->is[$prv['vi']].': +'.($prv['j'][$prv['v'][$prv['i']]]).', '; - }elseif($prv['j'][$prv['v'][$prv['i']]]<0){ - $prv['inf'] .= $u->is[$prv['vi']].': '.($prv['j'][$prv['v'][$prv['i']]]).', '; - } - } - $prv['i']++; - } - $prv['effx'] = rtrim($prv['inf'],', '); - } - // - if( $prv['effx'] != '' ) { - $prv['effx'] = ' ('.$prv['effx'].')'; - } - // - $prv['color2'] = '000000'; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'.$prv['effx']; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Статика'.$prv['x'].'', - $prv['text2'], - ($btl->hodID + 0) - ); -}else{ - $cup = true; - echo 'На пероснаже достигнуто максиальное колличество статик'; +$pvr['x5'] = mysql_fetch_array(mysql_query('SELECT `id`,`x` FROM `eff_users` WHERE `uid` = ' . $this->ue['id'] . ' AND `v2` = 260 AND `delete` = 0 LIMIT 1')); +if ($pvr['x5']['x'] > 0) { + $cup = true; + echo 'На пероснаже уже есть статика.'; +} else { + $this->addEffPr($pl, $id); + + $prv['color2'] = '0af'; + $prv['text'] = $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null); + $prv['text2'] = '{tm1} ' . $prv['text']; + $btl->priemAddLog($id, 1, 2, $u->info['id'], $this->ue['id'], + 'Статика', + $prv['text2'], + ($btl->hodID) + ); } unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/261.php b/_incl_data/class/priem/261.php index 29ad3eaa..be48da78 100644 --- a/_incl_data/class/priem/261.php +++ b/_incl_data/class/priem/261.php @@ -1,152 +1,49 @@ -users[$btl->uids[$this->ue['id']]]['id'].'" AND `v2` = "260" AND `user_use` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); -$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$btl->users[$btl->uids[$this->ue['id']]]['id'].'" AND `v2` = "260" ORDER BY `id` DESC LIMIT 1')); -if( isset($pvr['mg']['id']) ) { - //Действие при клике - //$pvr['hp'] = floor(144/3*$pvr['mg']['x']); - /*$pvr['hp'] = 1;*/ - // - $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); - // - /**/ - if( $pvr['data']['add_mg2static_points'][0] < 1 ) { - echo 'Статика не собрала достаточного количества зарядов'; - $cup = true; - }else{ - $pvr['hp'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpAll']-floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow'])); - // - $pvr['hp'] = floor( ( $pvr['hp'] / 100 * rand( 1 , 3 ) ) * $pvr['data']['add_mg2static_points'][0] ); - - $pvr['mx'] = array( - 0 => 170, - 1 => 170, - 2 => 170, - 3 => 170, - 4 => 170, - 5 => 170, - 6 => 170, - 7 => 170, - 8 => 204, - 9 => 244, - 10 => 292, - 11 => 352, - 12 => 454, - 13 => 570, - 14 => 604, - 15 => 744, - 16 => 892, - 17 => 952, - 18 => 1054, - 19 => 1170, - 20 => 1292, - 21 => 1487 - ); - - $pvr['mx'] = $pvr['mx'][$u->info['level']]; - - // - //$pvr['hp'] = floor($pvr['hp']/20*$u->stats['mg3']);//умелки - //$pvr['hp'] = floor($pvr['hp']/200*$u->stats['s5']);//Интелект - /*if( $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] < floor($btl->stats[$btl->uids[$u->info['enemy']]]['hpAll']/100*30) ) { - $pvr['hp'] = floor( $pvr['hp'] + ($pvr['hp']/100*(50*$pvr['mg']['x'])) ); - }*/ +$params = [ + 'maxLimitbyStatic' => [1 => 90, 2 => 140, 3 => 175, 4 => 200, 5 => 244], + 'query' => 'select x from eff_users where v2 = 260 and user_use = %s and uid = %s', + 'query_remove_static' => 'delete from eff_users where v2 = 260 and user_use = %s and uid = %s', + 'hpNow' => $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'], + 'hpAll' => $btl->stats[$btl->uids[$this->ue['id']]]['hpAll'], + 'color' => '#0af', + 'logtext' => '{tm1} ' . $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null), +]; +$params = array_merge($params, [ + 'x' => mysql_fetch_array(mysql_query(sprintf($params['query'], $this->u->info['id'], $this->ue['id']))), + 'damage' => '', +]); +$params['damage'] = mt_rand(1, $params['maxLimitbyStatic'][$params['x'][0]]); +if (empty($params['x'])) { + echo 'На персонаже нет вашего заклятия Статики'; + $cup = true; +} else { + $params['damage'] = $btl->testYronPriem($this->u->info['id'], $this->ue['id'], 21, $params['damage'], 6, true); + $btl->priemYronSave($this->u->info['id'], $this->ue['id'], $params['damage'], 0); + $params['hpNow'] -= $params['damage']; + if ($params['hpNow'] > $params['hpAll']) { + $params['hpNow'] = $params['hpAll']; + } elseif ($params['hpNow'] < 0) { + $params['hpNow'] = 0; + } + $params['logtext'] .= sprintf("-%s [%s/%s]", $params['color'], $params['damage'], $params['hpNow'], $params['hpAll']); + + $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $params['hpNow']; + mysql_query('UPDATE `stats` SET `hpNow` = ' . $params['hpNow'] . ' WHERE `id` = ' . $this->ue['id']); + $btl->priemAddLog($id, 1, 2, $this->u->info['id'], $this->ue['id'], "Заряд: Поражение", + $params['logtext'], ($btl->hodID + 1)); + + mysql_query(sprintf($params['query_remove_static'], $this->u->info['id'], $this->ue['id'])); + //Отнимаем тактики + $this->mintr($pl); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'воздух', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; - - if( $pvr['krit'] == true ) { - if( $pvr['hp'] > $pvr['mx']*2 ) { - $pvr['hp'] = $pvr['mx']*2; - } - }else{ - if( $pvr['hp'] > $pvr['mx'] ) { - $pvr['hp'] = $pvr['mx']; - } - } - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 6, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['воздух']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['воздух']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['воздух']])) { - $prv['color'] = $btl->mncolor[$btl->mname['воздух']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Заряд: Поражение', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($u->info['enemy'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Удаляем оледенение - $pvr['mg']['priem']['id'] = $pvr['mg']['id']; - //$btl->delPriem($pvr['mg'],$btl->users[$btl->uids[$this->ue['id']]],2); - - $pvr['edt'] = $u->lookStats($pvr['mg']['data']); - $pvr['edt']['add_zm2proc'] = 0; - $pvr['edt']['add_mg2static_points'] = 0; - $pvr['edt'] = $u->impStats($pvr['edt']); - mysql_query('UPDATE `eff_users` SET `x` = 1, `data` = "'.$pvr['edt'].'" WHERE `id` = "'.$pvr['mg']['id'].'" LIMIT 1'); - - //Отнимаем тактики - $this->mintr($pl); - } -}else{ - echo 'На персонаже нет Статики (Вашего заклятия)'; - $cup = true; } -unset($pvr); -?> \ No newline at end of file +unset($params); diff --git a/_incl_data/class/priem/263.php b/_incl_data/class/priem/263.php index 151c5b8b..b2c406ee 100644 --- a/_incl_data/class/priem/263.php +++ b/_incl_data/class/priem/263.php @@ -1,113 +1,74 @@ -users[$btl->uids[$this->ue['id']]]['id'].'" AND `v2` = "260" AND `user_use` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); -$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$btl->users[$btl->uids[$this->ue['id']]]['id'].'" AND `v2` = "260" ORDER BY `id` DESC LIMIT 1')); -if( isset($pvr['mg']['id']) ) { - //Действие при клике - //$pvr['hp'] = floor(144/3*$pvr['mg']['x']); - /*$pvr['hp'] = 1;*/ - // - $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); - // - /**/ - if( $pvr['data']['add_mg2static_points'][0] < 1 ) { - echo 'Статика не собрала достаточного количества зарядов'; - $cup = true; - }else{ - $prv['text'] = $btl->addlt(1 , 21 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приемаы - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['воздух']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['воздух']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['воздух']])) { - $prv['color'] = $btl->mncolor[$btl->mname['воздух']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - //Хиляем ману - $pvr['mp'] = $pvr['data']['add_mg2static_points'][0]*(3*$u->info['level']); - // - $pvr['mpSee'] = ''; - $pvr['mpNow'] = floor($btl->stats[$btl->uids[$u->info['id']]]['mpNow']); - $pvr['mpAll'] = $btl->stats[$btl->uids[$u->info['id']]]['mpAll']; - - $pvr['mpTr'] = $pvr['mpNow'] + $pvr['mp']; - if( $pvr['mpTr'] > $pvr['mpAll'] ) { - $pvr['mp'] = $pvr['mp'] - ( $pvr['mpTr'] - $pvr['mpAll'] ); - } - - $pvr['mpNow'] = floor($pvr['mpNow']+$pvr['mp']); - - if( $pvr['mp'] > 0 ) { - $pvr['mpSee'] = '+' . $pvr['mp']; - }else{ - $pvr['mpSee'] = $pvr['mp']; - } - - if( $pvr['mpSee'] == '' || $pvr['mpSee'] == 0 ) { - $pvr['mpSee'] = '--'; - } - $u->stats['mpNow'] = $pvr['mpNow']; - $u->info['mpNow'] = $pvr['mpNow']; - $btl->stats[$btl->uids[$u->info['id']]]['mpNow'] = $pvr['mpNow']; - $btl->users[$btl->uids[$u->info['id']]]['mpNow'] = $pvr['mpNow']; - mysql_query('UPDATE `stats` SET `mpNow` = "'.$u->stats['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - - //Удаляем 1 негативный эффект - $pvr['no'] = ' AND `a`.`v2` != 201'; - - $pvr['sp'] = mysql_query('SELECT `a`.* FROM `eff_users` AS `a` LEFT JOIN `priems` AS `b` ON `b`.`id` = `a`.`v2` WHERE `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" '.$pvr['no'].' AND `b`.`neg` > 0 LIMIT 1'); - $pvr['pl'] = mysql_fetch_array($pvr['sp']); - $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$pvr['pl']['v2'].'" LIMIT 1')); - if( isset($pvr['pl']['priem']) ) { - $btl->delPriem($pvr['pl'],$btl->users[$btl->uids[$u->info['id']]],100); - } - - $prv['text2'] = '{tm1} '.$prv['text'].' через {u2}. '.$pvr['mpSee'].' ['.$pvr['mpNow'].'/'.$pvr['mpAll'].'] (мана)'; - - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Заряд: Собрать', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Удаляем оледенение - $pvr['mg']['priem']['id'] = $pvr['mg']['id']; - //$btl->delPriem($pvr['mg'],$btl->users[$btl->uids[$this->ue['id']]],2); - - $pvr['edt'] = $u->lookStats($pvr['mg']['data']); - $pvr['edt']['add_zm2proc'] = 0; - $pvr['edt']['add_mg2static_points'] = 0; - $pvr['edt'] = $u->impStats($pvr['edt']); - mysql_query('UPDATE `eff_users` SET `x` = 1, `data` = "'.$pvr['edt'].'" WHERE `id` = "'.$pvr['mg']['id'].'" LIMIT 1'); - - //Отнимаем тактики - //$this->mintr($pl); - } -}else{ - echo 'На персонаже нет Статики (Вашего заклятия)'; - $cup = true; +$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $btl->users[$btl->uids[$this->ue['id']]]['id'] . ' AND `v2` = 260 ORDER BY `id` DESC LIMIT 1')); +if (!isset($pvr['mg']['id'])) { + echo 'На персонаже нет Статики'; + $cup = true; +} else { + $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); + // + /**/ + if ($pvr['data']['add_mg2static_points'] < 1) { + echo 'Статика не собрала достаточного количества зарядов'; + $cup = true; + } else { + $prv['text'] = $btl->addlt(1, 21, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], NULL); + + //Цвет приемаы + $prv['color'] = $this->logColor[$this::AIR]; + + //Хиляем ману + $pvr['mp'] = $pvr['data']['add_mg2static_points'] * (3 * $this->u->info['level']); + // + $pvr['mpSee'] = ''; + $pvr['mpNow'] = floor($btl->stats[$btl->uids[$this->u->info['id']]]['mpNow']); + $pvr['mpAll'] = $btl->stats[$btl->uids[$this->u->info['id']]]['mpAll']; + + $pvr['mpTr'] = $pvr['mpNow'] + $pvr['mp']; + if ($pvr['mpTr'] > $pvr['mpAll']) { + $pvr['mp'] = $pvr['mp'] - ($pvr['mpTr'] - $pvr['mpAll']); + } + + $pvr['mpNow'] = floor($pvr['mpNow'] + $pvr['mp']); + + if ($pvr['mp'] > 0) { + $pvr['mpSee'] = '+' . $pvr['mp']; + } else { + $pvr['mpSee'] = $pvr['mp']; + } + + if (empty($pvr['mpSee'])) { + $pvr['mpSee'] = '--'; + } + $this->u->stats['mpNow'] = $pvr['mpNow']; + $this->u->info['mpNow'] = $pvr['mpNow']; + $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] = $pvr['mpNow']; + $btl->users[$btl->uids[$this->u->info['id']]]['mpNow'] = $pvr['mpNow']; + mysql_query('UPDATE `stats` SET `mpNow` = ' . $this->u->stats['mpNow'] . ' WHERE `id` = ' . $this->u->info['id']); + + //Удаляем 1 негативный эффект + $pvr['sp'] = mysql_query('select * from eff_users left join priems on priems.id = v2 where `delete` = 0 and neg > 0 and v1 = \'priem\' and v2 != 201 and uid = ' . $this->u->info['id']); + $pvr['pl'] = mysql_fetch_array($pvr['sp']); + shuffle($pvr['pl']); + $pvr['pl'] = $pvr['pl'][0]; + $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . $pvr['pl']['v2'])); + if (isset($pvr['pl']['priem'])) { + $btl->delPriem($pvr['pl'], $btl->users[$btl->uids[$this->u->info['id']]], 100); + } + + $prv['text2'] = '{tm1} ' . $prv['text'] . ' через {u2}. ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (мана)'; + + $btl->priemAddLog($id, 1, 2, $this->u->info['id'], $this->ue['id'], 'Заряд: Собрать', $prv['text2'], ($btl->hodID + 1)); + + $pvr['mg']['priem']['id'] = $pvr['mg']['id']; + $pvr['edt'] = $this->changeStatsData($pvr['mg']['data'], ['add_mg2static_points' => 0]); + mysql_query('UPDATE `eff_users` SET `x` = 1, `data` = "' . $pvr['edt'] . '" WHERE `id` = ' . $pvr['mg']['id']); + } } unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/265.php b/_incl_data/class/priem/265.php index 94efb54c..7cdb477a 100644 --- a/_incl_data/class/priem/265.php +++ b/_incl_data/class/priem/265.php @@ -1,114 +1,74 @@ -glaciationBreak($id, $pl, $btl); + $pvr = array(); -$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$btl->users[$btl->uids[$this->ue['id']]]['id'].'" AND `bj` = "оледенение" AND `user_use` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); -if( isset($pvr['mg']['id']) ) { - //Действие при клике - //$pvr['hp'] = floor(144/3*$pvr['mg']['x']); - $pvr['hp'] = 1; - // - $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - - - //$pvr['hp'] = 444; - $pvr['hp'] = 100; - //$pvr['hp'] += floor($pvr['hp']/100*$u->stats['mg3']);//умелки - //$pvr['hp'] += floor($pvr['hp']/100*($u->stats['s5']*0.15));//Интелект , было 0.33 - // - if( $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] < floor($btl->stats[$btl->uids[$this->ue['id']]]['hpAll']/100*33) ) { - //$pvr['hp'] = floor( $pvr['hp'] + ($pvr['hp']/100*(50*$pvr['mg']['x'])) ); - $pvr['hp'] = 80; - } - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'вода', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['вода']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['вода']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['вода']])) { - $prv['color'] = $btl->mncolor[$btl->mname['вода']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], - 'Оледенение: Разбить!', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($u->info['enemy'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Удаляем оледенение - $pvr['mg']['priem']['id'] = $pvr['mg']['id']; - $btl->delPriem($pvr['mg'],$btl->users[$btl->uids[$this->ue['id']]],2); - - //Отнимаем тактики - $this->mintr($pl); -}else{ - echo 'На персонаже нет оледенения (Вашего заклятия)'; - $cup = true; +$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $btl->users[$btl->uids[$this->ue['id']]]['id'] . '" AND `bj` = "оледенение" AND `user_use` = "' . $this->u->info['id'] . '" ORDER BY `id` DESC LIMIT 1')); +if (!isset($pvr['mg']['id'])) { + echo 'На персонаже нет оледенения (Вашего заклятия)'; + $cup = true; +} else { + //Действие при клике + $pvr['hp'] = 100; + if ($btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] < floor($btl->stats[$btl->uids[$this->ue['id']]]['hpAll'] * 0.2)) { + $pvr['hp'] *= 1.5; + } + $pvr['hp'] = $this->magatack($this->u->info['id'], $this->ue['id'], $pvr['hp'], 'вода', 1); + $pvr['promah_type'] = $pvr['hp'][3]; + $pvr['promah'] = $pvr['hp'][2]; + $pvr['krit'] = $pvr['hp'][1]; + $pvr['hp'] = $pvr['hp'][0]; + $pvr['hpSee'] = '--'; + $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); + $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; + + //Используем проверку на урон приемов + $pvr['hp'] = $btl->testYronPriem($this->u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true); + + $pvr['hpSee'] = '-' . $pvr['hp']; + $pvr['hpNow'] -= $pvr['hp']; + $btl->priemYronSave($this->u->info['id'], $this->ue['id'], $pvr['hp'], 0); + + if ($pvr['hpNow'] > $pvr['hpAll']) { + $pvr['hpNow'] = $pvr['hpAll']; + } elseif ($pvr['hpNow'] < 0) { + $pvr['hpNow'] = 0; + } + + $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; + + mysql_query('UPDATE `stats` SET `hpNow` = ' . $pvr['hpNow'] . ' WHERE `id` = ' . $this->ue['id']); + + $prv['text'] = $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], NULL); + + //Цвет приема + if ($pvr['promah']) { + $prv['color'] = $this->logColor['miss']; + } elseif ($pvr['krit']) { + $prv['color'] = $this->logColor['crit']; + } else { + $prv['color'] = $this->logColor[$this::WATER]; + } + $prv['text2'] = '{tm1} ' . $prv['text'] . '. maginfoattack($this->u->info['id'], $this->ue['id'], 3) . '>' . $pvr['hpSee'] . ' [' . $pvr['hpNow'] . '/' . $pvr['hpAll'] . ']'; + if ($pvr['promah_type'] == 2) { + $prv['text'] = $btl->addlt(1, 20, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], NULL); + $prv['text2'] = '{tm1} ' . $prv['text'] . '. maginfoattack($this->u->info['id'], $this->ue['id'], 3) . '>-- [' . $pvr['hpNow'] . '/' . $pvr['hpAll'] . ']'; + } + $btl->priemAddLog($id, 1, 2, $this->u->info['id'], $this->u->info['enemy'], 'Оледенение: Разбить!', $prv['text2'], ($btl->hodID + 1)); + + //Удаляем оледенение + $pvr['mg']['priem']['id'] = $pvr['mg']['id']; + $btl->delPriem($pvr['mg'], $btl->users[$btl->uids[$this->ue['id']]], 2); + + //Отнимаем тактики + $this->mintr($pl); } unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/267.php b/_incl_data/class/priem/267.php index 561e679d..2100fe38 100644 --- a/_incl_data/class/priem/267.php +++ b/_incl_data/class/priem/267.php @@ -1,92 +1,16 @@ -magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'вода', 1 ); - $pvr['promah_type'] = 0; - $pvr['promah'] = false; - $pvr['krit'] = false; - $pvr['hp'] = $btl->stats[$btl->uids[$this->ue['id']]]['s1']; - if( $pvr['hp'] > 10*$u->info['level'] ) { - $pvr['hp'] = $u->info['level']*10; - } - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 7, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['вода']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['вода']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['вода']])) { - $prv['color'] = $btl->mncolor[$btl->mname['вода']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],3).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Кристаллизация', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - $this->addPriem($this->ue['id'],268,'|add_s1=-'.$btl->stats[$btl->uids[$u->info['id']]]['mg3'].'|add_s2=-'.$btl->stats[$btl->uids[$u->info['id']]]['mg3'].'',2,77,3,$u->info['id'],3,'кристаллизация',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + $this->crystalize($id, $pl, $btl); } - -unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/27.php b/_incl_data/class/priem/27.php index 834c6d2d..a3a88f12 100644 --- a/_incl_data/class/priem/27.php +++ b/_incl_data/class/priem/27.php @@ -1,76 +1,14 @@ -ue['id'].'" AND `v2` = 27 AND `delete` = 0 LIMIT 1')); -if( $pvr['x5']['x'] < 5 ) { - $prv['x'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; - } - // - $this->addEffPr($pl,$id); - // - $prv['effx'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); - if( isset($prv['eff']['id']) ) { - //Разбираем дату $prv['eff']['data'] - $prv['eda'] = $prv['eff']['data']; - } - }else{ - //Разбираем дату $pl['date3'] - $prv['eda'] = $pl['date3']; - } - // - if( isset($prv['eda']) ) { - $prv['d'] = $u->lookStats($prv['eda']); - $prv['j'] = $u->lookStats($this->redate($prv['eda'],$u->info['id'])); - $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 - $prv['i'] = 0; $prv['inf'] = ''; - while($prv['i']is[$prv['vi']]!='') { - if($prv['j'][$prv['v'][$prv['i']]]>0) { - $prv['inf'] .= $u->is[$prv['vi']].': +'.($prv['j'][$prv['v'][$prv['i']]]*(1+$pvr['x5']['x'])).', '; - }elseif($prv['j'][$prv['v'][$prv['i']]]<0){ - $prv['inf'] .= $u->is[$prv['vi']].': '.($prv['j'][$prv['v'][$prv['i']]]*(1+$prv['x5']['x'])).', '; - } - } - $prv['i']++; - } - $prv['effx'] = rtrim($prv['inf'],', '); - } - // - if( $prv['effx'] != '' ) { - $prv['effx'] = ' ('.$prv['effx'].')'; - } - // - $prv['color2'] = '000000'; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'.$prv['effx']; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Цель воздуха'.$prv['x'].'', - $prv['text2'], - ($btl->hodID + 0) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/10).'',0,77,-1,$u->info['id'],5,'цельводы',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); -}else{ - $cup = true; - echo 'На пероснаже достигнуто максиальное колличество целей'; -} +/** + * Прием: Цель {стихия} + * @var $this Priems + * @var $btl Battle + * @var $id + * @var $pl + */ -unset($pvr); -?> \ No newline at end of file +if (!$id) { + exit(); +} +$cup = $this->magicTarget('air', $pl, $id, $btl); diff --git a/_incl_data/class/priem/276.php b/_incl_data/class/priem/276.php index 5343b9d1..7648c744 100644 --- a/_incl_data/class/priem/276.php +++ b/_incl_data/class/priem/276.php @@ -101,11 +101,9 @@ if( isset($pr_momental_this)) { // // - //$priem->addPriem($u1,278,'|add_yzm3=-'.($btl->users[$btl->uids[$u2]]['level']).'',2,77,2,$u2,100,'инейкасание',0,0,1); $pvr['x55'] = mysql_fetch_array(mysql_query('SELECT `id`,`x` FROM `eff_users` WHERE `uid` = "'.$u1.'" AND `v2` = 25 AND `delete` = 0 LIMIT 1')); if( $pvr['x55']['x'] <1 ) { $priem->addPriem($u1,25,-1,2,77,-1,$u2,5,'цельводы',0,0,1); - //$priem->addPriem($u1,25,'|add_zm3=-20',2,77,-1,$u2,100,'цельводы',0,0,1); if( $pvr['used'] == 0 ) { $at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', "Цель Воды", diff --git a/_incl_data/class/priem/277.php b/_incl_data/class/priem/277.php index bfc7832c..75669120 100644 --- a/_incl_data/class/priem/277.php +++ b/_incl_data/class/priem/277.php @@ -145,8 +145,6 @@ if( isset($pr_momental_this)) { }*/ //} // - //$priem->addPriem($u1,279,'|add_yzm3=-'.floor($btl->users[$btl->uids[$u2]]['level']*1.25).'',2,77,2,$u2,100,'инейкасание',0,0,1); - //$priem->addPriem($u1,278,'|add_yzm3=-'.($btl->users[$btl->uids[$u2]]['level']).'',2,77,2,$u2,100,'инейкасание',0,0,1); $pvr['x5'] = mysql_fetch_array(mysql_query('SELECT `id`,`x` FROM `eff_users` WHERE `uid` = "'.$u1.'" AND `v2` = 25 AND `delete` = 0 LIMIT 1')); if( $pvr['x5']['x'] < 5 ) { $priem->addPriem($u1,25,'|add_zm3=-20',2,77,-1,$u2,100,'цельводы',0,0,1); diff --git a/_incl_data/class/priem/28.php b/_incl_data/class/priem/28.php index 61ff58d2..135c9698 100644 --- a/_incl_data/class/priem/28.php +++ b/_incl_data/class/priem/28.php @@ -1,76 +1,14 @@ -ue['id'].'" AND `v2` = 28 AND `delete` = 0 LIMIT 1')); -if( $pvr['x5']['x'] < 5 ) { - $prv['x'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['x'] = ' x'.($pvr['x5']['x']+1).''; - } - // - $this->addEffPr($pl,$id); - // - $prv['effx'] = ''; - if( $pvr['x5']['x'] > 0 ) { - $prv['eff'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id` = "'.$pvr['x5']['id'].'" LIMIT 1')); - if( isset($prv['eff']['id']) ) { - //Разбираем дату $prv['eff']['data'] - $prv['eda'] = $prv['eff']['data']; - } - }else{ - //Разбираем дату $pl['date3'] - $prv['eda'] = $pl['date3']; - } - // - if( isset($prv['eda']) ) { - $prv['d'] = $u->lookStats($prv['eda']); - $prv['j'] = $u->lookStats($this->redate($prv['eda'],$u->info['id'])); - $prv['v'] = $u->lookKeys($this->redate($prv['eda'],$u->info['id']),0); // ключи 2 - $prv['i'] = 0; $prv['inf'] = ''; - while($prv['i']is[$prv['vi']]!='') { - if($prv['j'][$prv['v'][$prv['i']]]>0) { - $prv['inf'] .= $u->is[$prv['vi']].': +'.($prv['j'][$prv['v'][$prv['i']]]*(1+$pvr['x5']['x'])).', '; - }elseif($prv['j'][$prv['v'][$prv['i']]]<0){ - $prv['inf'] .= $u->is[$prv['vi']].': '.($prv['j'][$prv['v'][$prv['i']]]*(1+$prv['x5']['x'])).', '; - } - } - $prv['i']++; - } - $prv['effx'] = rtrim($prv['inf'],', '); - } - // - if( $prv['effx'] != '' ) { - $prv['effx'] = ' ('.$prv['effx'].')'; - } - // - $prv['color2'] = '000000'; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'.$prv['effx']; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Цель земли'.$prv['x'].'', - $prv['text2'], - ($btl->hodID + 0) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/10).'',0,77,-1,$u->info['id'],5,'цельводы',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); -}else{ - $cup = true; - echo 'На пероснаже достигнуто максиальное колличество целей'; -} +/** + * Прием: Цель {стихия} + * @var $this Priems + * @var $btl Battle + * @var $id + * @var $pl + */ -unset($pvr); -?> \ No newline at end of file +if (!$id) { + exit(); +} +$cup = $this->magicTarget('earth', $pl, $id, $btl); diff --git a/_incl_data/class/priem/290.php b/_incl_data/class/priem/290.php index 30b668f0..982ca9c0 100644 --- a/_incl_data/class/priem/290.php +++ b/_incl_data/class/priem/290.php @@ -30,7 +30,7 @@ if($btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; }elseif( $pvr['hpNow'] < 0 ) { diff --git a/_incl_data/class/priem/294.php b/_incl_data/class/priem/294.php index e3a1a02d..7ca59d50 100644 --- a/_incl_data/class/priem/294.php +++ b/_incl_data/class/priem/294.php @@ -39,34 +39,12 @@ if( isset($pr_used_this) && isset($pr_moment) ) { if( $pvr['hp'] < 1 ) { $pvr['hp'] = 1; } - // - /* - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - */ - // + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/295.php b/_incl_data/class/priem/295.php index 07ecb25c..395a8381 100644 --- a/_incl_data/class/priem/295.php +++ b/_incl_data/class/priem/295.php @@ -39,34 +39,12 @@ if( isset($pr_used_this) && isset($pr_moment) ) { if( $pvr['hp'] < 1 ) { $pvr['hp'] = 1; } - // - /* - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - */ - // + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/296.php b/_incl_data/class/priem/296.php index 53aa2fe1..6a3989fe 100644 --- a/_incl_data/class/priem/296.php +++ b/_incl_data/class/priem/296.php @@ -39,34 +39,12 @@ if( isset($pr_used_this) && isset($pr_moment) ) { if( $pvr['hp'] < 1 ) { $pvr['hp'] = 1; } - // - /* - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - */ - // + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/299.php b/_incl_data/class/priem/299.php index b62d2a2a..ef3dacf7 100644 --- a/_incl_data/class/priem/299.php +++ b/_incl_data/class/priem/299.php @@ -41,32 +41,12 @@ if( isset($pr_used_this) && isset($pr_moment) ) { $pvr['promah'] = $pvr['hp'][2]; $pvr['krit'] = $pvr['hp'][1]; $pvr['hp'] = $pvr['hp'][0]; - /*// - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - }*/ - // + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/300.php b/_incl_data/class/priem/300.php index 4d416d0c..d0cfa0a8 100644 --- a/_incl_data/class/priem/300.php +++ b/_incl_data/class/priem/300.php @@ -40,23 +40,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { //действия $pvr['hp'] = rand(15,25); - /*// - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - }*/ - // + $pvr['hp'] = rand(15,25); if( $pvr['ijk'] == 1 ) { $pvr['mgtype'] = 5; @@ -101,11 +85,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/301.php b/_incl_data/class/priem/301.php index 82a4725b..c32fce7d 100644 --- a/_incl_data/class/priem/301.php +++ b/_incl_data/class/priem/301.php @@ -41,32 +41,12 @@ if( isset($pr_used_this) && isset($pr_moment) ) { $pvr['promah'] = $pvr['hp'][2]; $pvr['krit'] = $pvr['hp'][1]; $pvr['hp'] = $pvr['hp'][0]; - /*// - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - }*/ - // + $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/33.php b/_incl_data/class/priem/33.php index 9a41e6a2..c80f9771 100644 --- a/_incl_data/class/priem/33.php +++ b/_incl_data/class/priem/33.php @@ -1,163 +1,23 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [6]'.$prv['xx'].'', - $prv['text2'], - ($btl->hodID) - ); - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - $pvr['hp'] = floor(53); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [6]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); + \ No newline at end of file +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); +} diff --git a/_incl_data/class/priem/34.php b/_incl_data/class/priem/34.php index abdbd1ad..b1300caf 100644 --- a/_incl_data/class/priem/34.php +++ b/_incl_data/class/priem/34.php @@ -1,108 +1,14 @@ -ue['id'].'" AND `v2` = 26 AND `delete` = 0 LIMIT 1')); - // - $pvr['hp11'] = 40+round(40/100*(5*$pvr['x5']['x'])); - $pvr['hp22'] = $pvr['hp11']; - // - // - $pvr['hp_0'] = rand($pvr['hp11'],$pvr['hp22']); - //Действие при клике - //$pvr['rx'] = rand(80,80); - //$pvr['rx'] = floor($pvr['rx']/10); - $pvr['rx'] = 1; - $pvr['xx'] = 0; - $pvr['ix'] = $btl->uids[$this->ue['id']]; - - if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { - // - $pvr['uid'] = $btl->users[$pvr['ix']]['id']; - $pvr['hp'] = floor(rand($pvr['hp11'],$pvr['hp22'])); - $pvr['hp'] = $this->magatack( $u->info['id'], $pvr['uid'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$pvr['uid']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$pvr['uid']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 5, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); - - // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - // - - // - //$prv['color2'] = $btl->mcolor[$btl->mname['земля']]; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - if( $pvr['promah_type'] == 2 ) { - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>--
    ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - }else{ - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $pvr['uid'], - 'Вспышка [8]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); - // - $pvr['xx']++; - } - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + \ No newline at end of file +/** + * Прием: Вспышка [8] + * @var $this Priems + * @var $btl Battle + * @var $id + */ + +if (!$id) { + exit(); +} + +$this->fireFlash(8, $btl, $id); diff --git a/_incl_data/class/priem/38.php b/_incl_data/class/priem/38.php index 06b2aab2..453f1c81 100644 --- a/_incl_data/class/priem/38.php +++ b/_incl_data/class/priem/38.php @@ -27,8 +27,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; @@ -104,7 +104,7 @@ $pvr = array(); $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/39.php b/_incl_data/class/priem/39.php index c0a718ff..0973e2d2 100644 --- a/_incl_data/class/priem/39.php +++ b/_incl_data/class/priem/39.php @@ -17,7 +17,8 @@ $pvr = array(); $pvr['ix'] = 0; // -$pkrit=0; +$pkrit=0; + while( $pvr['ix'] < count($btl->users) ) { if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { // @@ -39,8 +40,8 @@ while( $pvr['ix'] < count($btl->users) ) { $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/42.php b/_incl_data/class/priem/42.php index fa38af2d..81434a19 100644 --- a/_incl_data/class/priem/42.php +++ b/_incl_data/class/priem/42.php @@ -60,11 +60,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/50.php b/_incl_data/class/priem/50.php index 0a57b224..7d713d52 100644 --- a/_incl_data/class/priem/50.php +++ b/_incl_data/class/priem/50.php @@ -55,8 +55,7 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/51.php b/_incl_data/class/priem/51.php index 06f83698..2fabcf8e 100644 --- a/_incl_data/class/priem/51.php +++ b/_incl_data/class/priem/51.php @@ -56,8 +56,7 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/52.php b/_incl_data/class/priem/52.php index 33f9d2bd..f316767c 100644 --- a/_incl_data/class/priem/52.php +++ b/_incl_data/class/priem/52.php @@ -8,7 +8,9 @@ if(!defined('GAME')) { $pvr = array(); //Действие при клике $pvr['hp'] = 58; - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 1 ); + + $pvr['hp'] = $this->magatack($this->u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 1 ); + $pvr['promah_type'] = $pvr['hp'][3]; $pvr['promah'] = $pvr['hp'][2]; $pvr['krit'] = $pvr['hp'][1]; @@ -18,11 +20,11 @@ $pvr = array(); $pvr['hpAll'] = $btl->stats[$btl->uids[$this->ue['id']]]['hpAll']; //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 5, true ); + $pvr['hp'] = $btl->testYronPriem( $this->u->info['id'], $this->ue['id'], 21, $pvr['hp'], 5, true ); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$this->ue['id'],$pvr['hp'],0); + $btl->priemYronSave($this->u->info['id'],$this->ue['id'],$pvr['hp'],0); if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; @@ -34,7 +36,7 @@ $pvr = array(); mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'].'" WHERE `id` = "'.$this->ue['id'].'" LIMIT 1'); - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); + $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$this->u->info['id']]]['sex'] , NULL); //Цвет приема if( $pvr['promah'] == false ) { @@ -56,14 +58,14 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($this->u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { - $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; + $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$this->u->info['id']]]['sex'] , NULL); + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($this->u->info['id'],$this->ue['id'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], + $btl->priemAddLog( $id, 1, 2, $this->u->info['id'], $this->ue['id'], 'Испепеление [8]', $prv['text2'], ($btl->hodID + 1) diff --git a/_incl_data/class/priem/53.php b/_incl_data/class/priem/53.php index 0c7de42b..5769a5b3 100644 --- a/_incl_data/class/priem/53.php +++ b/_incl_data/class/priem/53.php @@ -56,8 +56,7 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/54.php b/_incl_data/class/priem/54.php index dd41319e..5ddcb5cf 100644 --- a/_incl_data/class/priem/54.php +++ b/_incl_data/class/priem/54.php @@ -56,8 +56,7 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - + $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/55.php b/_incl_data/class/priem/55.php index f78e011b..795b13bb 100644 --- a/_incl_data/class/priem/55.php +++ b/_incl_data/class/priem/55.php @@ -56,8 +56,7 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - + $prv['text2'] = '{tm1} '.$prv['text'].'. '.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/56.php b/_incl_data/class/priem/56.php index 3642c051..4a8bddaf 100644 --- a/_incl_data/class/priem/56.php +++ b/_incl_data/class/priem/56.php @@ -1,163 +1,26 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [7]'.$prv['xx'].'', - $prv['text2'], - ($btl->hodID) - ); - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - $pvr['hp'] = floor(63); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [7]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); -} -unset($pvr); -?> \ No newline at end of file +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); +} diff --git a/_incl_data/class/priem/57.php b/_incl_data/class/priem/57.php index a1c5aeaa..a143851d 100644 --- a/_incl_data/class/priem/57.php +++ b/_incl_data/class/priem/57.php @@ -1,163 +1,26 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [8]'.$prv['xx'].'', - $prv['text2'], - ($btl->hodID) - ); - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - $pvr['hp'] = floor(77); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [8]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); -} -unset($pvr); -?> \ No newline at end of file +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); +} diff --git a/_incl_data/class/priem/58.php b/_incl_data/class/priem/58.php index 0249d975..cf237d4a 100644 --- a/_incl_data/class/priem/58.php +++ b/_incl_data/class/priem/58.php @@ -1,168 +1,26 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [9]'.$prv['xx'].'', - $prv['text2'], - ($btl->hodID) - ); - // спасение - $btl->spaCheck($u1); - // спасение - - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - $pvr['hp'] = floor(91); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [9]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); } - -unset($pvr); -?> \ No newline at end of file diff --git a/_incl_data/class/priem/59.php b/_incl_data/class/priem/59.php index 91db6b36..bee83011 100644 --- a/_incl_data/class/priem/59.php +++ b/_incl_data/class/priem/59.php @@ -1,169 +1,26 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [10]'.$prv['xx'].'', //Тут урон от пожиралки - $prv['text2'], - ($btl->hodID) - ); - - // спасение - $btl->spaCheck($u1); - // спасение - - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}elseif( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) ) { - -}else{ - $pvr['hp'] = floor(110); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [10]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); -} -unset($pvr); -?> \ No newline at end of file +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); +} diff --git a/_incl_data/class/priem/60.php b/_incl_data/class/priem/60.php index 20d59a6b..011b6435 100644 --- a/_incl_data/class/priem/60.php +++ b/_incl_data/class/priem/60.php @@ -1,166 +1,26 @@ -atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if( $uid == $uid1 ) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - }elseif( $uid == $uid2 ) { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if( $a > 0 ) { - - //Проверяем эффект - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - $prv['priem_th'] = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id']; - - //действия - $pvr['hp'] = 1; - // - $pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pvr['di'] = 0; - $pvr['dc'] = count($pvr['data']['atgm']); - $pvr['rd'] = 0; - $pvr['redata'] = ''; - while( $pvr['di'] < 4 ) { - if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) { - if( $pvr['rd'] < 3 ) { - $pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]; - $pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata']; - $pvr['rd']++; - } - } - $pvr['di']++; - } - // - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata']; - mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); - // - $pvr['hp'] = floor($pvr['hp']*5); - $pvr['proc-hp'] = array( 5 , 10 , 15 , 20 , 50 ); - $pvr['proc-hp'] = $pvr['proc-hp'][5-$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['hod']]; - $pvr['hp'] = round($pvr['hp']/100*$pvr['proc-hp']); - // - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ - // - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'],$u1,$pvr['hp'],0); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u1]]['hpNow'].'" WHERE `id` = "'.$u1.'" LIMIT 1'); - //$prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text'] = '{u2} утратил здоровье от "{pr}"'; - - //Цвет приема - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - $prv['color'] = '008000'; - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - if( $pvr['promah_type'] == 2 ) { - //$prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u2]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u2,$u1,1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $prv['xx'] = ''; - if( $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'] > 1 ) { - //$prv['xx'] = ' x'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['x'].''; - } - $btl->priemAddLog( $id, 1, 2, $u2, $u1, - 'Пожирающее Пламя [11]'.$prv['xx'].'', - $prv['text2'], - ($btl->hodID) - ); - // спасение - $btl->spaCheck($u1); - // спасение - } - // -- конец приема - return $at; - }; - unset( $pr_used_this ); -}else{ - $pvr['hp'] = floor(135); - $pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], 'огонь', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - // - $prv['color2'] = '000000'; - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '000000'; - }else{ - $prv['color2'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - } - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - $prv['text2'] = '{tm1} '.$prv['text'].'.'; - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'], - 'Пожирающее Пламя [11]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - if ($pvr['hp']>0) - { - $this->addPriem($this->ue['id'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'пожирающеепламя',0,0,1); - } - //Отнимаем тактики - //$this->mintr($pl); -} -unset($pvr); -?> \ No newline at end of file +if (isset($pr_used_this) && isset($pr_moment)) { + //Каждый ход + $fx_priem = function ($id, $at, $uid, $j_id) { + global $btl, $priem; + $priem->devouringFlame($id, $uid, $j_id, $btl); + return $at; + }; + unset($pr_used_this); +} else { + $this->devouringFlameInit($id, $pl, $btl); +} diff --git a/_incl_data/class/priem/67.php b/_incl_data/class/priem/67.php index 55e7b41f..d5917367 100644 --- a/_incl_data/class/priem/67.php +++ b/_incl_data/class/priem/67.php @@ -1,108 +1,13 @@ -ue['id'].'" AND `v2` = 26 AND `delete` = 0 LIMIT 1')); - // - $pvr['hp11'] = 45+round(45/100*(5*$pvr['x5']['x'])); - $pvr['hp22'] = $pvr['hp11']; - // - // - $pvr['hp_0'] = rand($pvr['hp11'],$pvr['hp22']); - //Действие при клике - //$pvr['rx'] = rand(80,80); - //$pvr['rx'] = floor($pvr['rx']/10); - $pvr['rx'] = 1; - $pvr['xx'] = 0; - $pvr['ix'] = $btl->uids[$this->ue['id']]; - - if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { - // - $pvr['uid'] = $btl->users[$pvr['ix']]['id']; - $pvr['hp'] = floor(rand($pvr['hp11'],$pvr['hp22'])); - $pvr['hp'] = $this->magatack( $u->info['id'], $pvr['uid'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$pvr['uid']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$pvr['uid']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 5, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); - - // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - // - - // - //$prv['color2'] = $btl->mcolor[$btl->mname['земля']]; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - if( $pvr['promah_type'] == 2 ) { - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - }else{ - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $pvr['uid'], - 'Вспышка [9]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); - // - $pvr['xx']++; - } - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + \ No newline at end of file +/** + * Прием: Вспышка [9] + * @var $this Priems + * @var $btl Battle + * @var $id + */ + +if (!$id) { + exit(); +} +$this->fireFlash(9, $btl, $id); diff --git a/_incl_data/class/priem/68.php b/_incl_data/class/priem/68.php index 4b59ffdd..3d5742af 100644 --- a/_incl_data/class/priem/68.php +++ b/_incl_data/class/priem/68.php @@ -1,108 +1,13 @@ -ue['id'].'" AND `v2` = 26 AND `delete` = 0 LIMIT 1')); - // - $pvr['hp11'] = 50+round(50/100*(5*$pvr['x5']['x'])); - $pvr['hp22'] = $pvr['hp11']; - // - // - $pvr['hp_0'] = rand($pvr['hp11'],$pvr['hp22']); - //Действие при клике - //$pvr['rx'] = rand(80,80); - //$pvr['rx'] = floor($pvr['rx']/10); - $pvr['rx'] = 1; - $pvr['xx'] = 0; - $pvr['ix'] = $btl->uids[$this->ue['id']]; - - if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { - // - $pvr['uid'] = $btl->users[$pvr['ix']]['id']; - $pvr['hp'] = floor(rand($pvr['hp11'],$pvr['hp22'])); - $pvr['hp'] = $this->magatack( $u->info['id'], $pvr['uid'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$pvr['uid']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$pvr['uid']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 5, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); - - // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - // - - // - //$prv['color2'] = $btl->mcolor[$btl->mname['земля']]; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - if( $pvr['promah_type'] == 2 ) { - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - }else{ - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $pvr['uid'], - 'Вспышка [10]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); - // - $pvr['xx']++; - } - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + \ No newline at end of file +/** + * Прием: Вспышка [10] + * @var $this Priems + * @var $btl Battle + * @var $id + */ + +if (!$id) { + exit(); +} +$this->fireFlash(10, $btl, $id); diff --git a/_incl_data/class/priem/69.php b/_incl_data/class/priem/69.php index cb3a5a50..9bcb9869 100644 --- a/_incl_data/class/priem/69.php +++ b/_incl_data/class/priem/69.php @@ -1,108 +1,13 @@ -ue['id'].'" AND `v2` = 26 AND `delete` = 0 LIMIT 1')); - // - $pvr['hp11'] = 60+round(60/100*(5*$pvr['x5']['x'])); - $pvr['hp22'] = $pvr['hp11']; - // - // - $pvr['hp_0'] = rand($pvr['hp11'],$pvr['hp22']); - //Действие при клике - //$pvr['rx'] = rand(80,80); - //$pvr['rx'] = floor($pvr['rx']/10); - $pvr['rx'] = 1; - $pvr['xx'] = 0; - $pvr['ix'] = $btl->uids[$this->ue['id']]; - - if( $btl->stats[$pvr['ix']]['hpNow'] > 0 && $btl->users[$pvr['ix']]['team'] != $u->info['team'] && $pvr['xx'] < $pvr['rx'] && $pvr['uen'] != $btl->users[$pvr['ix']]['id'] ) { - // - $pvr['uid'] = $btl->users[$pvr['ix']]['id']; - $pvr['hp'] = floor(rand($pvr['hp11'],$pvr['hp22'])); - $pvr['hp'] = $this->magatack( $u->info['id'], $pvr['uid'], $pvr['hp'], 'огонь', 1 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0]; - $pvr['hpSee'] = '--'; - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$pvr['uid']]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$pvr['uid']]]['hpAll']; - - //Используем проверку на урон приемов - $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $pvr['uid'], 21, $pvr['hp'], 5, true ); - - $pvr['hpSee'] = '-'.$pvr['hp']; - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); - - if( $pvr['hpNow'] > $pvr['hpAll'] ) { - $pvr['hpNow'] = $pvr['hpAll']; - }elseif( $pvr['hpNow'] < 0 ) { - $pvr['hpNow'] = 0; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['hpNow'] = $pvr['hpNow']; - - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$pvr['uid']]]['hpNow'].'" WHERE `id` = "'.$pvr['uid'].'" LIMIT 1'); - - // - if( $pvr['promah'] == false ) { - if( $pvr['krit'] == false ) { - $prv['color2'] = '006699'; - if(isset($btl->mcolor[$btl->mname['огонь']])) { - $prv['color2'] = $btl->mcolor[$btl->mname['огонь']]; - } - $prv['color'] = '000000'; - if(isset($btl->mncolor[$btl->mname['огонь']])) { - $prv['color'] = $btl->mncolor[$btl->mname['огонь']]; - } - }else{ - $prv['color2'] = 'FF0000'; - $prv['color'] = 'FF0000'; - } - }else{ - $prv['color2'] = '909090'; - $prv['color'] = '909090'; - } - // - - // - //$prv['color2'] = $btl->mcolor[$btl->mname['земля']]; - $prv['text'] = $btl->addlt(1 , 19 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); - if( $pvr['promah_type'] == 2 ) { - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>-- ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - }else{ - $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$pvr['uid'],1).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; - } - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $pvr['uid'], - 'Вспышка [11]', - $prv['text2'], - ($btl->hodID + 1) - ); - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($pvr['uid'],$pl['id'],'atgm='.floor($pvr['hp']/5).'',0,77,5,$u->info['id'],1,'ядовитоеоблако',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); - // - $pvr['xx']++; - } - - //Добавляем прием - //$this->addEffPr($pl,$id); - //$this->addPriem($this->ue['id'],$pl['id'],'atgm='.($pvr['hp']/16).'',2,77,4,$u->info['id'],3,'оледенение',0,0,1); - - //Отнимаем тактики - //$this->mintr($pl); + \ No newline at end of file +/** + * Прием: Вспышка [11] + * @var $this Priems + * @var $btl Battle + * @var $id + */ + +if (!$id) { + exit(); +} +$this->fireFlash(11, $btl, $id); diff --git a/_incl_data/class/priem/7.php b/_incl_data/class/priem/7.php index 0ab2a6bd..f558d869 100644 --- a/_incl_data/class/priem/7.php +++ b/_incl_data/class/priem/7.php @@ -12,17 +12,13 @@ if( isset($pr_momental_this)) { if(!isset($btl->stats[$btl->uids[$uid]]['um_priem'][$j_id])) { global $u, $btl, $inlog; $yron = $yron/2; - /* - $btl->priemAddLogFast( $uid, 0, "".$btl->stats[$btl->uids[$u2]]['effects'][$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][0]]['name']."", - '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', - 0, time() );*/ - if( !isset($btl->prlog[$uid][$j_id]) ) { - $btl->prlog[$uid][$j_id] = true; + + // $btl->priemAddLogFast( $uid, 0, "Активная защита", '{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid]]['sex'] , NULL).'', 1, time() ); - } + if( $yron < 0 ) { $yron = 1; } @@ -108,15 +104,14 @@ if( isset($pr_momental_this)) { */ //Новый - if( !isset($btl->prlog[$uid][$j_id]) ) { - $btl->prlog[$uid][$j_id] = true; + // $at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->deleffm(7,'.(0+$uid).','.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'); $this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.', "Активная защита", "{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'", '.($btl->hodID + 1).' );'; - } + // $at['p'][$a]['atack'][$j]['yron']['used'][] = array($j_id,$uid,$pvr['used']); $at['p'][$a]['atack'][$j]['yron']['kill'][] = array($j_id,$uid,$pvr['kill']); diff --git a/_incl_data/class/priem/70.php b/_incl_data/class/priem/70.php index 39da048b..840d456f 100644 --- a/_incl_data/class/priem/70.php +++ b/_incl_data/class/priem/70.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/71.php b/_incl_data/class/priem/71.php index d93e3cc0..ac0620bc 100644 --- a/_incl_data/class/priem/71.php +++ b/_incl_data/class/priem/71.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/72.php b/_incl_data/class/priem/72.php index 4c5b4ba1..2dbe0d1b 100644 --- a/_incl_data/class/priem/72.php +++ b/_incl_data/class/priem/72.php @@ -59,11 +59,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/73.php b/_incl_data/class/priem/73.php index bbf69211..db0f5f19 100644 --- a/_incl_data/class/priem/73.php +++ b/_incl_data/class/priem/73.php @@ -59,7 +59,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/74.php b/_incl_data/class/priem/74.php index 373d1500..e83e8390 100644 --- a/_incl_data/class/priem/74.php +++ b/_incl_data/class/priem/74.php @@ -59,7 +59,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/75.php b/_incl_data/class/priem/75.php index d2cfa215..5e48a70c 100644 --- a/_incl_data/class/priem/75.php +++ b/_incl_data/class/priem/75.php @@ -59,7 +59,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/77.php b/_incl_data/class/priem/77.php index 3c8e205a..9838fb0d 100644 --- a/_incl_data/class/priem/77.php +++ b/_incl_data/class/priem/77.php @@ -61,7 +61,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/78.php b/_incl_data/class/priem/78.php index b941b14d..3c68362f 100644 --- a/_incl_data/class/priem/78.php +++ b/_incl_data/class/priem/78.php @@ -56,7 +56,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/79.php b/_incl_data/class/priem/79.php index f849eaca..2fa98418 100644 --- a/_incl_data/class/priem/79.php +++ b/_incl_data/class/priem/79.php @@ -59,7 +59,6 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - //$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); $pvr['promah_type'] = 0; $pvr['promah'] = false; $pvr['krit'] = false; diff --git a/_incl_data/class/priem/81.php b/_incl_data/class/priem/81.php index febc0a7a..2f2d4feb 100644 --- a/_incl_data/class/priem/81.php +++ b/_incl_data/class/priem/81.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/82.php b/_incl_data/class/priem/82.php index a9039d96..f6c76eb7 100644 --- a/_incl_data/class/priem/82.php +++ b/_incl_data/class/priem/82.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/83.php b/_incl_data/class/priem/83.php index e638ff5d..9b4aac10 100644 --- a/_incl_data/class/priem/83.php +++ b/_incl_data/class/priem/83.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/84.php b/_incl_data/class/priem/84.php index c54d3f7b..1624515d 100644 --- a/_incl_data/class/priem/84.php +++ b/_incl_data/class/priem/84.php @@ -57,11 +57,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) { mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1'); // $pvr['hp'] = floor($pvr['hp']); - /*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'вода', 0 ); - $pvr['promah_type'] = $pvr['hp'][3]; - $pvr['promah'] = $pvr['hp'][2]; - $pvr['krit'] = $pvr['hp'][1]; - $pvr['hp'] = $pvr['hp'][0];*/ + $pvr['hpSee'] = '--'; $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; diff --git a/_incl_data/class/priem/91.php b/_incl_data/class/priem/91.php index f96bfe8d..3c7df523 100644 --- a/_incl_data/class/priem/91.php +++ b/_incl_data/class/priem/91.php @@ -55,8 +55,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/92.php b/_incl_data/class/priem/92.php index 25307839..17a462cc 100644 --- a/_incl_data/class/priem/92.php +++ b/_incl_data/class/priem/92.php @@ -55,8 +55,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/93.php b/_incl_data/class/priem/93.php index 41a72392..b92bc8d3 100644 --- a/_incl_data/class/priem/93.php +++ b/_incl_data/class/priem/93.php @@ -56,8 +56,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/94.php b/_incl_data/class/priem/94.php index 5c4c45b5..d9732af4 100644 --- a/_incl_data/class/priem/94.php +++ b/_incl_data/class/priem/94.php @@ -56,9 +56,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); - + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { $prv['text'] = $btl->addlt(1 , 20 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL); diff --git a/_incl_data/class/priem/95.php b/_incl_data/class/priem/95.php index f7673cb1..7d312b87 100644 --- a/_incl_data/class/priem/95.php +++ b/_incl_data/class/priem/95.php @@ -59,7 +59,8 @@ $pvr = array(); $prv['color'] = '909090'; } - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + + $this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/96.php b/_incl_data/class/priem/96.php index 2aca8e5c..dd319f8b 100644 --- a/_incl_data/class/priem/96.php +++ b/_incl_data/class/priem/96.php @@ -57,8 +57,8 @@ $pvr = array(); $prv['color2'] = '909090'; $prv['color'] = '909090'; } - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $prv['text2'] = '{tm1} '.$prv['text'].'. '.$pvr['hpSee'].' ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']'; if( $pvr['promah_type'] == 2 ) { diff --git a/_incl_data/class/priem/97.php b/_incl_data/class/priem/97.php index 007b4178..2e409e66 100644 --- a/_incl_data/class/priem/97.php +++ b/_incl_data/class/priem/97.php @@ -23,8 +23,8 @@ $pvr = array(); //Используем проверку на урон приемов $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 6, true ); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; @@ -102,8 +102,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/98.php b/_incl_data/class/priem/98.php index e1041e0e..068b7cc9 100644 --- a/_incl_data/class/priem/98.php +++ b/_incl_data/class/priem/98.php @@ -23,8 +23,8 @@ $pvr = array(); //Используем проверку на урон приемов $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 6, true ); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; @@ -102,8 +102,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/99.php b/_incl_data/class/priem/99.php index eada55d0..cce8bb0a 100644 --- a/_incl_data/class/priem/99.php +++ b/_incl_data/class/priem/99.php @@ -23,8 +23,8 @@ $pvr = array(); //Используем проверку на урон приемов $pvr['hp'] = $btl->testYronPriem( $u->info['id'], $this->ue['id'], 21, $pvr['hp'], 6, true ); - - $this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$this->ue['id']]] ); + +$this->addAirStaticPoints(); /* Удар в Статику*/ $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; @@ -102,8 +102,8 @@ $pvr = array(); $pvr['hpSee'] = '-'.$pvr['hp']; $pvr['hpNow'] -= $pvr['hp']; $btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0); - - $this->mg2static_points( $pvr['uid'] , $btl->stats[$btl->uids[$pvr['uid']]] ); + + $this->addAirStaticPoints($pvr['uid']); /* Удар в Статику*/ if( $pvr['hpNow'] > $pvr['hpAll'] ) { $pvr['hpNow'] = $pvr['hpAll']; diff --git a/_incl_data/class/priem/_notes/readme.md b/_incl_data/class/priem/_notes/readme.md new file mode 100644 index 00000000..f26b4e25 --- /dev/null +++ b/_incl_data/class/priem/_notes/readme.md @@ -0,0 +1,3 @@ +Файлы управляющие приёмами в поеинках. +Все файлы являются частями класса `Priems`, что вызывает +массу проблем при необходимости присоединять ещё файлы. \ No newline at end of file diff --git a/_incl_data/class/priems/_notes/readme.md b/_incl_data/class/priems/_notes/readme.md new file mode 100644 index 00000000..a9ad638c --- /dev/null +++ b/_incl_data/class/priems/_notes/readme.md @@ -0,0 +1 @@ +Тут лежат файлы для использования во встроенной в предметы магии. \ No newline at end of file diff --git a/_incl_data/class/priems/curse_01.php b/_incl_data/class/priems/curse_01.php index b9b79a87..edfec68e 100644 --- a/_incl_data/class/priems/curse_01.php +++ b/_incl_data/class/priems/curse_01.php @@ -1,52 +1,8 @@ -testPower($this->stats[$this->uids[$uid1]],$this->stats[$this->uids[$uid2]],$hpmin,3,2); - //$hpmin = round($hpmin); - //if($hpmin < 0) { $hpmin = 0; } - //$hp2 = $this->stats[$this->uids[$uid2]]['hpNow']; - // - ////расчет урона стихий - // - //$hp2 -= $hpmin; - //if($hp2<0) - //{ - // $hp2 = 0; - //}elseif($hp2>$this->stats[$this->uids[$uid2]]['hpNow']) - //{ - // $hp2 = $this->stats[$this->uids[$uid2]]['hpNow']; - //} - // - //$this->takeExp($u->info['id'],$hpmin,$uid1,$uid2); - // - ////отнимаем НР - //$this->users[$this->uids[$uid2]]['hpNow'] = $hp2; - //$this->stats[$this->uids[$uid2]]['hpNow'] = $hp2; - //mysql_query('UPDATE `stats` SET `hpNow` = '.$hp2.' WHERE `id` = "'.$uid2.'" LIMIT 1'); - // - ////заносим в лог боя - //$vLog = 'time1='.time().'||s1='.$this->users[$this->uids[$uid1]]['sex'].'||t1='.$this->users[$this->uids[$uid1]]['team'].'||login1='.$this->users[$this->uids[$uid1]]['login'].'||s2='.$this->users[$this->uids[$uid2]]['sex'].'||t2='.$this->users[$this->uids[$uid2]]['team'].'||login2='.$this->users[$this->uids[$uid2]]['login'].''; - //$mas1 = array('time'=>time(),'battle'=>$this->info['id'],'id_hod'=>($this->hodID),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - //if($hpmin>0) - //{ - // $hpmin = '-'.$hpmin; - //}else{ - // $hpmin = '--'; - //} - //$mas1['text'] = '{tm1} {u2} получил повреждение от магического предмета "'.$itm['name'].'". '.$hpmin.' ['.ceil($hp2).'/'.$this->stats[$this->uids[$uid2]]['hpAll'].']'; - //$this->add_log($mas1); - } -} - - -?> \ No newline at end of file +*/ \ No newline at end of file diff --git a/_incl_data/class/priems/fire.php b/_incl_data/class/priems/fire.php index 30ffc652..0777dca8 100644 --- a/_incl_data/class/priems/fire.php +++ b/_incl_data/class/priems/fire.php @@ -373,7 +373,7 @@ if(isset($hod)) }elseif($pl['id']==57) { //Пожирающее пламя [8] - $re = $this->addPriem($uen,$pl['id'],'',0,77,5,$u->info['id'],1,'пожирающеепламя',1,1); + $re = $this->addPriem($uen,$pl['id'],'',0,77,5,$u->info['id'],1,'пожирающеепламя2',1,1); if($re==false) { echo '[Er::Пожирающее Пламя[xX]]'; diff --git a/_incl_data/class/priems/itm286.end.php b/_incl_data/class/priems/itm286.end.php index f1daadf8..cb1751a7 100644 --- a/_incl_data/class/priems/itm286.end.php +++ b/_incl_data/class/priems/itm286.end.php @@ -12,7 +12,6 @@ if($e['bm_a1']=='itm286' && $end > 0) //наносим урон магическим кольцом $hpmin = rand(5,8); $hpmin += round($this->stats[$this->uids[$uid1]]['mg1']*1.35); - //$hpmin = $priem->testPower($this->stats[$this->uids[$uid1]],$this->stats[$this->uids[$uid2]],$hpmin,1,2); // $hpmin = $priem->magatack($uid1,$uid2,$hpmin,'огонь',false); $hpmin = $hpmin[0]; diff --git a/_incl_data/class/priems/itm347.end.php b/_incl_data/class/priems/itm347.end.php index 2ebfd8b1..8fe085b9 100644 --- a/_incl_data/class/priems/itm347.end.php +++ b/_incl_data/class/priems/itm347.end.php @@ -12,7 +12,6 @@ if($e['bm_a1']=='itm347' && $end > 0) //наносим урон магическим кольцом $hpmin = rand(5,8); $hpmin += round($this->stats[$this->uids[$uid1]]['mg1']*1.35); - //$hpmin = $priem->testPower($this->stats[$this->uids[$uid1]],$this->stats[$this->uids[$uid2]],$hpmin,1,2); // $hpmin = $priem->magatack($uid1,$uid2,$hpmin,'огонь',false); $hpmin = $hpmin[0]; diff --git a/_incl_data/class/priems/moment.php b/_incl_data/class/priems/moment.php index af051ec6..898295b5 100644 --- a/_incl_data/class/priems/moment.php +++ b/_incl_data/class/priems/moment.php @@ -1,9 +1,22 @@ -info['enemy'].'" and `v2`="191" and `delete`="0" LIMIT 1')); //Ошеломить @@ -27,23 +40,6 @@ if($pl['id'] == 189) { $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$u->info['enemy']]]['sex'].'||t2='.$btl->users[$btl->uids[$u->info['enemy']]]['team'].'||login2='.$btl->users[$btl->uids[$u->info['enemy']]]['login'].''; $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); - /*$hp = $u->info['level']*2-$u->info['level']; - - if($hp < 0) { - $hp = 0; - }*/ - - /*$btl->users[$btl->uids[$u->info['enemy']]]['hpNow'] -= $hp; - $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] -= $hp; - $btl->users[$btl->uids[$u->info['enemy']]]['last_hp'] = -$hp; - mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'].'",`last_hp` = "'.$btl->users[$btl->uids[$u->info['enemy']]]['last_hp'].'" WHERE `id` = "'.$u->info['enemy'].'" LIMIT 1'); - - if($hp < 1) { - $hp = '--'; - }else{ - $hp = -$hp; - }*/ - $mas1['text'] = '{tm1} {u1} {1x16x0} прием "'.$pl['name'].'" и ошеломил'.$sx.' персонажа {u2} на два хода.'; $pz = $btl->users[$btl->uids[$u->info['enemy']]]['priems_z']; $p_id = $btl->users[$btl->uids[$u->info['enemy']]]['priems']; @@ -318,11 +314,7 @@ if($pl['id'] == 189) { $pr78++; } } - /*if($pr78 > 0) { - $this->stats[$this->uids[$u1['id']]] = $u->getStats($u1['id'],0); - $this->stats[$this->uids[$u2['id']]] = $u->getStats($u2['id'],0); - $this->re_pd['restart'] = true; - }*/ + unset($pr78,$vLog,$mas1,$pl031,$sp031); } }elseif($pl['id']==12) diff --git a/_incl_data/class/quest/dailyquest.php b/_incl_data/class/quest/dailyquest.php index 711498df..90ba70e6 100644 --- a/_incl_data/class/quest/dailyquest.php +++ b/_incl_data/class/quest/dailyquest.php @@ -11,7 +11,7 @@ $txt .= '
    Вы уже получили '; */ - +$txt = isset($txt) ?: ''; $test = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars`= "day_quest" LIMIT 1')); if (!isset($test['id'])) { diff --git a/admin.php b/admin.php deleted file mode 100644 index cf14996a..00000000 --- a/admin.php +++ /dev/null @@ -1,578 +0,0 @@ -addItem(730, $pl['id'], '|nosale=1|notransfer=1|sudba=1|halo1=1'); - //$u->addItem(1167, $pl['id'], '|nosale=1|notransfer=1|sudba=1|halo1=1'); - - $i = 1; - while( $i <= 25 ) { - //$u->addItem(4913, $pl['id'], '|nosale=1|notransfer=1|sudba=1|halo1=1'); - if( $i <= 10 ) { - //$u->addItem(4039, $pl['id'], '|nosale=1|notransfer=1|sudba=1|halo1=1'); - } - //$u->addItem(4690, $pl['id'], '|nosale=1|notransfer=1|sudba=1|halo1=1'); - $i++; - } - - // - /*$sp1 = mysql_query('SELECT `id` FROM `items_main` WHERE `magic_inci` = "tznanie" AND `name` NOT LIKE "%(том%" AND `name` NOT LIKE "%(секретный том%"'); - while( $pl1 = mysql_fetch_array($sp1) ) { - mysql_query('INSERT INTO `actions` ( - `uid`,`time`,`city`,`room`,`vars`,`vals` - ) VALUES ( - "'.$pl['id'].'","'.time().'","capitalcity","213","read","'.$pl1['id'].'" - )'); - }*/ - - } - die(); -} - -include('_incl_data/class/bot.logic.php'); - - -if( $u->info['admin'] > 0 ) { - - - if(isset($_POST['complect_saver'])) { - - $cs = $_POST['complect_saver']; - - $cs = json_decode($cs); - - $v1 = ''; - $v2 = ''; - $eff = '0'; - $csa = $cs->{'lvl'}; - $csm = $cs->{'lvl'}+1; - if($csa > 5) { - $csa = 5; - } - if($csm > 10) { - $csm = 10; - } - - $up_id = 0; - - $sp = mysql_query('SELECT * FROM `levels` ORDER BY `upLevel`'); - $ups = array(); - $all_ups = array(); - $lvl = 0; - while($pl = mysql_fetch_array($sp)) { - $all_ups[$lvl][(0+$ups[$lvl])] = ($pl['upLevel']-1); - $ups[$lvl]++; - if($lvl != $pl['nextLevel']) { - $lvl = $pl['nextLevel']; - }else{ - } - } - - $up_id = $all_ups[$cs->{'lvl'}][$cs->{'up'}]; - - $stats = 's1='.$cs->{'s1'}.'|s2='.$cs->{'s2'}.'|s3='.$cs->{'s3'}.'|s4='.$cs->{'s4'}.'|rinv=40|m9=5|m6=10|a1='.$csa.'|a2='.$csa.'|a3='.$csa.'|a4='.$csa.'|a5='.$csa.'|mg1='.$csm.'|mg2='.$csm.'|mg3='.$csm.'|mg4='.$csm.'|mg5='.$csm.'|mg6='.$csa.'|mg7='.$csa.'|s5='.$cs->{'s5'}.'|s6='.$cs->{'s6'}.'|os1=0|os2=0|os3=0|os4=0|os5=0|os6=0|os7=0|os8=0|os9=0|os10=0|os11=0|s7=0|s8=0|s9=0|s10=0|a6=5|a7=5'; - - $i = 0; - while( $i < 20 ) { - - if( $cs->{'w'.$i} > 0 ) { - $v1 .= ',`w'.$i.'`'; - $v2 .= ',"'.$cs->{'w'.$i}.'"'; - } - - if( $cs->{'s'.$i} > 0 ) { - $v1 .= ',`s'.$i.'`'; - $v2 .= ',"'.$cs->{'s'.$i}.'"'; - } - - if( $cs->{'e'.$i} > 0 ) { - $v1 .= ',`e'.$i.'`'; - $v2 .= ',"'.$cs->{'e'.$i}.'"'; - $eff .= ','.$i; - } - - if( $cs->{'p'.$i} > 0 ) { - $v1 .= ',`p'.$i.'`'; - $v2 .= ',"'.$cs->{'p'.$i}.'"'; - } - - $i++; - } - mysql_query('INSERT INTO `a_bot_tree` (`delete`,`class`,`level`,`up`,`stats`,`eff`,`pr`'.$v1.') VALUES ("1","'.$cs->{'class'}.'","'.$cs->{'lvl'}.'","'.$up_id.'","'.$stats.'","'.$eff.'","'.$pr.'"'.$v2.') '); - - $_GET['good'] = mysql_insert_id(); - //header('location: admin.php?good'); - } - - if(isset($_GET['good'])) { - $error = 'Комлпект был успешно сохранен!

    Номер комплекта: '.$_GET['good']; - die($error); - } - - - /* ПРЕДМЕТЫ */ - $w = array(); - $ws = array( - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 10, - 10, - 13, - 14, - 15, - 16, - 17 - ); - - $i = 1; - while( $i <= 17 ) { - if($i != 14) { - $sp = mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `inslot` = "'.$ws[$i].'" ORDER BY `type` ASC,`level` ASC'); - while($pl = mysql_fetch_array($sp)) { - $w[$i] .= '['.$pl['id'].',"'.$pl['name'].'","'.$pl['img'].'"],'; - } - $w[$i] = rtrim($w[$i],','); - } - $i++; - } - - $sp = mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `2too` = "1" OR `inslot` = "14" ORDER BY `type` ASC,`level` ASC'); - while($pl = mysql_fetch_array($sp)) { - $w[14] .= '['.$pl['id'].',"'.$pl['name'].'","'.$pl['img'].'"],'; - } - $w[14] = rtrim($w[14],','); - - - /* ПРИЕМЫ */ - $pr = ''; - - $sp = mysql_query('SELECT `id`,`name`,`img` FROM `priems` ORDER BY `img` ASC'); - while($pl = mysql_fetch_array($sp)) { - $pr .= '['.$pl['id'].',"'.$pl['name'].'","'.$pl['img'].'.gif"],'; - } - $pr = rtrim($pr,','); - - - /* ЭФФЕКТЫ */ - $eff = ''; - - $sp = mysql_query('SELECT `id2`,`mname`,`img` FROM `eff_main` WHERE `type1` != 23 ORDER BY `type1` ASC'); - while($pl = mysql_fetch_array($sp)) { - $eff .= '['.$pl['id2'].',"'.$pl['mname'].'","'.$pl['img'].'"],'; - } - $eff = rtrim($eff,','); - - -?> - - - - - - -Редактор обмундирования персонажей - - - - - - - - - - - - - - -
    -
    - -
    - - - - - - -
    - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    -
     
    - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    -

    Эффекты:

    - - - - - - - - - - - - - - - - - -
    -

    Приемы:

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Сохранить комплект в базу

    Статы персонажа (родные):

    -

    - Сила: -
    - Ловкость: -
    - Интуиция: -
    - Выносливость: -
    - Интелект: -
    - Мудрость: - -

    -

    Выберите класс комплекта и апп:

    -

    - Класс: - -
    - Уровень: - -
    - Апп: - -
    -

    - -
    -
    -
    -
    - Предметы для слота: -
    -
    - -
    -
    - - - - \ No newline at end of file diff --git a/balance.php b/balance.php index c1f56317..1e1db0ed 100644 --- a/balance.php +++ b/balance.php @@ -1,319 +1,415 @@ info['admin'] != 1 && !isset($_COOKIE['adminionself']) ) { - die('balance.php'); +$u = User::start(); +if (isset($_GET['connect'])) { + setcookie('adminionself', 'trueself', time() + 86400); + header('location: /balance.php'); + die(); +} elseif ($u->info['admin'] != 1 && !isset($_COOKIE['adminionself'])) { + die('balance.php'); } -if($u->info['admin']<1 && !isset($_COOKIE['adminionself'])) -{ - header('location: https://new-combats.com/'); die(); +if ($u->info['admin'] < 1 && !isset($_COOKIE['adminionself'])) { + header('location: https://new-combats.com/'); + die(); } $noobs = ''; -/* -if(!isset($_GET['noob']) || isset($_POST['money'])) { - $noobs = ' AND `time` < 1443155244 '; -} -*/ +if (isset($_GET['all'])) { + $data = [ -if(isset($_GET['all'])) { - $data = array( - - ); //по дням с самого начала - $sp = mysql_query('SELECT * FROM `balance_money` WHERE `money` > 0'.$noobs.' ORDER BY `id` ASC'); - $max = 0; - // - $starttime = mysql_fetch_array(mysql_query('SELECT `time` FROM `balance_money` ORDER BY `id` ASC LIMIT 1')); - if(isset($starttime['time'])) { - $starttime = $starttime['time']; - }else{ - $starttime = time(); - } - // - while( $pl = mysql_fetch_array($sp) ) { - if($starttime == 0) { - $starttime = $pl['time']-50700; - } - $data[date('d.m.Y',$pl['time'])] += $pl['money']; - if( $max < $pl['money'] ) { - $max = $pl['money']; - } - } - echo ''; - echo ' + echo '
    '; - $i = $starttime; - $j = 0; - $mn = 0; - while( $i <= time() ) { - // - $nl = 0; - if( $data[date('d.m.Y',$i)] == 0 ) { - $nl = 1; - } - if( $mn != date('m',$i) || date('d.m.Y') == date('d.m.Y',$i) ) { - if( $mn != 0 ) { - echo '
    '.$summ.' RUB


    '; - } - $summ = 0; - $mn = date('m',$i); - } - echo ''; - // - $i += 86400; - $sum += round(($data[date('d.m.Y',$i)]),2); - $summ += round(($data[date('d.m.Y',$i)]),2); - $today = round(($data[date('d.m.Y',$i)]),2); - $j++; - } - // - // - // - echo '
     

    Дней: '.$j.' , сумма: '.$sum.' RUB
    Среднее в день: '.round($sum/$j,2).' RUB
    Среднее в месяц: '.round($sum/$j*30,2).' RUB
    За сегодня: '.$today.' RUB'; - die(); + $i = $starttime; + $j = 0; + $mn = 0; + while ($i <= time()) { + // + $nl = 0; + if ($data[date('d.m.Y', $i)] == 0) { + $nl = 1; + } + if ($mn != date('m', $i) || date('d.m.Y') == date('d.m.Y', $i)) { + if ($mn != 0) { + echo '
    ' . $summ . ' RUB

    '; + } + $summ = 0; + $mn = date('m', $i); + } + echo ''; + // + $i += 86400; + $sum += round(($data[date('d.m.Y', $i)]), 2); + $summ += round(($data[date('d.m.Y', $i)]), 2); + $today = round(($data[date('d.m.Y', $i)]), 2); + $j++; + } + // + // + // + echo '
     

    Дней: ' . $j . ' , сумма: ' . $sum . ' RUB
    Среднее в день: ' . round( + $sum / $j, 2 + ) . ' RUB
    Среднее в месяц: ' . round($sum / $j * 30, 2) . ' RUB
    За сегодня: ' . $today . ' RUB'; + die(); } -if(isset($_POST['money'])) -{ - $balance = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0'.$noobs.'')); - $balance = $balance[0]+(int)$_POST['money']; - mysql_query('INSERT INTO `balance_money` (`time`,`ip`,`money`,`comment2`,`balance`) VALUES ("'.time().'","'.$u->info['ip'].'","'.((int)$_POST['money']).'","'.mysql_real_escape_string($_POST['text']).'","'.$balance.'")'); -}elseif(isset($_GET['cancel'])) -{ - mysql_query('UPDATE `balance_money` SET `cancel` = "'.$u->info['id'].'" WHERE `id` = "'.((int)$_GET['cancel']).'" LIMIT 1'); -}elseif(isset($_GET['recancel'])) -{ - mysql_query('UPDATE `balance_money` SET `cancel` = "0" WHERE `id` = "'.((int)$_GET['recancel']).'" LIMIT 1'); +if (isset($_POST['money'])) { + $balance = mysql_fetch_array( + mysql_query('SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0' . $noobs . '') + ); + $balance = $balance[0] + (int)$_POST['money']; + mysql_query( + 'INSERT INTO `balance_money` (`time`,`ip`,`money`,`comment2`,`balance`) VALUES ("' . time( + ) . '","' . $u->info['ip'] . '","' . ((int)$_POST['money']) . '","' . mysql_real_escape_string( + $_POST['text'] + ) . '","' . $balance . '")' + ); +} elseif (isset($_GET['cancel'])) { + mysql_query( + 'UPDATE `balance_money` SET `cancel` = "' . $u->info['id'] . '" WHERE `id` = "' . ((int)$_GET['cancel']) . '" LIMIT 1' + ); +} elseif (isset($_GET['recancel'])) { + mysql_query('UPDATE `balance_money` SET `cancel` = "0" WHERE `id` = "' . ((int)$_GET['recancel']) . '" LIMIT 1'); } $mm = date('m'); $yy = date('Y'); -if(isset($_GET['mm'])) -{ - $mm = $_GET['mm'];//strtotime +if (isset($_GET['mm'])) { + $mm = $_GET['mm'];//strtotime } -$mf = array( -'01' => 'January', -'02' => 'February', -'03' => 'March', -'04' => 'April', -'05' => 'May', -'06' => 'June', -'07' => 'July', -'08' => 'August', -'09' => 'September', -'10' => 'October', -'11' => 'November', -'12' => 'December' -); -$mf2 = array( -'12' => 'January', -'01' => 'February', -'02' => 'March', -'03' => 'April', -'04' => 'May', -'05' => 'June', -'06' => 'July', -'07' => 'August', -'08' => 'September', -'09' => 'October', -'10' => 'November', -'11' => 'December' -); -if(!isset($mf[$mm])) -{ - $mm = date('m'); +$mf = [ + '01' => 'January', + '02' => 'February', + '03' => 'March', + '04' => 'April', + '05' => 'May', + '06' => 'June', + '07' => 'July', + '08' => 'August', + '09' => 'September', + '10' => 'October', + '11' => 'November', + '12' => 'December', +]; +$mf2 = [ + '12' => 'January', + '01' => 'February', + '02' => 'March', + '03' => 'April', + '04' => 'May', + '05' => 'June', + '06' => 'July', + '07' => 'August', + '08' => 'September', + '09' => 'October', + '10' => 'November', + '11' => 'December', +]; +if (!isset($mf[$mm])) { + $mm = date('m'); } $yy2 = $yy; -if($mm=='12') -{ - $yy2++; +if ($mm == '12') { + $yy2++; } -$time_start = strtotime("1 ".$mf[$mm]." ".$yy.""); -$time_finish = strtotime("1 ".$mf2[$mm]." ".$yy2.""); +$time_start = strtotime("1 " . $mf[$mm] . " " . $yy . ""); +$time_finish = strtotime("1 " . $mf2[$mm] . " " . $yy2 . ""); -$balance = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0'.$noobs.'')); +$balance = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0' . $noobs . '')); $balance = $balance[0]; -$plus = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0'.$noobs.' AND `time` >= '.$time_start.' AND `time` < '.$time_finish.' AND `cancel` = "0"')); +$plus = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money`) FROM `balance_money` WHERE `cancel` = 0' . $noobs . ' AND `time` >= ' . $time_start . ' AND `time` < ' . $time_finish . ' AND `cancel` = "0"' + ) +); $plus = $plus[0]; ?> - -Отчетность проекта - - + + Отчетность проекта + + - - - - - - - + + + + + + +
    - Период отчетности: - - , - года. - Доступные средства: - RUB | Прибыль за этот месяц: RUB | Дата генерации отчета: - -
    - = '.$dt.''.$noobs.' AND `time` < '.($dt+86400).'')); - $lim = $lim[0]; - $mst = mysql_fetch_array(mysql_query('SELECT `money`,`balance` FROM `balance_money` WHERE `time` < '.$dt.''.$noobs.' AND `cancel` = "0" ORDER BY `id` DESC LIMIT 1')); $mst = $mst['balance']; - $mft = mysql_fetch_array(mysql_query('SELECT `money`,`balance` FROM `balance_money` WHERE `time` >= '.$dt.''.$noobs.' AND `time` < '.($dt+86400).' AND `cancel` = "0" ORDER BY `id` DESC LIMIT 1')); $mft = $mft['balance']; - ?> - -
    -
    Дата: , Операций за этот день: , средств в начале дня: RUB, средств в конце дня: RUB
    - - = '.$dt.''.$noobs.' AND `time` < '.($dt+86400).' ORDER BY `time` ASC LIMIT '.$lim); - while($pl = mysql_fetch_array($sp)) - { - if($pl['money']>0 && $pl['cancel']==0) - { - ?> - - - - - -
    - - - - - - - -
    RUBОстаток: RUBОткрепить'; }else{ echo 'Прикрепить'; } ?>
    -
    - - - - - -
     
    -
    - - - - - - -
    - - - - - -
     
    -
    - - - - - - - -
    RUBОстаток: RUBОткрепить'; }else{ echo 'Прикрепить'; } ?>
    -
    - - -
    - - -


    -
    -
    - - - - - - - - - - -
    Сумма: - RUB

    Комментарий (500 символов максимум):

    -

    - -

    -
    -
    - - -


    time :: -
    +
    + Период отчетности: + + , + года. + Доступные средства: + RUB | Прибыль за + этот месяц: RUB | Дата + генерации отчета: + +
    +
    + = ' . $dt . '' . $noobs . ' AND `time` < ' . ($dt + 86400) . '' + ) + ); + $lim = $lim[0]; + $mst = mysql_fetch_array( + mysql_query( + 'SELECT `money`,`balance` FROM `balance_money` WHERE `time` < ' . $dt . '' . $noobs . ' AND `cancel` = "0" ORDER BY `id` DESC LIMIT 1' + ) + ); + $mst = $mst['balance']; + $mft = mysql_fetch_array( + mysql_query( + 'SELECT `money`,`balance` FROM `balance_money` WHERE `time` >= ' . $dt . '' . $noobs . ' AND `time` < ' . ($dt + 86400) . ' AND `cancel` = "0" ORDER BY `id` DESC LIMIT 1' + ) + ); + $mft = $mft['balance']; + ?> + +
    +
    Дата: , Операций за этот + день: , средств в начале дня: + RUB, средств в конце дня: RUB +
    + + = ' . $dt . '' . $noobs . ' AND `time` < ' . ($dt + 86400) . ' ORDER BY `time` ASC LIMIT ' . $lim + ); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['money'] > 0 && $pl['cancel'] == 0) { + ?> + + + + + +
    + + + + + + + +
    RUB + Остаток: RUB + Открепить'; + } else { + echo 'Прикрепить'; + } ?>
    +
    + + + + + +
     
    +
    + + + + + + +
    + + + + + +
    +  
    +
    + + + + + + + +
    RUB + Остаток: RUB + Открепить'; + } else { + echo 'Прикрепить'; + } ?>
    +
    + + +
    + + +


    +
    +
    + + + + + + + + + + +
    Сумма: + RUB +

    Комментарий (500 символов максимум):

    +

    + +

    +
    +
    + + +


    time :: +
    diff --git a/bandit.php b/bandit.php index 785c15a1..858ce200 100644 --- a/bandit.php +++ b/bandit.php @@ -1,150 +1,159 @@ room['name']!='Однорукий бандит') -{ - die(); -}else{ - - //Раздаем выйгрыши - - - function get2str($key='', $val='') { - $get = $_GET; - if ( is_array($key) ) { - if ( count($key)>0 ) foreach ( $key as $k=>$v ) $get[$k] = $v; - } else $get[$key] = $val; - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) if ( empty($v) ) unset($get[$k]); - } - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) $get[$k] = $k.'='.urlencode($v); - return '?'.implode('&', $get); - } - } - - $r = ''; - - if( isset($_GET['bet']) ) { - $s = 1; - if( $_GET['bet'] == 2 ) { - $s = 2; - }elseif( $_GET['bet'] == 3 ) { - $s = 3; - } - if( $u->bank['money2'] < $s ) { - //Недостаточно денег! - }else{ - //Играем! - $w1 = rand(0,4); - $w2 = rand(0,4); - $w3 = rand(0,4); - // - $win = 0; - $n = 99; - - if( $w1 == 0 && $w2 == 0 && $w3 == 0 ) { - // 50 100 150 - $win = 50; - $n = 0; - }elseif( $w1 == 1 && $w2 == 1 && $w3 == 1 ) { - // 20 40 60 - $win = 20; - $n = 1; - }elseif( $w1 == 2 && $w2 == 2 && $w3 == 2 ) { - // 10 20 30 - $win = 10; - $n = 2; - }elseif( $w1 == 3 && $w2 == 3 && $w3 == 3 ) { - // 4 8 12 - $win = 4; - $n = 3; - }elseif( $w1 == 4 && $w2 == 4 && $w3 == 4 ) { - // 2 4 6 - $win = 2; - $n = 4; - }elseif( $w1 == 4 && $w2 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - }elseif( $w1 == 4 && $w3 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - }elseif( $w2 == 4 && $w3 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - } - - if( ( $n == 5 || $n == 4 || $n == 3 ) && rand(0,100) >= 50 ) { - //Играем! - $w1 = rand(0,2); - $w2 = rand(0,3); - $w3 = rand(0,3); - // - $win = 0; - $n = 99; - - if( $w1 == 0 && $w2 == 0 && $w3 == 0 ) { - // 50 100 150 - $win = 50; - $n = 0; - }elseif( $w1 == 1 && $w2 == 1 && $w3 == 1 ) { - // 20 40 60 - $win = 20; - $n = 1; - }elseif( $w1 == 2 && $w2 == 2 && $w3 == 2 ) { - // 10 20 30 - $win = 10; - $n = 2; - }elseif( $w1 == 3 && $w2 == 3 && $w3 == 3 ) { - // 4 8 12 - $win = 4; - $n = 3; - }elseif( $w1 == 4 && $w2 == 4 && $w3 == 4 ) { - // 2 4 6 - $win = 2; - $n = 4; - }elseif( $w1 == 4 && $w2 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - }elseif( $w1 == 4 && $w3 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - }elseif( $w2 == 4 && $w3 == 4 ) { - // 1 2 3 - $win = 1; - $n = 5; - } - } - // - $u->bank['money2'] -= $s; - $u->bank['money2'] += $s*$win; - mysql_query('UPDATE `bank` SET `money2` = "'.$u->bank['money2'].'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); - // - mysql_query('INSERT INTO `bandit` (`uid`,`time`,`room`,`s`,`wm`,`w`) VALUES ( - "'.$u->info['id'].'","'.time().'","'.$u->info['room'].'","'.$s.'","'.($s*$win).'","'.$w1.$w2.$w3.'" - ) '); - $gid = mysql_insert_id(); - // - if( $win > 0 ) { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','390','','','[Крупье] Игрок ".mysql_real_escape_string($u->info['login'])." выиграл ".($s*$win).".00 екр., ставка: ".$s.".00 екр., игра №".$gid."','".time()."','6','0')"); - } - // - $r .= 'cash='.floor($u->bank['money2']).''; - $r .= '&w1='.$w1.'&w2='.$w2.'&w3='.$w3.'&n='.$n.'&win='.($s*$win).''; - } - }else{ - $r .= 'cash='.floor($u->bank['money2']).''; - } - - echo $r; +if ($u->room['name'] != 'Однорукий бандит') { + die(); } -?> \ No newline at end of file + +//Раздаем выйгрыши + + +function get2str($key = '', $val = '') +{ + $get = $_GET; + if (is_array($key)) { + if (count($key) > 0) { + foreach ($key as $k => $v) { + $get[$k] = $v; + } + } + } else { + $get[$key] = $val; + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + if (empty($v)) { + unset($get[$k]); + } + } + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + $get[$k] = $k . '=' . urlencode($v); + } + return '?' . implode('&', $get); + } +} + +$r = ''; + +if (isset($_GET['bet'])) { + $s = 1; + if ($_GET['bet'] == 2) { + $s = 2; + } elseif ($_GET['bet'] == 3) { + $s = 3; + } + if ($u->bank['money2'] >= $s) { + //Играем! + $w1 = rand(0, 4); + $w2 = rand(0, 4); + $w3 = rand(0, 4); + // + $win = 0; + $n = 99; + + if ($w1 == 0 && $w2 == 0 && $w3 == 0) { + // 50 100 150 + $win = 50; + $n = 0; + } elseif ($w1 == 1 && $w2 == 1 && $w3 == 1) { + // 20 40 60 + $win = 20; + $n = 1; + } elseif ($w1 == 2 && $w2 == 2 && $w3 == 2) { + // 10 20 30 + $win = 10; + $n = 2; + } elseif ($w1 == 3 && $w2 == 3 && $w3 == 3) { + // 4 8 12 + $win = 4; + $n = 3; + } elseif ($w1 == 4 && $w2 == 4 && $w3 == 4) { + // 2 4 6 + $win = 2; + $n = 4; + } elseif ($w1 == 4 && $w2 == 4) { + // 1 2 3 + $win = 1; + $n = 5; + } elseif ($w1 == 4 && $w3 == 4 || $w2 == 4 && $w3 == 4) { + // 1 2 3 + $win = 1; + $n = 5; + } + + if (($n == 5 || $n == 4 || $n == 3) && rand(0, 100) >= 50) { + //Играем! + $w1 = rand(0, 2); + $w2 = rand(0, 3); + $w3 = rand(0, 3); + // + $win = 0; + $n = 99; + + if ($w1 == 0 && $w2 == 0 && $w3 == 0) { + // 50 100 150 + $win = 50; + $n = 0; + } elseif ($w1 == 1 && $w2 == 1 && $w3 == 1) { + // 20 40 60 + $win = 20; + $n = 1; + } elseif ($w1 == 2 && $w2 == 2 && $w3 == 2) { + // 10 20 30 + $win = 10; + $n = 2; + } elseif ($w1 == 3 && $w2 == 3 && $w3 == 3) { + // 4 8 12 + $win = 4; + $n = 3; + } elseif ($w1 == 4 && $w2 == 4 && $w3 == 4) { + // 2 4 6 + $win = 2; + $n = 4; + } elseif ($w1 == 4 && $w2 == 4) { + // 1 2 3 + $win = 1; + $n = 5; + } elseif ($w1 == 4 && $w3 == 4 || $w2 == 4 && $w3 == 4) { + // 1 2 3 + $win = 1; + $n = 5; + } + } + // + $u->bank['money2'] -= $s; + $u->bank['money2'] += $s * $win; + mysql_query( + 'UPDATE `bank` SET `money2` = "' . $u->bank['money2'] . '" WHERE `id` = "' . $u->bank['id'] . '" LIMIT 1' + ); + // + mysql_query( + 'INSERT INTO `bandit` (`uid`,`time`,`room`,`s`,`wm`,`w`) VALUES ( + "' . $u->info['id'] . '","' . time( + ) . '","' . $u->info['room'] . '","' . $s . '","' . ($s * $win) . '","' . $w1 . $w2 . $w3 . '" + ) ' + ); + $gid = mysql_insert_id(); + // + if ($win > 0) { + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','390','','','[Крупье] Игрок " . mysql_real_escape_string( + $u->info['login'] + ) . " выиграл " . ($s * $win) . ".00 екр., ставка: " . $s . ".00 екр., игра №" . $gid . "','" . time( + ) . "','6','0')" + ); + } + // + $r .= 'cash=' . floor($u->bank['money2']); + $r .= '&w1=' . $w1 . '&w2=' . $w2 . '&w3=' . $w3 . '&n=' . $n . '&win=' . ($s * $win); + } +} else { + $r .= 'cash=' . floor($u->bank['money2']); +} +echo $r; diff --git a/bonuss.php b/bonuss.php index dba4b2fa..f25ab081 100644 --- a/bonuss.php +++ b/bonuss.php @@ -1,46 +1,46 @@ -"; - } +const GAME = true; +require_once('_incl_data/__config.php'); +require_once('_incl_data/class/__db_connect.php'); +$u = User::start(); +$d = new Dungeon; +$d->start(); + +if ($_POST['code'] == $_SESSION['code'] && $_POST['code'] != '') { + echo ""; +} ?> - - - + + +
    - +
    - -
    - + +
    +
    \ No newline at end of file diff --git a/breakchaos.php b/breakchaos.php index a913c7c3..446d5eeb 100644 --- a/breakchaos.php +++ b/breakchaos.php @@ -1,158 +1,133 @@ - -1 -SeDuCeR [12] -243 -47748 -»» - -*/ +$u = User::start(); $r1 = ''; $r2 = ''; $lvl = 8; $lvl_name = 'Любители'; -if( $_GET['level'] == 9 ) { - $lvl = 9; - $lvl_name = 'Бывалые'; -}elseif( $_GET['level'] == 10 ) { - $lvl = 10; - $lvl_name = 'Профессионалы'; -}elseif( $_GET['level'] == 11 ) { - $lvl = 11; - $lvl_name = 'Жители'; +if ($_GET['level'] == 9) { + $lvl = 9; + $lvl_name = 'Бывалые'; +} elseif ($_GET['level'] == 10) { + $lvl = 10; + $lvl_name = 'Профессионалы'; +} elseif ($_GET['level'] == 11) { + $lvl = 11; + $lvl_name = 'Жители'; } $i = 1; $j = 1; -$sp = mysql_query('SELECT `id`,`uid`,`level`,`time` FROM `izlom_rating` WHERE `level` = "' . $lvl . '" GROUP BY `uid` ORDER BY SUM(`obr`) DESC'); -while( $pl = mysql_fetch_array($sp) ) { - // - $ret = mysql_fetch_array(mysql_query('SELECT SUM(`obr`) FROM `izlom_rating` WHERE `uid` = "'.$pl['uid'].'" AND `level` = "'.$pl['level'].'" LIMIT 1')); - $ret = round($ret[0]*(154.97)); - // - $pl2 = mysql_fetch_array(mysql_query('SELECT * FROM `izlom_rating` WHERE `uid` = "'.$pl['uid'].'" AND `level` = "'.$pl['level'].'" ORDER BY `time` DESC LIMIT 1')); - // - $r1 .= ' +$sp = mysql_query( + 'SELECT `id`,`uid`,`level`,`time` FROM `izlom_rating` WHERE `level` = "' . $lvl . '" GROUP BY `uid` ORDER BY SUM(`obr`) DESC' +); +while ($pl = mysql_fetch_array($sp)) { + // + $ret = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`obr`) FROM `izlom_rating` WHERE `uid` = "' . $pl['uid'] . '" AND `level` = "' . $pl['level'] . '" LIMIT 1' + ) + ); + $ret = round($ret[0] * (154.97)); + // + $pl2 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `izlom_rating` WHERE `uid` = "' . $pl['uid'] . '" AND `level` = "' . $pl['level'] . '" ORDER BY `time` DESC LIMIT 1' + ) + ); + // + $r1 .= ' ' . $i . ' -' . $u->microLogin($pl['uid'],1) . ' +' . $u->microLogin($pl['uid'], 1) . ' ' . $pl2['voln'] . ' -'.$ret.' -»» -'; - // - if( date('d.m.Y') == date('d.m.Y',$pl2['time']) ) { - $r2 .= ' -' . $j . ' -' . $u->microLogin($pl['uid'],1) . ' -' . $pl2['voln'] . ' -'.$ret.' -»» -'; - $j++; - } - $i++; -} - -/*$sp = mysql_query('SELECT * FROM `izlom_rating` WHERE `level` = "' . $lvl . '" GROUP BY `uid` ORDER BY MAX(`time`) DESC'); -while( $pl = mysql_fetch_array($sp) ) { - // - $ret = mysql_fetch_array(mysql_query('SELECT SUM(`obr`) FROM `izlom_rating` WHERE `uid` = "'.$pl['uid'].'" AND `level` = "'.$pl['level'].'" LIMIT 1')); - $ret = round($ret[0]*(154.97)); - // - $r1 .= ' -' . $i . ' -' . $u->microLogin($pl['uid'],1) . ' -' . $pl['voln'] . ' -'.$ret.' -»» -'; - -if( $pl['uid'] == 1000000 ) { - echo date('d.m.Y',$pl['time']).'
    '; -} - if( date('d.m.Y') == date('d.m.Y',$pl['time']) ) { - $r2 .= ' -' . $j . ' -' . $u->microLogin($pl['uid'],1) . ' -' . $pl['voln'] . ' ' . $ret . ' »» '; - $j++; - } - $i++; -}*/ + // + if (date('d.m.Y') == date('d.m.Y', $pl2['time'])) { + $r2 .= ' +' . $j . ' +' . $u->microLogin($pl['uid'], 1) . ' +' . $pl2['voln'] . ' +' . $ret . ' +»» +'; + $j++; + } + $i++; +} + ?> - -Архив: Поединки - + + Архив: Поединки +

    -
    - Излом Хаоса - - - - - - - -
    - -
    - лучшие за месяц
    -
    - - - - - - - - - - - - -
    Место
    Боец
    Последняя волна
    Рейтинг
    Лог боя
    - -
    - -
    Бывалые - лучшие за день
    -
    - - - - - - - - - - - - -
    Место
    Боец
    Последняя волна
    Рейтинг
    Лог боя
    - -
    -
    +
    + Излом Хаоса + + + + + + + +
    +
    + +
    - лучшие за месяц
    +
    + + + + + + + + + + + + +
    Место
    Боец
    Последняя волна
    Рейтинг
    Лог боя
    + +
    +
    +
    + +
    Бывалые - лучшие за день
    +
    + + + + + + + + + + + + +
    Место
    Боец
    Последняя волна
    Рейтинг
    Лог боя
    + +
    +
    +

    \ No newline at end of file diff --git a/buttons.php b/buttons.php index 5d6a6084..9ae547cb 100644 --- a/buttons.php +++ b/buttons.php @@ -1,9 +1,9 @@ Произошла ошибка

    Произошла ошибка:

    ' . $e . '

    Назад


    (c) ' . $c[1] . '

    '); + exit('Произошла ошибка

    Произошла ошибка:

    ' . $e . '

    Назад


    (c) ' . $c[1] . '

    '); } function GetRealIp() @@ -22,9 +22,9 @@ define('IP', GetRealIp()); include_once('_incl_data/__config.php'); include_once('_incl_data/class/__db_connect.php'); -include_once('_incl_data/class/__user.php'); -include_once('_incl_data/class/__filter_class.php'); -include_once('_incl_data/class/__chat_class.php'); +$u = User::start(); +$filter = new Filter(); +$chat = new Chat(); ini_set('max_execution_time', '120'); @@ -47,8 +47,11 @@ if ($u->info['joinIP'] == 1 && $u->info['ip'] != IP) { } if ($u->info['online'] < time() - 60) { - $filter->setOnline($u->info['online'], $u->info['id'], 0); - mysql_query("UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"); + $filter->setOnline($u->info['online'], $u->info['id']); + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); } $u->stats = $u->getStats($u->info['id'], 0); @@ -59,743 +62,750 @@ if ($u->info['activ'] > 0) { } ?> - - - - - Бойцовский Клуб Acombats - - - - - - - - - - - + + + + + + + + + + + + + + + + + isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); + $_COOKIE['d1c'] = $deviceType; + setcookie('d1c', $deviceType, (time() + 86400)); + } else { + $deviceType = $_COOKIE['d1c']; } - - - - - - - - + if ($deviceType == 'tablet' || $deviceType == 'phone') { + echo ''; + ?> + - - - - isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); - $_COOKIE['d1c'] = $deviceType; - setcookie('d1c', $deviceType, (time() + 86400)); - } else { - $deviceType = $_COOKIE['d1c']; - } - - if ($deviceType == 'tablet' || $deviceType == 'phone') { - echo ''; + + + + + - - - - - - - - - - - - -info['bithday'] == '01.01.1800') { - ?> - + + + + info['active'] != '' && $u->info['mail'] == 'No E-mail') { - if ($error != '') { - echo ''; + if ($u->info['bithday'] == '01.01.1800') { + ?> + + + + info['active'] != '' && $u->info['mail'] == 'No E-mail') { + if ($error != '') { + echo ''; + } + ?> + + - - - + -
    - - - -
    -
    -
    -
    Настройки чата
    -
    - Скорость обновления:
    -
    Сортировка списка онлайн: - По убыванию
    -
    Экономия трафика
    -
    Сообщения с молчанкой + #mini_qsst { + position: absolute; + z-index: 100; + cursor: default; + display: none; + bottom: 10px; + right: 18px; + } + +
    + - - - -
    + +
    +
    +
    +
    Настройки чата
    +
    + Скорость обновления:
    +
    Сортировка списка онлайн: + По убыванию
    +
    Экономия трафика
    +
    Сообщения с молчанкой +
    + + +
    + +
    -
    +
    - - -
    -
    - -
    -
    - -
    - - - - - - - - + + + + + + + +
    - - - - - - -
    - - - - - - - - -
    Знания - Персонаж - Выход -
    -
    -
    - - - - - - - - +
    - - - - - - - - - info['level'] > 9) { ?> + +
    - info['admin'] > 0) { ?> onclick="top.frames['main'].location.href='map.php';" - class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30" - title="Чат"> -   - - - - - - - - -
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + - - - - - - - -
     
    +
    + +
    +
    + + + + + +
    + +
    +
    +
    + + + + + + +
    +
    +
    +
    + +
    + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + - - - - - - - - - - - - info['level'] > 7) { ?> - + + + + + + + + - + info['level'] > 7) { ?> + + - info['align'] == 50 || $u->info['align2'] == 50 || $u->info['admin'] == 1) { ?> - - info['align'] >= 1.1 && $u->info['align'] < 2) { ?> - - info['align'] >= 3.01 && $u->info['align'] < 4) { ?> - - info['vip'] > time() || $u->stats['silvers'] > 0 || $u->stats['bronze'] > 0 || $u->stats['gold'] > 0) { ?> - - + info['align'] == 50 || $u->info['align2'] == 50 || $u->info['admin'] == 1) { ?> + + info['align'] >= 1.1 && $u->info['align'] < 2) { ?> + + info['align'] >= 3.01 && $u->info['align'] < 4) { ?> + + info['vip'] > time( + ) || $u->stats['silvers'] > 0 || $u->stats['bronze'] > 0 || $u->stats['gold'] > 0) { ?> + + - + - info['align'] >= 1 && $u->info['align'] < 2) { ?> - - info['align'] >= 3 && $u->info['align'] < 4) { ?> - - info['align'] == 7) { ?> - - info['bukmeker'] == 1 || $u->info['admin'] == 1) { ?> - - info['align'] >= 1 && $u->info['align'] < 2) { ?> + + info['align'] >= 3 && $u->info['align'] < 4) { ?> + + info['align'] == 7) { ?> + + info['bukmeker'] == 1 || $u->info['admin'] == 1) { ?> + + info['clan'] > 0) { ?> - - info['admin'] > 0) { ?> - - - + if ($u->info['clan'] > 0) { ?> + + info['admin'] > 0) { ?> + + + - - - + + + - -
    + info['admin'] > 0) { ?> onclick="top.frames['main'].location.href='map.php';" + class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30" + title="Чат"> +   + + + + + + + + +   - +   + + - - + +
    -
    -
    - +
    +
    +
    + - - + + info['active'] != '' && $u->info['mail'] != 'No E-mail') { + $yes = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "user_active_good" LIMIT 1', 1); + $yes2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "user_active_send" LIMIT 1', 1); + if ($u->info['login'] != '-LEL-') { + mysql_query('UPDATE `stats` SET `active` = \'\' WHERE `id` = ' . $u->info['id'] . ' LIMIT 1'); + } } + ?> + - $button.addEventListener("mouseover", function (event) { - - timeoutClear = setTimeout(() => { - - $div.hidden = false - var $trTop = $button.parentElement.getBoundingClientRect().top - var $tdLeft = document.getElementById("tdDate").offsetLeft - - $div.style.top = `${$trTop - ($button.offsetHeight * 2.1)}px` - $div.style.left = `${($tdLeft - ($div.offsetWidth - $button.offsetWidth)) + 10}px` - - everySecondsUpdate() - - intervalClear = setInterval(() => everySecondsUpdate(), 1000) - }, 550) - }) - - $button.addEventListener("mouseout", function (event) { - $div.hidden = true - clearInterval(intervalClear) - clearTimeout(timeoutClear) - }) - + + + info['active'] != '' && $u->info['mail'] != 'No E-mail') { - $yes = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "user_active_good" LIMIT 1', 1); - $yes2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "user_active_send" LIMIT 1', 1); - if ($u->info['login'] != '-LEL-') { - mysql_query('UPDATE `stats` SET `active` = \'\' WHERE `id` = ' . $u->info['id'] . ' LIMIT 1'); - } -} -?> - - - - - - - +unset($db); \ No newline at end of file diff --git a/cgi-bin/buttons.php b/cgi-bin/buttons.php deleted file mode 100644 index a24d3d9e..00000000 --- a/cgi-bin/buttons.php +++ /dev/null @@ -1,986 +0,0 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - -function GetRealIp() -{ - if (!empty($_SERVER['HTTP_CLIENT_IP'])) - { - $ip=$_SERVER['HTTP_CLIENT_IP']; - } - elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - { - $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; - } - else - { - $ip=$_SERVER['REMOTE_ADDR']; - } - return $ip; -} -define('IP',GetRealIp()); - -include_once('_incl_data/__config.php'); -include_once('_incl_data/class/__db_connect.php'); -include_once('_incl_data/class/__user.php'); -include_once('_incl_data/class/__filter_class.php'); -include_once('_incl_data/class/__chat_class.php'); - -ini_set( 'max_execution_time', '120' ); - -if(isset($_GET['showcode'])) -{ - include('show_reg_img/security.php'); - die(); -} - -if($u->info['joinIP']==1 && $u->info['ip']!=IP) -{ - er('#Пожалуйста авторизируйтесь с главной страницы'); -}elseif(isset($_GET['exit'])) -{ - setcookie('login','',time()-60*60*24*30,'',$c['host']); - setcookie('pass','',time()-60*60*24*30,'',$c['host']); - setcookie('login','',time()-60*60*24*30); - setcookie('pass','',time()-60*60*24*30); - mysql_query('UPDATE `users` SET `online` = "'.(time()-420).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); //520 - die(''); -}elseif(!isset($u->info['id'])) -{ - - /*setcookie('login','',time()-60*60*24*30,'',$c['host']); - setcookie('pass','',time()-60*60*24*30,'',$c['host']); - setcookie('login','',time()-60*60*24*30); - setcookie('pass','',time()-60*60*24*30);*/ - - er('Возникла проблема с определением id персонажа
    Авторизируйтесь с главной страницы.'); -} - -if($u->info['online'] < time()-60) -{ - $filter->setOnline($u->info['online'],$u->info['id'],0); - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); -} - -$u->stats = $u->getStats($u->info['id'],0); - -if($u->info['activ']>0) { - include('activnew.php'); - die(); -} - -?> - - - - -Новый Бойцовский Клуб - - - - - - - - - - - - - - - - - - - - - - - - -info['id'].'" LIMIT 1')); -if(isset($fpi['id'])) { - $i = 0; - $fpv = explode('|',$fpi['data']); - $fph = ''; - while( $i <= 10 ) { - $id = $fpv[$i]; - $id = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "'.mysql_real_escape_string($id).'" AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($id['id'])) { - //есть итем - $idm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($id['item_id']).'" LIMIT 1')); - $idd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($idm['id']).'" LIMIT 1')); - //$po = ; - $fph .= 'top.addfastpanel(\''.$idm['id'].'\',\''.$idm['name'].'\',\''.$idm['type'].'\',\''.$id['1price'].'\',\''.$id['2price'].'\',\''.$u->city_name[$id['maidin']].'\',\''.$idm['img'].'\',\''.$id['item_id'].'\',\''.$idm['iznosNOW'].'\',\''.$idm['iznosMAX'].'\',\'1\',\'1\',\'1\',\'1\');'; - }else{ - //пусто - } - $i++; - } - echo ''; -}*/ -// -if( !isset($_COOKIE['d1c']) ) { - include('_incl_data/class/mobile.php'); - $detect = new Mobile_Detect; - $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); - $_COOKIE['d1c'] = $deviceType; - setcookie('d1c',$deviceType,(time()+86400)); -}else{ - $deviceType = $_COOKIE['d1c']; -} - -if( $deviceType == 'tablet' || $deviceType == 'phone' ) { - echo ''; -?> - - - - - - - - - - - - -testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_yes" LIMIT 1',1); -if(!isset($yes['id'])) -{ - //Пользовательское соглашение - if(isset($_GET['yes'])) - { - //согласен - $u->addAction(time(),'user_yes',''); - header('location: https://'.$c[$u->info['city']].'/bk'); - die(); - } - /*echo '
    -
    -Наверное Вы удивлены что это за текст?
    Пожалуйста уделите одну минуту Вашего драгоценного времени и прочитайте его:


    -  Добрый день, вечер или даже ночь! Вы наверное играли в Бойцовский Клуб? Да, точно играли, по крайней мере в проекты которые -себя называют "Лучший Клон БК" и т.д., а по факту, простите, это хуйня из под коня. Сейчас много проектов -которые создаются любителями, которые пользуются готовыми движками. Скачать и установить такой сайт -может любой школьник, даже безграмотный! Наш проект не такой! Постоянное развитие, улучшение, экшен, -да и к тому-же уникальность нашего движка не сможет оспорить ни один человек. Надеемся что Вам понравится -наш проект и Вы будете играть здесь до последнего дня проекта!
    -  Соглашаясь с этим текстом Вы отказывается от всего этого дерьма в интернете и вступаете в круг людей которые -за качество и отсутствие однообразия! Вас ждет множество удивительных вещей, в то время как другие потакают некачественному продукту. -

    Я полностью согласен с написанным выше текстом


    Если по каким-либо причинам Вы не согласны, то пожалуйста закройте наш сайт и более не открывайте! Спасибо! ;-) -
    ';*/ -//} -?> - -info['bithday'] == '01.01.1800') { -?> - - - -info['active']!='' && $u->info['mail']=='No E-mail') { - if($error!='') { - echo ''; - } -?> - - - - -
    - - - -
    -
    -
    -
    Настройки чата
    -
    -Скорость обновления:
    -
    Сортировка списка онлайн: -По убыванию
    -
    Экономия трафика
    -
    Сообщения с молчанкой
    - - -
    - - -
    - -
    - - - -
    -
    - -
    -
    - -
    - - - - - - - - - -
    - - - - - -
    - - - - - - - -
    ЗнанияПерсонажВыход
    -
    - - - - -
    -
    - - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    -
    - -
    -
    - - - - - -
    -
    -
    -
    - - - - - - -
    -
    -
    */ ?> - -
    - -
    - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - -
    - -
    -
    - -
    - info['admin'] > 0 ) { ?> - -
    - -
    -
    -
    -
    - - - - - - - - - info['level']>9){ ?> - - - - - - - - - - - - - info['level']>7){ ?> - - info['level']>=0){ ?> - - - info['align']==50 || $u->info['align2']==50 || $u->info['admin'] == 1) {?> - - info['align']>=1.1 && $u->info['align']<2 ){ ?> - - info['align']>=3.01 && $u->info['align']<4){ ?> - - info['vip']>time() || $u->stats['silvers']>0 || $u->stats['bronze']>0 || $u->stats['gold']>0 ){ ?> - - - - info['level']>= 0){ ?> - - info['align']>=1 && $u->info['align']<2){ ?> - - info['align']>=3 && $u->info['align']<4){ ?> - - info['align']==7) { ?> - - info['bukmeker']==1 || $u->info['admin']==1){ ?> - - info['admin'] > 0 || $u->info['align'] == 50){ ?> - - info['level']>-1){ ?> - - info['clan']>0){ ?> - - info['admin']>0){ ?> - - - - - - - -
    info['admin'] > 0 ) { ?> onclick="top.frames['main'].location.href='map.php';" class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30" title="Чат">  - - - - - - - - -  
    -
    -info['active']!='' && $u->info['mail']!='No E-mail') -{ - $yes = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_active_good" LIMIT 1',1); - $yes2 = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_active_send" LIMIT 1',1); - if($u->info['login'] != '-LEL-') - { - mysql_query('UPDATE `stats` SET `active` = "" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - /* - function send_mime_mail($name_from, // имя отправителя - $email_from, // email отправителя - $name_to, // имя получателя - $email_to, // email получателя - $data_charset, // кодировка переданных данных - $send_charset, // кодировка письма - $subject, // тема письма - $body // текст письма - ) - { - $to = mime_header_encode($name_to, $data_charset, $send_charset) - . ' <' . $email_to . '>'; - $subject = mime_header_encode($subject, $data_charset, $send_charset); - $from = mime_header_encode($name_from, $data_charset, $send_charset) - .' <' . $email_from . '>'; - if($data_charset != $send_charset) { - $body = iconv($data_charset, $send_charset, $body); - } - $headers = "From: $from\r\n"; - $headers .= "Content-type: text/plain; charset=$send_charset\r\n"; - - return mail($to, $subject, $body, $headers); - } - - function mime_header_encode($str, $data_charset, $send_charset) { - if($data_charset != $send_charset) { - $str = iconv($data_charset, $send_charset, $str); - } - return '=?' . $send_charset . '?B?' . base64_encode($str) . '?='; - } - - if(!isset($yes2['id'])) - { - //отправляем письмо - echo ''; - //$u->addAction(time(),'user_active_send',$u->info['mail']); - // получатели - send_mime_mail('www.new-combats.com', - 'support@new-combats.com', - ''.$u->info['login'].'', - $u->info['mail'], - 'CP1251', // кодировка, в которой находятся передаваемые строки - 'KOI8-R', // кодировка, в которой будет отправлено письмо - 'Активация персонажа '.$u->info['login'].'', - "Здравствуйте! Мы очень рады новому персонажу в нашем Мире! \r\n Ваш персонаж: ".$u->info['login']." [0] \r\n Ссылка для активации: https://capitalcity.new-combats.com/bk?active=".$u->info['active'].".\r\n\r\nС уважением, Администрация!"); - $u->addAction(time(),'user_active_send',$u->info['mail']); - - }elseif(!isset($yes['id'])) - { - //Пользовательское соглашение - if(isset($_GET['active']) && $u->info['active'] == $_GET['active']) - { - //согласен - $u->addAction(time(),'user_active_good',$u->info['mail']); - mysql_query('UPDATE `stats` SET `active` = "" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - die(''); - } - } - */ -} -?> - - - - \ No newline at end of file diff --git a/clans_inf.php b/clans_inf.php index 67c9a0de..fd86c157 100644 --- a/clans_inf.php +++ b/clans_inf.php @@ -1,29 +1,34 @@ - +$uplogin = explode('&', $_SERVER['QUERY_STRING']); +$uplogin = $uplogin[0]; +$uplogin = preg_replace('/%20/', " ", $uplogin); +if (!isset($_GET['id'])) { + $_GET['id'] = 0; +} +if (!isset($upLogin)) { + $upLogin = ''; +} +$utf8Login = ''; +$utf8Login2 = ''; +$utf8Login = iconv("utf-8", "windows-1251", $uplogin); +if ($uplogin != 'delete' && $utf8Login != 'delete' && $utf8Login2 != 'delete') { + $clan = mysql_fetch_array( + mysql_query( + 'SELECT `u`.* FROM `clan` AS `u` WHERE (`u`.`id`="' . mysql_real_escape_string( + $_GET['id'] + ) . '" OR `u`.`id`="' . mysql_real_escape_string( + $uplogin + ) . '" OR `u`.`name`="' . mysql_real_escape_string($uplogin) . '") LIMIT 1' + ) + ); +} +if (!isset($clan['id'])) { + die( + ' @@ -31,239 +36,323 @@ define('UPPERCASE',1); Произошла ошибка:
    Указанный клан не найден...

    Назад


    -

    (c) '.$c['title'].'

    - '.$c['counters'].' - '); - } - - $xu = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `real` = 1 AND `clan` = "'.$clan['id'].'" LIMIT 1')); - $xu = 0 + $xu[0]; - $r1 = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "'.$clan['id'].'" AND `date` = "'.date('dmY').'" LIMIT 1')); - $r2 = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "'.$clan['id'].'" AND `date` != "'.date('dmY').'" ORDER BY `id` DESC LIMIT 1')); - - $vid = ''; - if( isset($r2['pos']) ) { - if( $r2['pos'] < $r1['pos'] ) { - $vid = '-'.($r1['pos']-$r2['pos']).''; - }elseif( $r2['pos'] > $r1['pos'] ) { - $vid = '+'.($r2['pos']-$r1['pos']).''; - } - } - - $clan_info = mysql_fetch_array(mysql_query('SELECT * FROM `clan_info` WHERE `id` = "'.$clan['id'].'" LIMIT 1')); - if( $clan_info['info'] == '' ) { - $clan_info['info'] = 'Информация о клане отсутствует.'; - } - - $vid1 = ''; - if( isset($r2['pos']) ) { - if( round($r2['global']/(15678+$r2['level']),3) < round($r1['global']/(15678+$r1['level']),3) ) { - $vid1 = ' +'.(round($r1['global']/(15678+$r1['level']),3) - round($r2['global']/(15678+$r2['level']),3)).''; - }elseif( round($r2['global']/(15678+$r2['level']),3) > round($r1['global']/(15678+$r1['level']),3) ) { - $vid1 = ' -'.(round($r2['global']/(15678+$r2['level']),3) - round($r1['global']/(15678+$r1['level']),3)).''; - } - } - - $vid2 = ''; - if( isset($r2['pos']) ) { - if( $r2['exp_real'] < $r1['exp_real'] ) { - $vid2 = ' +'.($r1['exp_real']-$r2['exp_real']).''; - }elseif( $r2['exp_real'] > $r1['exp_real'] ) { - $vid2 = ' -'.($r2['exp_real']-$r1['exp_real']).''; - } - } - - $vid3 = ''; - if( isset($r2['pos']) ) { - if( $r2['win'] < $r1['win'] ) { - $vid3 = ' +'.($r1['win']-$r2['win']).''; - }elseif( $r2['win'] > $r1['win'] ) { - $vid3 = ' -'.($r2['win']-$r1['win']).''; - } - } - - $vid4 = ''; - if( isset($r2['pos']) ) { - if( $r2['lose'] < $r1['lose'] ) { - $vid4 = ' +'.($r1['lose']-$r2['lose']).''; - }elseif( $r2['lose'] > $r1['lose'] ) { - $vid4 = ' -'.($r2['lose']-$r1['lose']).''; - } - } - - $vid5 = ''; - if( isset($r2['pos']) ) { - if( $r2['nich'] < $r1['nich'] ) { - $vid5 = ' +'.($r1['nich']-$r2['nich']).''; - }elseif( $r2['nich'] > $r1['nich'] ) { - $vid5 = ' -'.($r2['nich']-$r1['nich']).''; - } - } +

    (c) ' . $c['title'] . '

    + ' . $c['counters'] . ' + ' + ); +} + +$xu = mysql_fetch_array( + mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `real` = 1 AND `clan` = "' . $clan['id'] . '" LIMIT 1') +); +$xu = 0 + $xu[0]; +$r1 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "' . $clan['id'] . '" AND `date` = "' . date( + 'dmY' + ) . '" LIMIT 1' + ) +); +$r2 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "' . $clan['id'] . '" AND `date` != "' . date( + 'dmY' + ) . '" ORDER BY `id` DESC LIMIT 1' + ) +); + +$vid = ''; +if (isset($r2['pos'])) { + if ($r2['pos'] < $r1['pos']) { + $vid = '-' . ($r1['pos'] - $r2['pos']) . ''; + } elseif ($r2['pos'] > $r1['pos']) { + $vid = '+' . ($r2['pos'] - $r1['pos']) . ''; + } +} + +$clan_info = mysql_fetch_array(mysql_query('SELECT * FROM `clan_info` WHERE `id` = "' . $clan['id'] . '" LIMIT 1')); +if ($clan_info['info'] == '') { + $clan_info['info'] = 'Информация о клане отсутствует.'; +} + +$vid1 = ''; +if (isset($r2['pos'])) { + if (round($r2['global'] / (15678 + $r2['level']), 3) < round($r1['global'] / (15678 + $r1['level']), 3)) { + $vid1 = ' +' . (round($r1['global'] / (15678 + $r1['level']), 3) - round( + $r2['global'] / (15678 + $r2['level']), 3 + )) . ''; + } elseif (round($r2['global'] / (15678 + $r2['level']), 3) > round($r1['global'] / (15678 + $r1['level']), 3)) { + $vid1 = ' -' . (round($r2['global'] / (15678 + $r2['level']), 3) - round( + $r1['global'] / (15678 + $r1['level']), 3 + )) . ''; + } +} + +$vid2 = ''; +if (isset($r2['pos'])) { + if ($r2['exp_real'] < $r1['exp_real']) { + $vid2 = ' +' . ($r1['exp_real'] - $r2['exp_real']) . ''; + } elseif ($r2['exp_real'] > $r1['exp_real']) { + $vid2 = ' -' . ($r2['exp_real'] - $r1['exp_real']) . ''; + } +} + +$vid3 = ''; +if (isset($r2['pos'])) { + if ($r2['win'] < $r1['win']) { + $vid3 = ' +' . ($r1['win'] - $r2['win']) . ''; + } elseif ($r2['win'] > $r1['win']) { + $vid3 = ' -' . ($r2['win'] - $r1['win']) . ''; + } +} + +$vid4 = ''; +if (isset($r2['pos'])) { + if ($r2['lose'] < $r1['lose']) { + $vid4 = ' +' . ($r1['lose'] - $r2['lose']) . ''; + } elseif ($r2['lose'] > $r1['lose']) { + $vid4 = ' -' . ($r2['lose'] - $r1['lose']) . ''; + } +} + +$vid5 = ''; +if (isset($r2['pos'])) { + if ($r2['nich'] < $r1['nich']) { + $vid5 = ' +' . ($r1['nich'] - $r2['nich']) . ''; + } elseif ($r2['nich'] > $r1['nich']) { + $vid5 = ' -' . ($r2['nich'] - $r1['nich']) . ''; + } +} + +$timday = strtotime('now 00:00:00'); +$clanw = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `battle` WHERE `type` = 250 AND `time_over` > "' . $timday . '" AND ((`team_win`=1 AND `clan1` = "' . $clan['id'] . '") OR (`team_win`=2 AND `clan2` = "' . $clan['id'] . '")) LIMIT 1' + ) +); +$clanw = $clanw[0]; + +$clanl = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `battle` WHERE `type` = 250 AND `time_over` > "' . $timday . '" AND ((`team_win`=2 AND `clan1` = "' . $clan['id'] . '") OR (`team_win`=1 AND `clan2` = "' . $clan['id'] . '")) LIMIT 1' + ) +); +$clanl = $clanl[0]; + +$clanwar = mysql_query( + 'SELECT * FROM `clan_wars` WHERE (`clan1`="' . $clan['id'] . '" OR `clan2`="' . $clan['id'] . '") AND `time_finish` > "' . time( + ) . '"' +); +$clwe = ""; +while ($clanwa = mysql_fetch_array($clanwar)) { + if ($clanwa['clan1'] == $clan['id']) { + $clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $clanwa['clan2'] . '" LIMIT 1')); + + $clwe .= '' . $clw['name'] . ' '; + } else { + $clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $clanwa['clan1'] . '" LIMIT 1')); + $clwe .= '' . $clw['name'] . ' '; + + } +} + - $timday=strtotime('now 00:00:00'); - $clanw = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle` WHERE `type` = 250 AND `time_over` > "'.$timday.'" AND ((`team_win`=1 AND `clan1` = "'.$clan['id'].'") OR (`team_win`=2 AND `clan2` = "'.$clan['id'].'")) LIMIT 1')); - $clanw = $clanw[0]; - - $clanl = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle` WHERE `type` = 250 AND `time_over` > "'.$timday.'" AND ((`team_win`=2 AND `clan1` = "'.$clan['id'].'") OR (`team_win`=1 AND `clan2` = "'.$clan['id'].'")) LIMIT 1')); - $clanl = $clanl[0]; - - $clanwar = mysql_query('SELECT * FROM `clan_wars` WHERE (`clan1`="'.$clan['id'].'" OR `clan2`="'.$clan['id'].'") AND `time_finish` > "'.time().'"'); - $clwe = ""; - while($clanwa = mysql_fetch_array($clanwar)) - { - if ($clanwa['clan1'] == $clan['id']) - { - $clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$clanwa['clan2'].'" LIMIT 1')); - - $clwe .= ''.$clw['name'].' '; - } - else - { - $clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$clanwa['clan1'].'" LIMIT 1')); - $clwe .= ''.$clw['name'].' '; - - } - } - - - - ?> - -Информация о клане <?=$clan['name']?> - - - - - - - - + + Информация о клане <?= $clan['name'] ?> + + + + + + + +
    - - -
    -

    -

    Позиция:

    -

    Рейтинг:

    -
    - - - - - -
    -
    -
    - Информация о Клане - -
    -
    - Клан сайт: - -
    - -
    - Статистика Клана - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    Рейтинг:
     
    Опыт:
    Позиция:
     
    Статистика персонажей:
    Побед:
    Поражений:
    Ничьих:
     
    Статистика войн:
    Текущие войны:
    Побед:
    Поражений:
     
    Ожидаемый рейтинг:
     
    Дата регистрации:
    + + + +
    +

    +

    Позиция: +

    +

    Рейтинг:

    +
    + + + + +
    +
    +
    + Информация о + Клане + +
    +
    + Клан сайт: + + +
    + +
    + Статистика Клана + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Рейтинг:
     
    Опыт:
    Позиция:
     
    Статистика персонажей:
    Побед:
    Поражений:
    Ничьих:
     
    Статистика войн:
    Текущие войны:
    Побед:
    Поражений:
     
    Ожидаемый рейтинг:
     
    Дата регистрации: +
    +
    +
    +
    +
    +
    + Состав + + '; + } else { + $html .= '
    '; + } + $html .= ' '; + if ($pl['align2'] > 0) { + $html .= ' '; + } + $html .= ' '; + $html .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; + $html .= ' '; + $html .= ' - Глава клана'; + if ($pl['online'] < time() - 520) { + $html .= '  не в игре
    '; + } else { + $html .= '
    '; + } + } + + $html .= '
    '; + + $sp = mysql_query( + 'SELECT * FROM `users` WHERE `clan` = "' . $clan['id'] . '" AND `clan_prava` != "glava" AND `online` > "' . (time( + ) - 520) . '" ORDER BY `login` ASC' + ); + while ($pl = mysql_fetch_array($sp)) { + $html .= '
    '; + $html .= ' '; + if ($pl['align2'] > 0) { + $html .= ' '; + } + $html .= ' '; + $html .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; + $html .= ' '; + $html .= ' - ' . $pl['mod_zvanie'] . ''; + $html .= '
    '; + } + $sp = mysql_query( + 'SELECT * FROM `users` WHERE `clan` = "' . $clan['id'] . '" AND `clan_prava` != "glava" AND `online` <= "' . (time( + ) - 520) . '" ORDER BY `login` ASC' + ); + while ($pl = mysql_fetch_array($sp)) { + $html .= '
    '; + $html .= ' '; + if ($pl['align2'] > 0) { + $html .= ' '; + } + $html .= ' '; + $html .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; + $html .= ' '; + $html .= ' - ' . $pl['mod_zvanie'] . ''; + $html .= '  не в игре
    '; + } + echo $html; + unset($html); + ?> + +
    Всего: + + +
    -
    -
    -
    -
    -
    - Состав - - '; - }else{ - $html .= '
    '; - } - $html .= ' '; - if( $pl['align2'] > 0 ) { - $html .= ' '; - } - $html .= ' '; - $html .= ''.$pl['login'].' ['.$pl['level'].']'; - $html .= ' '; - $html .= ' - Глава клана'; - if( $pl['online'] < time() - 520 ) { - $html .= '  не в игре
    '; - }else{ - $html .= '
    '; - } - } - - $html .= '
    '; - - $sp = mysql_query('SELECT * FROM `users` WHERE `clan` = "'.$clan['id'].'" AND `clan_prava` != "glava" AND `online` > "'.(time()-520).'" ORDER BY `login` ASC'); - while( $pl = mysql_fetch_array($sp) ) { - $html .= '
    '; - $html .= ' '; - if( $pl['align2'] > 0 ) { - $html .= ' '; - } - $html .= ' '; - $html .= ''.$pl['login'].' ['.$pl['level'].']'; - $html .= ' '; - $html .= ' - '.$pl['mod_zvanie'].''; - $html .= '
    '; - } - $sp = mysql_query('SELECT * FROM `users` WHERE `clan` = "'.$clan['id'].'" AND `clan_prava` != "glava" AND `online` <= "'.(time()-520).'" ORDER BY `login` ASC'); - while( $pl = mysql_fetch_array($sp) ) { - $html .= '
    '; - $html .= ' '; - if( $pl['align2'] > 0 ) { - $html .= ' '; - } - $html .= ' '; - $html .= ''.$pl['login'].' ['.$pl['level'].']'; - $html .= ' '; - $html .= ' - '.$pl['mod_zvanie'].''; - $html .= '  не в игре
    '; - } - echo $html; - unset($html); - ?> - -
    Всего: - - -
    diff --git a/core1/.htaccess b/core1/.htaccess deleted file mode 100644 index 858354ca..00000000 --- a/core1/.htaccess +++ /dev/null @@ -1,9 +0,0 @@ -Options -Indexes - -AddDefaultCharset Windows-1251 - -RewriteEngine On -RewriteBase / -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule . /core/index.php [L] \ No newline at end of file diff --git a/core1/app/.htaccess b/core1/app/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/app/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/app/core/.htaccess b/core1/app/core/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/app/core/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/app/core/chat.php b/core1/app/core/chat.php deleted file mode 100644 index e7b7ebf6..00000000 --- a/core1/app/core/chat.php +++ /dev/null @@ -1,30 +0,0 @@ - $uid - )); - $uid = $uid['login']; - } - \Core\Database::query( 'INSERT INTO `chat` (`to`,`time`,`type`,`text`,`color`,`typeTime`,`new`) VALUES ( - :to , :time , :type , :text , :color , :typeTime , :new - )', array( - 'to' => $uid, - 'time' => OK, - 'type' => 6, - 'text' => $text, - 'color' => 'Black', - 'typeTime' => 0, - 'new' => 1 - ) ); - } - -} - -?> \ No newline at end of file diff --git a/core1/app/core/database.php b/core1/app/core/database.php deleted file mode 100644 index 953eeb10..00000000 --- a/core1/app/core/database.php +++ /dev/null @@ -1,45 +0,0 @@ -exec('SET NAMES CP1251;'); - $connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - self::$connection = $connection; - } catch ( \PDOException $e ) { - new GeneralException($e->getMessage(), 10001); - } - } - } - - public static function query($q, $p = array(), $fetch_object = false, $fetch_all = false, $count = false) { - try { - if ( self::$connection == NULL ) { - throw new \PDOException('[Internal Error] Could not establish DB connection'); - } - $stmt = self::$connection->prepare($q); - if ( $count !== false ) { - $stmt->execute($p); - return $stmt->fetchColumn(); - } elseif ( $fetch_object !== false ) { - $stmt->execute($p); - return ($fetch_all !== false ? $stmt->fetchAll(\PDO::FETCH_ASSOC) : $stmt->fetch(\PDO::FETCH_ASSOC)); - } else { - return $stmt->execute($p); - } - } catch ( \PDOException $e ) { - new GeneralException($e->getMessage(), 10002); - } - } - - public static function lastID () { - return self::$connection->lastInsertId(); - } -} -?> \ No newline at end of file diff --git a/core1/app/core/generalexception.php b/core1/app/core/generalexception.php deleted file mode 100644 index bc3865e4..00000000 --- a/core1/app/core/generalexception.php +++ /dev/null @@ -1,24 +0,0 @@ -getFile() . "\n"; - $s .= 'In line: ' . $this->getLine() . "\n"; - $s .= 'Client IP: ' . $_SERVER['REMOTE_ADDR'] . "\n"; - $s .= 'GET Data: ' . serialize($_GET) . "\n"; - $s .= 'POST Data: ' . serialize($_POST) . "\n"; - $s .= 'Call Stack Trace: ' . "\n"; - foreach ( debug_backtrace() as $stack ) { - $s .= "\tFILE: '" . $stack['file'] . "', LINE: '" . $stack['line'] . "';\n"; - } - file_put_contents(PROJECT_PATH . DS . 'log/error.log', $s . "\n", FILE_APPEND); - } -} - -?> \ No newline at end of file diff --git a/core1/app/core/item.php b/core1/app/core/item.php deleted file mode 100644 index 9f5d263d..00000000 --- a/core1/app/core/item.php +++ /dev/null @@ -1,79 +0,0 @@ - $id - ) , true ); - return $itm; - } - - public static function getItemUser( $id ) { - //uiid - id предмета в items_users - $itm = \Core\Database::query( 'SELECT `a`.*,`b`.*,`a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `b`.`id` = `a`.`item_id` WHERE `a`.`id` = :item_id LIMIT 1' , array( - 'item_id' => $id - ) , true ); - return $itm; - } - - public static function infoItem( $itm ) { - //$po = self::lookStats( $itm['data'] ); - // - $r = array( - //items_main - $itm['id'], - $itm['name'], - $itm['img'], - $itm['2h'], - $itm['2too'], - $itm['iznosMAXi'], - $itm['price1'], //6 - $itm['price2'], - $itm['magic_chance'], - $itm['info'], - $itm['massa'], - $itm['geni'], - //items_users 12 - $itm['1price'], //12 - $itm['2price'], - $itm['use_text'], - $itm['iznosNOW'], - $itm['iznosMAX'], - $itm['gift'], - $itm['magic_inc'], - $itm['maidin'], - //data 20 - $itm['data'], - //group items_user - $itm['inGroup'], //21 - $itm['uiid'], - // - OK - - ); - return $r; - } - -} - -?> \ No newline at end of file diff --git a/core1/app/core/route.php b/core1/app/core/route.php deleted file mode 100644 index db21c474..00000000 --- a/core1/app/core/route.php +++ /dev/null @@ -1,62 +0,0 @@ - 'comission', - DP . '/auction' => 'auction', - DP . '/debuger' => 'debuger', - DP . '/admin' => 'admin' - ); - - $found_module = false; - - foreach ( $urls as $url => $handler ) { - if ( preg_match("#^" . $url . "/*$#", $uri) ) { - $class_name = "Logic\\$handler"; - if(class_exists($class_name)) { - $controller = new $class_name; - $controller->defaultAction(); - $found_module = true; - }else{ - self::ErrorClass404($class_name); - } - break; - } else { - continue; - } - } - - if ( !$found_module ) { - self::ErrorPage404(); - } - } - - public static function redirect($url) { - header('Location: ' . $url); - } - - public static function ErrorPage404() { - die('Страница не найдена'); - } - - public static function ErrorClass404($name) { - die('Расширение '. $name .' не найдено'); - } -} - -?> \ No newline at end of file diff --git a/core1/app/core/user.php b/core1/app/core/user.php deleted file mode 100644 index 9d1ccf3f..00000000 --- a/core1/app/core/user.php +++ /dev/null @@ -1,160 +0,0 @@ - 'Получаемый опыт (%)', 'align_bs' => 'Служитель закона', - 'nopryh' => 'Прямое поподание', 'puti'=>'Запрет перемещения','align'=>'Склонность','hpAll'=>'Уровень жизни (HP)','mpAll'=>'Уровень маны','enAll'=>'Уровень энергии','sex'=>'Пол','lvl'=>'Уровень','s1'=>'Сила','s2'=>'Ловкость','s3'=>'Интуиция','s4'=>'Выносливость','s5'=>'Интеллект','s6'=>'Мудрость','s7'=>'Духовность','s8'=>'Воля','s9'=>'Свобода духа','s10'=>'Божественность','s11'=>'Энергия','m1'=>'Мф. критического удара (%)','m2'=>'Мф. против критического удара (%)','m3'=>'Мф. мощности крит. удара (%)','m4'=>'Мф. увертывания (%)','m5'=>'Мф. против увертывания (%)','m6'=>'Мф. контрудара (%)','m7'=>'Мф. парирования (%)','m8'=>'Мф. блока щитом (%)','m9'=>'Мф. удара сквозь броню (%)','m14'=>'Мф. абс. критического удара (%)','m15'=>'Мф. абс. увертывания (%)','m16'=>'Мф. абс. парирования (%)','m17'=>'Мф. абс. контрудара (%)','m18'=>'Мф. абс. блока щитом (%)','m19'=>'Мф. абс. магический промах (%)','m20'=>'Мф. удача (%)','a1'=>'Мастерство владения ножами, кинжалами','a2'=>'Мастерство владения топорами, секирами','a3'=>'Мастерство владения дубинами, молотами','a4'=>'Мастерство владения мечами','a5'=>'Мастерство владения магическими посохами','a6'=>'Мастерство владения луками','a7'=>'Мастерство владения арбалетами','aall'=>'Мастерство владения оружием','mall'=>'Мастерство владения магией стихий','m2all'=>'Мастерство владения магией','mg1'=>'Мастерство владения магией огня','mg2'=>'Мастерство владения магией воздуха','mg3'=>'Мастерство владения магией воды','mg4'=>'Мастерство владения магией земли','mg5'=>'Мастерство владения магией Света','mg6'=>'Мастерство владения магией Тьмы','mg7'=>'Мастерство владения серой магией','tj'=>'Тяжелая броня','lh'=>'Легкая броня','minAtack'=>'Минимальный урон','maxAtack'=>'Максимальный урон','m10'=>'Мф. мощности урона','m11'=>'Мф. мощности магии стихий','m11a'=>'Мф. мощности магии','pa1'=>'Мф. мощности колющего урона','pa2'=>'Мф. мощности рубящего урона','pa3'=>'Мф. мощности дробящий урона','pa4'=>'Мф. мощности режущий урона','pm1'=>'Мф. мощности магии огня','pm2'=>'Мф. мощности магии воздуха','pm3'=>'Мф. мощности магии воды','pm4'=>'Мф. мощности магии земли','pm5'=>'Мф. мощности магии Света','pm6'=>'Мф. мощности магии Тьмы','pm7'=>'Мф. мощности серой магии','za'=>'Защита от урона','zm'=>'Защита от магии стихий','zma'=>'Защита от магии','za1'=>'Защита от колющего урона','za2'=>'Защита от рубящего урона','za3'=>'Защита от дробящего урона','za4'=>'Защита от режущего урона','zm1'=>'Защита от магии огня','zm2'=>'Защита от магии воздуха','zm3'=>'Защита от магии воды','zm4'=>'Защита от магии земли','zm5'=>'Защита от магии Света','zm6'=>'Защита от магии Тьмы','zm7'=>'Защита от серой магии','magic_cast'=>'Дополнительный каст за ход','pza'=>'Понижение защиты от урона','pzm'=>'Понижение защиты от магии','pza1'=>'Понижение защиты от колющего урона','min_heal_proc'=>'Эффект лечения (%)','notravma'=>'Защита от травм','yron_min'=>'Минимальный урон','yron_max'=>'Максимальный урон','zaproc'=>'Защита от урона (%)','zmproc'=>'Защита от магии стихий (%)','zm2proc'=>'Защита от магии Воздуха (%)','pza2'=>'Понижение защиты от рубящего урона','pza3'=>'Понижение защиты от дробящего урона','pza4'=>'Понижение защиты от режущего урона','pzm1'=>'Понижение защиты от магии огня','pzm2'=>'Понижение защиты от магии воздуха','pzm3'=>'Понижение защиты от магии воды','pzm4'=>'Понижение защиты от магии земли','pzm5'=>'Понижение защиты от магии Света','pzm6'=>'Понижение защиты от магии Тьмы','pzm7'=>'Понижение защиты от серой магии','speedhp'=>'Регенерация здоровья (%)','speedmp'=>'Регенерация маны (%)','tya1'=>'Колющие атаки','tya2'=>'Рубящие атаки','tya3'=>'Дробящие атаки','tya4'=>'Режущие атаки','tym1'=>'Огненные атаки','mg2static_points'=>'Уровень заряда (Воздух)','tym2'=>'Электрические атаки','tym3'=>'Ледяные атаки','tym4'=>'Земляные атаки','hpProc'=>'Уровень жизни (%)','mpProc'=>'Уровень маны (%)','tym5'=>'Атаки Света','tym6'=>'Атаки Тьмы','tym7'=>'Серые атаки','min_use_mp'=>'Уменьшает расход маны','pog'=>'Поглощение урона','pog2'=>'Поглощение урона','pog2p'=>'Процент поглощение урона','pog2mp'=>'Цена поглощение урона','maxves'=>'Увеличивает рюкзак','bonusexp'=>'Увеличивает получаемый опыт','speeden'=>'Регенерация энергии (%)', - 'yza' => 'Уязвимость физическому урона (%)','yzm' => 'Уязвимость магии стихий (%)','yzma' => 'Уязвимость магии (%)' - ,'yza1' => 'Уязвимость колющему урона (%)','yza2' => 'Уязвимость рубящему урона (%)','yza3' => 'Уязвимость дробящему урона (%)','yza4' => 'Уязвимость режущему урона (%)' - ,'yzm1' => 'Уязвимость магии огня (%)','yzm2' => 'Уязвимость магии воздуха (%)','yzm3' => 'Уязвимость магии воды (%)','yzm4' => 'Уязвимость магии земли (%)','yzm5' => 'Уязвимость магии (%)','yzm6' => 'Уязвимость магии (%)','yzm7' => 'Уязвимость магии (%)','rep'=> 'Репутация Рыцаря' - ); - public static $items = array( - 'tr' => array('sex','align','lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','a1','a2','a3','a4','a5','a6','a7','mg1','mg2','mg3','mg4','mg5','mg6','mg7','mall','m2all','aall','rep', 'align_bs'), - 'add' => array( - 'exp','enemy_am1','hod_minmana','yhod','noshock_voda', - 'yza','yzm','yzma','yza1','yza2','yza3','yza4','yzm1','yzm2','yzm3','yzm4','yzm5','yzm6','yzm7', - 'notuse_last_pr','yrn_mg_first','antishock','nopryh','speed_dungeon','naemnik','mg2static_points','yrnhealmpprocmg3','nousepriem','notactic','seeAllEff','100proboi1','pog2','pog2p','magic_cast','min_heal_proc','no_yv1','no_krit1','no_krit2','no_contr1','no_contr2','no_bl1','no_pr1','no_yv2','no_bl2','no_pr2','silver','pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','yron_min','yron_max','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','hpVinos','mpVinos','mpAll','enAll','hpProc','mpProc','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','m11a','zona','zonb','maxves','minAtack','maxAtack','bonusexp','speeden'), - 'sv' => array('pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','enAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','min_use_mp','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','speeden') - ); - - //Подключаем пользователя - public static function connect() { - // - self::$data = \Core\Database::query( 'SELECT * FROM `users` WHERE `login` = :login ORDER BY `id` ASC LIMIT 1' , array( - 'login' => \Core\Utils::cookie('login') - ) , true ); - //Неверный пароль - if( self::$data['pass'] != \Core\Utils::cookie('pass') ) { - self::$data = false; - } - //Персонаж заблокирован - if( self::$data['banned'] > 0 ) { - self::$data = false; - } - //Подключаем статы - if( isset( self::$data['id'] ) ) { - self::$stats = \Core\Database::query( 'SELECT * FROM `stats` WHERE `id` = :uid LIMIT 1' , array( - 'uid' => self::$data['id'] - ) , true ); - } - } - - //Считаем вес персонажа - public static function ves( $uid ) { - $r = array('now' => 0,'max' => 0); - //Масса рюкзака - $r['now'] = \Core\Database::query( 'SELECT SUM(`b`.`massa`) AS `m` FROM `items_users` AS `a` LEFT JOIN `items_main`AS `b` ON `b`.`id` = `a`.`item_id` WHERE `a`.`uid` = :uid AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `inOdet` = 0' , array( - 'uid' => $uid - ) , true ); - $r['now'] = 0 + $r['now']['m']; - // - $r['max'] = 0; - // - return $r; - } - - //Смотрим характеристики - public static function getStats( $uid ) { - $r = array( - 'st' => array( ), //Характеристики - 'sl' => array( ), //Заполненные слоты ( 0 id предмета , 1 тип предмета ) - 'ms' => array( 'now' => 0 , 'max ' => 0 , 'itm' => 0 ) //Масса - ); - // - $user = \Core\Database::query( 'SELECT * FROM `users` WHERE `id` = :uid LIMIT 1' , array( - 'uid' => $uid - ), true ); - // - if( isset($user['id']) ) { - // - $stats = \Core\Database::query( 'SELECT * FROM `stats` WHERE `id` = :uid LIMIT 1' , array( - 'uid' => $uid - ), true ); - // - //Базовые добавления - $r['st']['hpNow'] = $stats['hpNow']; - $r['st']['mpNow'] = $stats['mpNow']; - // - //Характеристики от предметов - $pl = \Core\Database::query( 'SELECT * FROM `items_users` WHERE `uid` = :uid AND `inOdet` > 0 AND `delete` = 0' , array( - 'uid' => $user['id'] - ), true, true); - $i = 0; - while( $i < count($pl) ) { - $r['st'] = self::plusStatsData( $r['st'] , $pl[$i]['data'] ); - $i++; - } - unset($pl,$i); - // - //Характеристики от эффектов - $pl = \Core\Database::query( 'SELECT * FROM `eff_users` WHERE `uid` = :uid AND `delete` = 0' , array( - 'uid' => $user['id'] - ), true, true); - $i = 0; - while( $i < count($pl) ) { - $r['st'] = self::plusStatsData( $r['st'] , $pl[$i]['data'] ); - $i++; - } - unset($pl,$i); - // - //Характеристики от статов - $r['st']['hpAll'] += $r['st']['s4'] * 6; //Здоровье от выносливости - $r['st']['mpAll'] += $r['st']['s6'] * 12; //Мана от мудрости - $r['st']['m1'] += $r['st']['s3'] * 5; //Интуиция дает мф. крита - $r['st']['m2'] += $r['st']['s3'] * 5; //Интуиция дает мф. против крита - $r['st']['m4'] += $r['st']['s2'] * 7; //Интуиция дает мф. уворота - $r['st']['m5'] += $r['st']['s2'] * 7; //Интуиция дает мф. против уворота - $r['st']['za'] += $r['st']['s4'] * 1.5; //Выносливость дает защиту от урона - $r['st']['zm'] += $r['st']['s4'] * 1.5; //Выносливость дает защиту от магии - // - //Бонусы комплектов - - // - //Бонусы статов - - // - } - return $r; - } - - //Добавление статов - public static function plusStatsData( $st , $data ) { - $data = \Core\Utils::lookStats( $data ); - $i = 0; - while( $i < count(self::$items['add']) ) { - if( $data['add_' . self::$items['add'][$i]] != 0 ) { - $st[self::$items['add'][$i]] += $data['add_' . self::$items['add'][$i]]; - } - $i++; - } - return $st; - } - - //Подключаем локацию в которой находится пользователь - public static function room() { - if( isset(self::$data['id']) ) { - self::$room = \Core\Database::query( 'SELECT * FROM `room` WHERE `id` = :id LIMIT 1' , array( - 'id' => self::$data['room'] - ) , true ); - } - } - - public static function redirect($url) { - header('Location: ' . $url); - } - - public static function ErrorPage404() { - die('Страница не найдена'); - } - - public static function ErrorClass404($name) { - die('Расширение '. $name .' не найдено'); - } -} - -?> \ No newline at end of file diff --git a/core1/app/core/utils.php b/core1/app/core/utils.php deleted file mode 100644 index 15982bcc..00000000 --- a/core1/app/core/utils.php +++ /dev/null @@ -1,376 +0,0 @@ - $max ) { - $r = false; - }else{ - //Допустимые символы - if( $sym != false ) { - $i = 0; - $new_val = mb_strtolower($val,'UTF-8'); - while( $i < mb_strlen($val,'UTF-8') ) { - $j = 0; - $k = 0; - $k2 = 0; - while( $j < mb_strlen($sym,'UTF-8') ) { - if( mb_strtolower($val[$i],'UTF-8') == mb_strtolower($sym[$j],'UTF-8') ) { - $k++; - }else{ - if( isset($data['noXsym']) ) { - //Нельзя использовать более X символов подряд - $l = 0; - $notxt = ''; - while( $l < $data['noXsym'] ) { - $notxt .= mb_strtolower($sym[$j],'UTF-8'); - $l++; - } - if( mb_strpos($new_val,$notxt,NULL,'UTF-8') !== false ) { - $k2++; - } - } - } - $j++; - } - if( $k == 0 || $k2 > 0 ) { - $i = mb_strlen($val,'UTF-8'); - $r = false; - } - $i++; - } - } - //Не допустимые символы - if( $nosym != false ) { - $i = 0; - $new_val = ''; - while( $i < count($nosym) ) { - if( mb_strpos(mb_strtolower($val,'UTF-8'),mb_strtolower($nosym[$i],'UTF-8'),NULL,'UTF-8') !== false ) { - $i = count($nosym); - $r = false; - } - $i++; - } - } - //не допустимое начало - if( $nostart != false ) { - $i = 0; - $new_val = ''; - while( $i < count($nostart) ) { - if( mb_substr( $val, 0, mb_strlen($nostart[$i],'UTF-8'),'UTF-8') == $nostart[$i] ) { - $i = count($nostart); - $r = false; - } - $i++; - } - } - //не допустимый конец - if( $noend != false ) { - $i = 0; - $new_val = ''; - while( $i < count($noend) ) { - if( mb_substr( $val, ( mb_strlen($val,'UTF-8') - mb_strlen($noend[$i],'UTF-8') ) , 0 , 'UTF-8') == $noend[$i] ) { - $i = count($noend); - $r = false; - } - $i++; - } - } - } - return $r; - } - - /* - @ Метод "завершения" сессии - */ - public function ses_end() { - if ( session_id() ) { - // Если есть активная сессия, удаляем куки сессии, - setcookie(session_name(), session_id(), time()-60*60*24); - // и уничтожаем сессию - session_unset(); - session_destroy(); - } - } - - /* - @ Метод определения типа строка, цифры, эл.почта - */ - public function takeType( $val ) { - - if( preg_match( "|^[-0-9a-z_\.]+@[-0-9a-z_^\.]+\.[a-z]{2,6}$|i", $val ) ) { - //Эл.почта - return 2; - }else{ - preg_match_all( '([0-9])', $val, $matches ); - $res = implode( NULL, $matches[0] ); - if( mb_strlen( $val, 'UTF-8' ) > mb_strlen( $res, 'UTF-8' ) ) { - //Строка - return 1; - }else{ - //Число - return 3; - } - } - } - - /* - @ Метод проверки правильности паролей - */ - public function testPass( $psw1, $psw2 ) { - if( $psw1 == $psw2 ) { - return true; - }else{ - return false; - } - } - - /* - @ Метод генирации ключа авторизации - */ - public function createAuth( $par ) { - if( !isset( $par['rand'] ) ) { - $par['rand'] = rand(10000000,90000000); - } - $r = $par['rand'] . md5( $par['ip'] . '+' . $par['id'] . '+' . $par['pass'] . '+' . $par['rand'] ); - return $r; - } - - /* - @ Метод проверки ключа авторизации - */ - public function testAuth( $auth, $par ) { - $par['rand'] = substr( $auth, 0, 8 ); - if( $auth == self::createAuth( $par ) ) { - return true; - }else{ - return false; - } - } - - /* - @ Метод вывода JSON данных - */ - public function JSON_Headers() { - header('Expires: Mon, 26 Jul 1970 05:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('Cache-Control: no-store, no-cache, must-revalidate'); - header('Cache-Control: post-check=0, pre-check=0', false); - header('Pragma: no-cache'); - header('Content-Type: application/json; charset=utf-8'); - return true; - } - - /* - @ Метод приобразования обьекта в JSON - */ - public function jsonencode( $val ) { - array_walk_recursive( $val, function( &$value, $key ) { - $value = iconv( "CP1251", "UTF-8", $value ); - }); - return json_encode( $val ); - //return json_encode( $val ); - //return self::json_fix_cyr( json_encode( $val ) ); - } - - /* - @ Метод приобразования JSON в обьект - */ - public function jsondecode( $val ) { - return json_decode( $val ); - } - - /* - @ Метод фикса кириллических символов - */ - public function json_fix_cyr($json_str) { - $cyr_chars = array ( - '\u0430' => 'а', '\u0410' => 'А', - '\u0431' => 'б', '\u0411' => 'Б', - '\u0432' => 'в', '\u0412' => 'В', - '\u0433' => 'г', '\u0413' => 'Г', - '\u0434' => 'д', '\u0414' => 'Д', - '\u0435' => 'е', '\u0415' => 'Е', - '\u0451' => 'ё', '\u0401' => 'Ё', - '\u0436' => 'ж', '\u0416' => 'Ж', - '\u0437' => 'з', '\u0417' => 'З', - '\u0438' => 'и', '\u0418' => 'И', - '\u0439' => 'й', '\u0419' => 'Й', - '\u043a' => 'к', '\u041a' => 'К', - '\u043b' => 'л', '\u041b' => 'Л', - '\u043c' => 'м', '\u041c' => 'М', - '\u043d' => 'н', '\u041d' => 'Н', - '\u043e' => 'о', '\u041e' => 'О', - '\u043f' => 'п', '\u041f' => 'П', - '\u0440' => 'р', '\u0420' => 'Р', - '\u0441' => 'с', '\u0421' => 'С', - '\u0442' => 'т', '\u0422' => 'Т', - '\u0443' => 'у', '\u0423' => 'У', - '\u0444' => 'ф', '\u0424' => 'Ф', - '\u0445' => 'х', '\u0425' => 'Х', - '\u0446' => 'ц', '\u0426' => 'Ц', - '\u0447' => 'ч', '\u0427' => 'Ч', - '\u0448' => 'ш', '\u0428' => 'Ш', - '\u0449' => 'щ', '\u0429' => 'Щ', - '\u044a' => 'ъ', '\u042a' => 'Ъ', - '\u044b' => 'ы', '\u042b' => 'Ы', - '\u044c' => 'ь', '\u042c' => 'Ь', - '\u044d' => 'э', '\u042d' => 'Э', - '\u044e' => 'ю', '\u042e' => 'Ю', - '\u044f' => 'я', '\u042f' => 'Я', - - '\r' => '', - '\n' => '
    ', - '\t' => '' - ); - foreach ($cyr_chars as $cyr_char_key => $cyr_char) { - $json_str = str_replace($cyr_char_key, $cyr_char, $json_str); - } - return $json_str; - } - - public static function timeOut($ttm) - { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - return $out; - } - -} - -?> \ No newline at end of file diff --git a/core1/app/core/view.php b/core1/app/core/view.php deleted file mode 100644 index ee8df35c..00000000 --- a/core1/app/core/view.php +++ /dev/null @@ -1,16 +0,0 @@ - false)); - $template = $template . '.html'; - $template = $twig->loadTemplate($template); - return $template->render($data); - } - -} - -?> \ No newline at end of file diff --git a/core1/app/html/.htaccess b/core1/app/html/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/app/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/app/html/admin.html b/core1/app/html/admin.html deleted file mode 100644 index 6c22a7dc..00000000 --- a/core1/app/html/admin.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - -{{ title }} - - -{% if user.admin > 0 %} - -Персонаж: {{ user.login }} (Владелец ресурса)
    -
    - -
    - -{% else %} -Доступ разрешен только владельцам ресурса. -{% endif %} - - \ No newline at end of file diff --git a/core1/app/html/auction.html b/core1/app/html/auction.html deleted file mode 100644 index d7112211..00000000 --- a/core1/app/html/auction.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - -{{ title }} - - - -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    - -
    - - - \ No newline at end of file diff --git a/core1/app/html/comission.html b/core1/app/html/comission.html deleted file mode 100644 index 21083fa9..00000000 --- a/core1/app/html/comission.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - -{{ title }} - - - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    - -
    - - - \ No newline at end of file diff --git a/core1/app/html/debuger.html b/core1/app/html/debuger.html deleted file mode 100644 index f1995182..00000000 --- a/core1/app/html/debuger.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - -{{ title }} - - - -Персонаж: {{ user.login }}
    -
    - - - \ No newline at end of file diff --git a/core1/app/init.php b/core1/app/init.php deleted file mode 100644 index a4df06ce..00000000 --- a/core1/app/init.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/core1/app/logic/.htaccess b/core1/app/logic/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/app/logic/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/app/logic/admin.php b/core1/app/logic/admin.php deleted file mode 100644 index f058e3b6..00000000 --- a/core1/app/logic/admin.php +++ /dev/null @@ -1,66 +0,0 @@ -главную страницу.'; - }elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) { - echo self::getJSON(); - }else{ - echo self::getHTML(); - } - } - - /* - @ Метод выводящий HTML-контент на сторону пользователя - @ Через конкретный шаблонизатор - */ - public static function getHTML() { - //PC версия главной страницы - // - return view::generateTpl( 'admin', array( - 'title' => COPY . ' :: Панель админа', - - //Передаем данные пакетов - 'user' => \Core\User::$data, - 'stats' => \Core\User::$stats, - 'room' => \Core\User::$room, - - 'OK' => OK, - 'copy' => COPY, - 'rights' => RIGHTS, - - 'ver' => '0.0.1' - ) ); - } - - /* - @ Метод выводящий JSON-контент на сторону пользователя - @ Информация берется из переменной self::$JSON - */ - public static function getJSON() { - $r = array(); - - return \Core\Utils::jsonencode( $r ); - } - -} - -?> \ No newline at end of file diff --git a/core1/app/logic/auction.php b/core1/app/logic/auction.php deleted file mode 100644 index a87e7633..00000000 --- a/core1/app/logic/auction.php +++ /dev/null @@ -1,551 +0,0 @@ -главную страницу.'; - }elseif( \Core\User::$data['battle'] > 0 ) { - header('location:main.php?inv'); - }elseif( \Core\User::$room['name'] != 'Аукцион' ) { - echo 'Вы находитесь в другой локации.'; - }elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) { - \Core\User::$stats = \Core\User::getStats( \Core\User::$data['id'] ); - echo self::getJSON(); - }else{ - \Core\User::$stats = \Core\User::getStats( \Core\User::$data['id'] ); - echo self::getHTML(); - } - } - - /* - @ Метод выводящий HTML-контент на сторону пользователя - @ Через конкретный шаблонизатор - */ - public static function getHTML() { - //PC версия главной страницы - return view::generateTpl( 'auction', array( - 'title' => COPY . ' :: Аукцион', - - //Передаем данные пакетов - 'user' => \Core\User::$data, - 'stats' => \Core\User::$stats, - 'room' => \Core\User::$room, - - 'OK' => OK, - 'copy' => COPY, - 'rights' => RIGHTS, - - 'ver' => '1.2.5' - ) ); - } - - /* - @ Метод выводящий JSON-контент на сторону пользователя - @ Информация берется из переменной self::$JSON - */ - public static function getJSON() { - $r = array( 'type' => $_GET['type'],'item_data' => array( 'i' => 0 , 'g' => array() ) ); - - //Информация - $r['money'] = 0+\Core\User::$data['money']; - $r['massaNow'] = 0+\Core\User::$data['massaNow']; - $r['massaMax'] = 0+\Core\User::$data['massaNow']; - $r['timeGo'] = 0+\Core\User::$stats['timeGo']; - $r['timeGoL'] = 0+\Core\User::$stats['timeGoL']; - $r['timeNow'] = OK; - // - - if(isset($_GET['buy_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK) { - //Меняем ставку - $itm_auc = \Core\Database::query( 'SELECT * FROM `items_auc` WHERE `id` = :item_id AND `time_end` = 0 AND `time` > :time LIMIT 1' , array( - 'item_id' => (int)$_GET['buy_item'], - 'time' => OK - 86400 - ) , true ); - if(isset($itm_auc['id'])) { - $price = round($_GET['kr'],2); - $price_min = round(($itm_auc['price'] + $itm_auc['price']*0.01),2); - $price_max = round(($itm_auc['price'] * 2),2); - if( $itm_auc['uid'] == \Core\User::$data['id'] ) { - $r['error'] = 6; - }elseif( $itm_auc['user_buy'] != \Core\User::$data['id'] ) { - if( $price > \Core\User::$data['money'] ) { - $r['error'] = 5; //У вас недостаточно денег - }elseif( $price - $price_min >= 0 ) { - if( $price - $price_max < 1 ) { - /* - Забираем кр. , если были ставки до этого возвращаем кр. на почту персонажу который делал ставку - */ - if( $itm_auc['user_buy'] > 0 ) { - //Выдаем кр. обратно прошлому игроку который сделал ставку - $user = \Core\Database::query( 'SELECT `id`,`login` FROM `users` WHERE `id` = :uid LIMIT 1' , array( - 'uid' => $itm_auc['user_buy'] - ) , true ); - if( isset($user['id']) ) { - \Core\Chat::send_system( $user['login'] , 'Персонаж ' . \Core\User::$data['login'] . ' перебил вашу ставку на Аукционе, предмет "'.$itm_auc['name'].'". Сумма вашей ставки отправлена к вам на почту.' ); - // - $tmgo = 0; - \Core\Database::query( 'INSERT INTO `items_users` (`item_id`,`1price`,`uid`,`delete`,`lastUPD`) VALUES ( - 1220 , :money , :uid , 0 , :time - )' , array( - 'uid' => '-51' . $user['id'], - 'money' => $itm_auc['price'], - 'time' => OK + $tmgo * 60 - )); - $txt = 'Деньги от '.$itm_auc['login'].': '.$itm_auc['price'].' кр. Прибытие: '.date('d.m.Y H:i',(OK + $tmgo*60)).''; - \Core\Database::query( 'INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES - ( :user_to , :user_from , :time , :money , :txt )' , array( - 'user_from' => $itm_auc['uid'], - 'user_to' => $user['id'], - 'time' => OK, - 'txt' => $txt, - 'money' => $itm_auc['price'] - )); - $txt = 'Деньги к '.$user['login'].': '.$itm_auc['price'].' кр. Прибытие: '.date('d.m.Y H:i',(OK + $tmgo*60)).''; - \Core\Database::query( 'INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES - ( :user_from , :user_to , :time , :money , :txt )' , array( - 'user_from' => $itm_auc['uid'], - 'user_to' => $user['id'], - 'time' => OK, - 'txt' => $txt, - 'money' => $tim_auc['price'] - )); - // - } - } - - //Забираем деньги у текущего игрока и записываем в тело аукциона - \Core\User::$data['money'] -= $price; - \Core\Database::query( 'UPDATE `users` SET `money` = :money WHERE `id` = :uid LIMIT 1', array( - 'uid' => \Core\User::$data['id'], - 'money' => \Core\User::$data['money'] - ) ); - // - $itm_auc['price'] = $price; - $itm_auc['login_buy'] = \Core\User::$data['login']; - $itm_auc['user_buy'] = \Core\User::$data['id']; - $itm_auc['time'] += 15*60; //+15 мин к аукциону - // - \Core\Database::query( 'UPDATE `items_auc` SET `price` = :price , `time` = :time , `login_buy` = :login_buy , `user_buy` = :user_buy WHERE `id` = :id LIMIT 1', array( - 'id' => $itm_auc['id'], - 'price' => $itm_auc['price'], - 'time' => $itm_auc['time'], - 'login_buy' => $itm_auc['login_buy'], - 'user_buy' => $itm_auc['user_buy'] - ) ); - // - // - $r['info'] = true; - // - }else{ - $r['error'] = 4; //Превышена максимальная ставка в 2 раза от текущей ставки - } - }else{ - $r['error'] = 3; //Минимальная ставка - 1% от текущей ставки - } - }else{ - $r['error'] = 2; - } - }else{ - $r['error'] = 1; - } - }elseif(isset($_GET['add_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK) { - //Добавляем предмет на аукцион (от игрока в аукцион) - $itm_user = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`inOdet` = 0 AND `a`.`uid` = :uid AND `a`.`id` = :item_id AND `a`.`delete` = 0 AND `a`.`gift` = "" AND `a`.`data` NOT LIKE "%sudba=%" AND `a`.`data` NOT LIKE "%zazuby=%" AND `a`.`data` NOT LIKE "%|notransfer=%" AND `a`.`inTransfer` = 0 AND `a`.`inShop` = 0 LIMIT 1' , array( - 'uid' => \Core\User::$data['id'], - 'item_id' => (int)$_GET['add_item'] - ) , true ); - if( isset($itm_user['id']) ) { - $price = round($_GET['price'],2); - // - if( \Core\User::$stats['st']['silver'] >= 4 ) { - $price_com = round(($price/100*2.5),2); - }else{ - $price_com = round(($price/100*10),2); - } - // - if( $price < 1 ) { - $r['error'] = 2; - }elseif( $price > 1000000 ) { - $r['error'] = 3; - }elseif( $price_com > \Core\User::$data['money'] ) { - $r['error'] = 4; - }elseif( \Core\User::$data['align'] == 2 ) { - $r['error'] = 5; - }else{ - // - $count = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_users` WHERE `uid` = :uid AND `item_id` = :item_id AND ( ( `inGroup` > 0 AND `inGroup` = :group ) OR ( `inGroup` = 0 AND `id` = :id ) ) AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1', array( - 'uid' => \Core\User::$data['id'], - 'id' => $itm_user['uiid'], - 'item_id' => $itm_user['id'], - 'group' => $itm_user['inGroup'] - ) , true ); - $count = $count[0]; - // - $upd = \Core\Database::query( 'UPDATE `items_users` SET `uid` = 0, `inGroup` = :id WHERE `uid` = :uid AND `item_id` = :item_id AND ( ( `inGroup` > 0 AND `inGroup` = :group ) OR ( `inGroup` = 0 AND `id` = :id ) ) AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0' , - array( - 'uid' => \Core\User::$data['id'], - 'id' => $itm_user['uiid'], - 'item_id' => $itm_user['id'], - 'group' => $itm_user['inGroup'] - ) - ); - // - if($upd == true) { - $itm_user_data = \Core\Item::lookStats($itm_user['data']); - // - \Core\Database::query( 'INSERT INTO `items_auc` - ( - `login`,`uid`,`item_id`,`items_id`,`time`,`time_end`,`img`,`name`,`level`,`x`,`price_start`,`price`,`massa`,`iznosNOW`,`iznosMAX`,`user_buy`,`type`,`delete` - ) VALUES ( - :login , :uid , :item_id , :items_id , :time , 0 , :img , :name , :level , :x , :price , :price , :massa , :iznosNOW , :iznosMAX , 0 , :type , 0 - )', array( - 'login' => \Core\User::$data['login'], - 'uid' => \Core\User::$data['id'], - 'item_id' => $itm_user['uiid'], - 'items_id' => $itm_user['id'], - 'time' => OK, - 'time_end' => OK + 86400, - 'img' => $itm_user['img'], - 'name' => $itm_user['name'], - 'level' => $itm_user_data['tr_lvl'], - 'x' => (0+$count), - 'price' => $price, - 'massa' => $itm_user['massa'], - 'iznosNOW' => $itm_user['iznosNOW'], - 'iznosMAX' => $itm_user['iznosMAX'], - 'type' => $itm_user['type'] - )); - // - $r['info'] = array( - 'itm_name' => $itm_user['name'], - 'x' => $count, - 'price' => $price, - 'id' => $itm_user['uiid'] - ); - // - }else{ - $r['error'] = 6; - } - // - } - }else{ - $r['error'] = 1; - } - }elseif(isset($_GET['option_item']) && ($_GET['option_item'] == 1 || $_GET['option_item'] == 2 || $_GET['option_item'] == 3 || $_GET['option_item'] == 4 || $_GET['option_item'] == 5)) { - //Просматриваем предметы которые находятся в аукционе и в инвентаре игрока - $id = (int)$_GET['option_item']; - if( $id == 5 ) { - //Торги (уникальные вещи) - $r['item_data']['x'] = 0; - $pla = \Core\Database::query( 'SELECT * FROM `items_auc` WHERE `time_end` = 0 AND `uniq` = 1 ORDER BY `id` DESC' , array( - - ) , true , true ); - // - $pages_all = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_auc` WHERE `time_end` = 0 AND `uniq` = 1 LIMIT 1', array( - - ) , true ); - // - $pages_all = $pages_all['i']; - $pages_all = ceil($pages_all/20); //20 страниц - // - $page_now = 0 + round((int)$_GET['page']); - if( $page_now < 1 ) { - $page_now = 1; - }elseif( $page_now > $pages_all ) { - $page_now = $pages_all; - } - // - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - $i = 0; - $j = 0; - while( $i < count($pla) ) { - // - if( $i < ($page_now) * 20 && $i >= ($page_now-1) * 20 ) { - $pl = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`id` = :item_id LIMIT 1' , array( - 'item_id' => $pla[$i]['item_id'] - ) , true ); - // - $r['item_data'][$j] = \Core\Item::infoItem($pl); - $r['item_data'][$j]['iid'] = $pl['item_id']; - $r['item_data'][$j]['user_ow'] = $pla[$i]['login']; - $r['item_data'][$j]['item_id'] = $pla[$i]['items_id']; - $r['item_data'][$j]['name'] = $pl['name']; - $r['item_data'][$j]['prc'] = $pla[$i]['price']; - $r['item_data'][$j]['prc2'] = round(($pla[$i]['price']+$pla[$i]['price']*0.01),2); - $r['item_data'][$j]['cid'] = $pl['id']; - $r['item_data'][$j]['aid'] = $pla[$i]['id']; - // - $r['item_data'][$j]['buy'] = $pla[$i]['login_buy']; - //$r['item_data'][$j]['buy'] = $pl['login_buy']; - // - $r['item_data'][$j]['x'] = $count; - $r['item_data'][$j]['iznosNOW'] = $pl['iznosNOW']; - $r['item_data'][$j]['iznosMAX'] = $pl['iznosMAX']; - $r['item_data'][$j]['massa'] = $pl['massa']; - $r['item_data'][$j]['time'] = \Core\Utils::timeOut($pla[$i]['time']+86400-time()); - $j++; - // - $r['item_data']['x']++; - $r['item_data']['i']++; - } - $i++; - } - // - }elseif( $id == 1 ) { - //Торги - $r['item_data']['x'] = 0; - $pla = \Core\Database::query( 'SELECT * FROM `items_auc` WHERE `time_end` = 0 AND `uniq` = 0 ORDER BY `id` DESC' , array( - - ) , true , true ); - // - $pages_all = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_auc` WHERE `time_end` = 0 AND `uniq` = 0 LIMIT 1', array( - - ) , true ); - // - $pages_all = $pages_all['i']; - $pages_all = ceil($pages_all/20); //20 страниц - // - $page_now = 0 + round((int)$_GET['page']); - if( $page_now < 1 ) { - $page_now = 1; - }elseif( $page_now > $pages_all ) { - $page_now = $pages_all; - } - // - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - $i = 0; - $j = 0; - while( $i < count($pla) ) { - // - if( $i < ($page_now) * 20 && $i >= ($page_now-1) * 20 ) { - $pl = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`id` = :item_id LIMIT 1' , array( - 'item_id' => $pla[$i]['item_id'] - ) , true ); - // - $r['item_data'][$j] = \Core\Item::infoItem($pl); - $r['item_data'][$j]['iid'] = $pl['item_id']; - $r['item_data'][$j]['user_ow'] = $pla[$i]['login']; - $r['item_data'][$j]['item_id'] = $pla[$i]['items_id']; - $r['item_data'][$j]['name'] = $pl['name']; - $r['item_data'][$j]['prc'] = $pla[$i]['price']; - $r['item_data'][$j]['prc2'] = round(($pla[$i]['price']+$pla[$i]['price']*0.01),2); - $r['item_data'][$j]['cid'] = $pl['id']; - $r['item_data'][$j]['aid'] = $pla[$i]['id']; - // - $r['item_data'][$j]['buy'] = $pla[$i]['login_buy']; - //$r['item_data'][$j]['buy'] = $pl['login_buy']; - // - $r['item_data'][$j]['x'] = $count; - $r['item_data'][$j]['iznosNOW'] = $pl['iznosNOW']; - $r['item_data'][$j]['iznosMAX'] = $pl['iznosMAX']; - $r['item_data'][$j]['massa'] = $pl['massa']; - $r['item_data'][$j]['time'] = \Core\Utils::timeOut($pla[$i]['time']+86400-time()); - $j++; - // - $r['item_data']['x']++; - $r['item_data']['i']++; - } - $i++; - } - // - }elseif( $id == 2 ) { - //Ставки - $r['item_data']['x'] = 0; - $pla = \Core\Database::query( 'SELECT * FROM `items_auc` WHERE `time_end` = 0 AND `user_buy` = :uid ORDER BY `id` DESC' , array( - 'uid' => \Core\User::$data['id'] - ) , true , true ); - // - $pages_all = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_auc` WHERE `time_end` = 0 AND `user_buy` = :uid LIMIT 1', array( - 'uid' => \Core\User::$data['id'] - ) , true ); - // - $pages_all = $pages_all['i']; - $pages_all = ceil($pages_all/20); //20 страниц - // - $page_now = 0 + round((int)$_GET['page']); - if( $page_now < 1 ) { - $page_now = 1; - }elseif( $page_now > $pages_all ) { - $page_now = $pages_all; - } - // - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - $i = 0; - $j = 0; - while( $i < count($pla) ) { - // - if( $i < ($page_now) * 20 && $i >= ($page_now-1) * 20 ) { - $pl = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`id` = :item_id LIMIT 1' , array( - 'item_id' => $pla[$i]['item_id'] - ) , true ); - // - $r['item_data'][$j] = \Core\Item::infoItem($pl); - $r['item_data'][$j]['iid'] = $pl['item_id']; - $r['item_data'][$j]['user_ow'] = $pla[$i]['login']; - $r['item_data'][$j]['item_id'] = $pla[$i]['items_id']; - $r['item_data'][$j]['name'] = $pl['name']; - $r['item_data'][$j]['prc'] = $pla[$i]['price']; - $r['item_data'][$j]['prc2'] = round(($pla[$i]['price']+$pla[$i]['price']*0.01),2); - $r['item_data'][$j]['cid'] = $pl['id']; - $r['item_data'][$j]['aid'] = $pla[$i]['id']; - // - $r['item_data'][$j]['buy'] = $pla[$i]['login_buy']; - //$r['item_data'][$j]['buy'] = $pl['login_buy']; - // - $r['item_data'][$j]['x'] = $count; - $r['item_data'][$j]['iznosNOW'] = $pl['iznosNOW']; - $r['item_data'][$j]['iznosMAX'] = $pl['iznosMAX']; - $r['item_data'][$j]['massa'] = $pl['massa']; - $r['item_data'][$j]['time'] = \Core\Utils::timeOut($pla[$i]['time']+86400-time()); - $j++; - // - $r['item_data']['x']++; - $r['item_data']['i']++; - } - $i++; - } - // - }elseif( $id == 3 ) { - //Ваши предметы (уже на торгах) - $r['item_data']['x'] = 0; - $pla = \Core\Database::query( 'SELECT * FROM `items_auc` WHERE `uid` = :uid AND `time_end` = 0 ORDER BY `id` DESC' , array( - 'uid' => \Core\User::$data['id'] - ) , true , true ); - // - $pages_all = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_auc` WHERE `uid` = :uid AND `time_end` = 0 LIMIT 1', array( - 'uid' => \Core\User::$data['id'] - ) , true ); - // - $pages_all = $pages_all['i']; - $pages_all = ceil($pages_all/20); //20 страниц - // - $page_now = 0 + round((int)$_GET['page']); - if( $page_now < 1 ) { - $page_now = 1; - }elseif( $page_now > $pages_all ) { - $page_now = $pages_all; - } - // - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - $i = 0; - $j = 0; - while( $i < count($pla) ) { - // - if( $i < ($page_now) * 20 && $i >= ($page_now-1) * 20 ) { - $pl = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`id` = :item_id LIMIT 1' , array( - 'item_id' => $pla[$i]['item_id'] - ) , true ); - // - $r['item_data'][$j] = \Core\Item::infoItem($pl); - $r['item_data'][$j]['iid'] = $pl['item_id']; - $r['item_data'][$j]['item_id'] = $pla[$i]['items_id']; - $r['item_data'][$j]['name'] = $pl['name']; - $r['item_data'][$j]['prc'] = $pla[$i]['price']; - $r['item_data'][$j]['cid'] = $pl['id']; - // - $r['item_data'][$j]['buy'] = $pla[$i]['login_buy']; - //$r['item_data'][$j]['buy'] = $pl['login_buy']; - // - $r['item_data'][$j]['x'] = $count; - $r['item_data'][$j]['iznosNOW'] = $pl['iznosNOW']; - $r['item_data'][$j]['iznosMAX'] = $pl['iznosMAX']; - $r['item_data'][$j]['massa'] = $pl['massa']; - $r['item_data'][$j]['time'] = \Core\Utils::timeOut($pla[$i]['time']+86400-time()); - $j++; - // - $r['item_data']['x']++; - $r['item_data']['i']++; - } - $i++; - } - // - }elseif( $id == 4 ) { - //Выставить предметы на торги - $r['item_data']['x'] = 0; - $pl = \Core\Database::query( 'SELECT `a`.* , `b`.* , `a`.`id` AS `uiid` FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON `a`.`item_id` = `b`.`id` WHERE `a`.`inOdet` = 0 AND `a`.`uid` = :uid AND `a`.`delete` = 0 AND `a`.`gift` = "" AND `a`.`data` NOT LIKE "%sudba=%" AND `a`.`data` NOT LIKE "%zazuby=%" AND `a`.`data` NOT LIKE "%|notransfer=%" AND `a`.`inTransfer` = 0 AND `a`.`inShop` = 0 ORDER BY `a`.`lastUPD` DESC' , array( - 'uid' => \Core\User::$data['id'] - ) , true , true ); - // - $pages_all = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_users` WHERE `inOdet` = 0 AND `uid` = :uid AND `delete` = 0 AND `inGroup` = 0 AND `inShop` = 0 AND `inTransfer` = 0 AND `gift` = "" AND `data` NOT LIKE "%|zazuby=%" AND `data` NOT LIKE "%|notransfer=%" AND `data` NOT LIKE "%|sudba=%" LIMIT 1', array( - 'uid' => \Core\User::$data['id'] - ) , true ); - $pages_group = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_users` WHERE `inOdet` = 0 AND `uid` = :uid AND `delete` = 0 AND `inGroup` > 0 AND `inShop` = 0 AND `inTransfer` = 0 AND `gift` = "" AND `data` NOT LIKE "%|zazuby=%" AND `data` NOT LIKE "%|notransfer=%" AND `data` NOT LIKE "%|sudba=%" GROUP BY `inGroup` , `item_id` LIMIT 1', array( - 'uid' => \Core\User::$data['id'] - ) , true ); - // - $pages_all = $pages_all['i']; - $pages_group = $pages_group['i']; - // - $pages_all += $pages_group; - $pages_all = ceil($pages_all/20); //20 страниц - // - $page_now = 0 + round((int)$_GET['page']); - if( $page_now < 1 ) { - $page_now = 1; - }elseif( $page_now > $pages_all ) { - $page_now = $pages_all; - } - // - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - $i = 0; - $j = 0; - while( $i < count($pl) ) { - // - //if( $j < ($page_now) * 20 && $j >= ($page_now-1) * 20 ) { - if( $pl[$i]['inGroup'] == 0 || !isset($r['item_data']['g'][$pl[$i]['item_id']][$pl[$i]['inGroup']]) ) { - $r['item_data'][$j] = \Core\Item::infoItem($pl[$i]); - $r['item_data'][$j]['iid'] = $pl[$i]['item_id']; - $r['item_data'][$j]['prc'] = $pl[$i]['1price']; - $r['item_data'][$j]['cid'] = $pl[$i]['id']; - $r['item_data'][$j]['x'] = $count; - $j++; - } - // - $r['item_data']['x']++; - $r['item_data']['i']++; - //} - if( $pl[$i]['inGroup'] > 0 ) { - $r['item_data']['g'][$pl[$i]['item_id']][$pl[$i]['inGroup']]++; - } - $i++; - } - $pages_all = 1; - $r['toppages'] = $pages_all; - $r['page'] = $page_now; - // - } - } - - return \Core\Utils::jsonencode( $r ); - } - -} - -?> \ No newline at end of file diff --git a/core1/app/logic/comission.php b/core1/app/logic/comission.php deleted file mode 100644 index 29cad0a2..00000000 --- a/core1/app/logic/comission.php +++ /dev/null @@ -1,569 +0,0 @@ -главную страницу.'; - }elseif( \Core\User::$data['battle'] > 0 ) { - header('location:main.php?inv'); - }elseif( \Core\User::$room['name'] != 'Комиссионный магазин' ) { - echo 'Вы находитесь в другой локации.'; - }elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) { - echo self::getJSON(); - }else{ - echo self::getHTML(); - } - } - - /* - @ Метод выводящий HTML-контент на сторону пользователя - @ Через конкретный шаблонизатор - */ - public static function getHTML() { - //PC версия главной страницы - return view::generateTpl( 'comission', array( - 'title' => COPY . ' :: Комиссионный магазин', - - //Передаем данные пакетов - 'user' => \Core\User::$data, - 'stats' => \Core\User::$stats, - 'room' => \Core\User::$room, - - 'OK' => OK, - 'copy' => COPY, - 'rights' => RIGHTS, - - 'ver' => '1.1.3' - ) ); - } - - /* - @ Метод выводящий JSON-контент на сторону пользователя - @ Информация берется из переменной self::$JSON - */ - public static function getJSON() { - $r = array( 'type' => $_GET['type'],'it' => array( 'i' => 0 , 'g' => array() ) ); - - //Информация - $r['money'] = 0+\Core\User::$data['money']; - // - $ves = \Core\User::ves(\Core\User::$data['id']); - // - $r['massaNow'] = 0+$ves['now']; - $r['massaMax'] = 0+$ves['max']; - $r['timeGo'] = 0+\Core\User::$stats['timeGo']; - $r['timeGoL'] = 0+\Core\User::$stats['timeGoL']; - $r['timeNow'] = OK; - // - if( isset($_GET['newprice_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK ) { - //Обновляем стоимость предмета - $comiss = 0.10; //Комиссия - // - $itm_user = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `item_id` = :id AND `uid` = :uid AND `city` =:city AND `delete` = "0" LIMIT 1' , array( - 'id' => $_GET['newprice_item'], - 'uid' => \Core\User::$data['id'], - 'city' => \Core\User::$data['city'] - ) , true ); - // - $itm_useri = \Core\Database::query( 'SELECT *, `id` AS `uiid` FROM `items_users` WHERE `id` = :id AND `uid` = :uid AND `gift` = "" AND `data` NOT LIKE "%sudba=%" AND `data` NOT LIKE "%zazuby=%" AND `data` NOT LIKE "%|notransfer=%" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1' , array( - 'id' => $itm_user['item_id'], - 'uid' => 0 - ) , true ); - // - $itm_main = \Core\Database::query( 'SELECT * FROM `items_main` WHERE `id` = :id LIMIT 1' , array( - 'id' => $itm_user['items_id'] - ) , true ); - // - if( $itm_useri['1price'] == 0 ) { - $itm_useri['1price'] = $itm_main['price1']; - } - if( $itm_useri['1price'] == 0 ) { - $itm_useri['1price'] = 1; - } - // - $prc = round($_GET['newprice_price'],2); - // - if(!isset($itm_user['id']) || !isset($itm_useri['id']) || !isset($itm_main['id'])) { - $r['newprice_error'] = 1; - }elseif( $prc < 1 ) { - $r['newprice_error'] = 2; - }elseif( $prc > ( $itm_user['group'] * $itm_useri['1price'] ) * 10 ) { - $r['newprice_error'] = 3; - }elseif( $prc < round( (((( $itm_user['group'] * $itm_useri['1price'] ) / $itm_main['iznosMAXi'] ) * $itm_useri['iznosMAX']) / 2) , 2) ) { - $r['newprice_error'] = 4; - $r['newprice_error_min'] = round( (((( $itm_user['group'] * $itm_useri['1price'] ) / $itm_main['iznosMAXi'] ) * $itm_useri['iznosMAX']) / 2) , 2); - }else{ - $itm_user['price'] = $prc; - // - $r['newprice_price_comission'] = $comiss; - $r['newprice_item'] = $itm_user['id']; - $r['newprice_uiid'] = $itm_user['item_id']; - $r['newprice_name'] = $itm_user['name']; - $r['newprice_x'] = $itm_user['group']; - $r['newprice_price']= $itm_user['price']; - // - \Core\User::$data['money'] -= $comiss; //$comiss Комиссия - // - \Core\Database::query( 'UPDATE `users` SET `money` = :money WHERE `id` = :uid LIMIT 1' , - array( - 'uid' => \Core\User::$data['id'], - 'money' => \Core\User::$data['money'] - ) - ); - // - \Core\Database::query( 'UPDATE `items_com` SET `price` = :newprice WHERE `id` = :id LIMIT 1', array( - 'id' => $itm_user['id'], - 'newprice' => $itm_user['price'] - ) ); - } - // - }elseif( isset($_GET['pick_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK ) { - //Забираем предмет - $itm_user = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `city` = :city AND `id` = :id AND `uid` = :uid AND `delete` = "0" LIMIT 1' , array( - 'id' => $_GET['pick_item'], - 'uid' => \Core\User::$data['id'], - 'city' => \Core\User::$data['city'] - ) , true ); - // - if(!isset($itm_user['id'])) { - $r['pick_error'] = 1; - }else{ - $r['pick_item'] = $itm_user['id']; - $r['pick_uiid'] = $itm_user['item_id']; - $r['pick_name'] = $itm_user['name']; - $r['pick_x'] = $itm_user['group']; - \Core\Database::query( 'UPDATE `items_com` SET `delete` = :time WHERE `id` = :id LIMIT 1', array( - 'id' => $itm_user['id'], - 'time' => OK - ) ); - \Core\Database::query( 'UPDATE `items_users` SET `inGroup` = 0 , `uid` = :uid , `lastUPD` = :time WHERE `id` = :id OR ( `inGroup` = :id AND `item_id` = :item_id AND `uid` = 0 )', array( - 'id' => $itm_user['item_id'], - 'item_id' => $itm_user['items_id'], - 'uid' => $itm_user['uid'], - 'time' => OK - ) ); - } - // - }elseif( isset($_GET['give_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK ) { - //Сдаем предмет - $itm_user = \Core\Database::query( 'SELECT *, `id` AS `uiid` FROM `items_users` WHERE `id` = :id AND `uid` = :uid AND `gift` = "" AND `data` NOT LIKE "%sudba=%" AND `data` NOT LIKE "%zazuby=%" AND `data` NOT LIKE "%|notransfer=%" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1' , array( - 'id' => $_GET['give_item'], - 'uid' => \Core\User::$data['id'] - ) , true ); - // - $comiss = 1; //Комиссия в кр. - $prc = round($_GET['give_price'],2); //Какую сумму выставляем предмету - // - $itm_x = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_users` WHERE `inGroup` = :group AND `inGroup` > 0 AND `item_id` = :item_id AND `uid` = :uid AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1' , array( - 'item_id' => $itm_user['item_id'], - 'group' => $itm_user['inGroup'], - 'uid' => \Core\User::$data['id'] - ) , true ); - if( $itm_x['i'] == 0 ) { - $itm_x['i'] = 1; - } - // - $itm_main = \Core\Database::query( 'SELECT * FROM `items_main` WHERE `id` = :id LIMIT 1' , array( - 'id' => $itm_user['item_id'] - ) , true ); - if( $itm_user['1price'] == 0 ) { - $itm_user['1price'] = $itm_main['price1']; - } - if( $itm_user['1price'] == 0 ) { - $itm_user['1price'] = 1; - } - // - if( !isset($itm_user['id']) ) { - $r['give_error'] = 1; - }elseif( $comiss > \Core\User::$data['money'] && true == false ) { - $r['give_error'] = 2; - }elseif( \Core\User::$data['align'] == 2 ) { - $r['give_error'] = 3; - }elseif( \Core\User::$data['level'] < 4 ) { - $r['give_error'] = 4; - }elseif( $prc > 100000 ) { - $r['give_error'] = 5; - }elseif( $prc < 1 ) { - $r['give_error'] = 6; - }elseif( $prc > ( $itm_x['i'] * $itm_user['1price'] ) * 10 && true == false ) { - $r['give_error'] = 7; - }elseif( $prc < round( (((( $itm_x['i'] * $itm_user['1price'] ) / $itm_main['iznosMAXi'] ) * $itm_user['iznosMAX']) / 2) , 2) ) { - $r['give_error'] = 8; - $r['give_error_min'] = round( (((( $itm_x['i'] * $itm_user['1price'] ) / $itm_main['iznosMAXi'] ) * $itm_user['iznosMAX']) / 2) , 2); - }else{ - //Все окей - $r['give_item'] = $itm_user['id']; - $r['give_name'] = $itm_main['name']; - $r['give_x'] = $itm_x['i']; - $r['give_price'] = $prc; - $r['give_price_comission'] = $comiss.'.00'; - // - $upd = \Core\Database::query( 'UPDATE `items_users` SET `uid` = 0, `inGroup` = :id WHERE `uid` = :uid AND `item_id` = :item_id AND ( ( `inGroup` > 0 AND `inGroup` = :group ) OR ( `inGroup` = 0 AND `id` = :id ) ) AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0' , - array( - 'uid' => \Core\User::$data['id'], - 'id' => $itm_user['uiid'], - 'item_id' => $itm_main['id'], - 'group' => $itm_user['inGroup'] - ) - ); - if( $upd == true ) { - // - \Core\User::$data['money'] -= $comiss; //$comiss Комиссия - // - \Core\Database::query( 'UPDATE `users` SET `money` = :money WHERE `id` = :uid LIMIT 1' , - array( - 'uid' => \Core\User::$data['id'], - 'money' => \Core\User::$data['money'] - ) - ); - // - /* - ========================================= - Типы предметов: ///////////////////////// - ========================================= - 31 - руна - 32 - ресурсы - 33 - мусор - 34 - прочее - 35 - сумка - 36 - усиление - 37 - упаковка - 38 - подарок - 39 - подарок (требует упаковку) - 40 - книжный прием - 41 - приглашение - 42 - билет - 43 - слот смены - 44 - пергамент (с текстом) - 45 - сумка - 46 - заточка - 47 - усиление 1 - 48 - усиление 2 (временное) - 49 - корм для животного - 60 - бумага - 61 - чек - 62 - чарка - 63 - открытка - 64 - какие-то подарки (пока не придумал) - */ - $point = 24; - $arr_point = array( - 1 => 10, - 2 => 24, // венки на голову - 3 => 11, - 4 => 7, - 5 => 8, - 6 => 9, - 7 => 24, // плащи - 8 => 12, - 9 => 15, - 10 => 16, - 11 => 17, - 12 => 6, - 13 => 14, - 14 => 13, - 15 => 5, - - 18 => 0, - 19 => 1, - 20 => 2, - 21 => 3, - 22 => 4, - - 29 => 18, - 30 => 19, - - 31 => 21, - 62 => 20, - - 32 => 22, - - 49 => 23 - ); - if( isset($arr_point[$itm_main['type']]) ) { - $point = $arr_point[$itm_main['type']]; - } - // - $itm_po = \Core\Item::lookStats( $itm_user['data'] ); - // - \Core\Database::query( 'INSERT INTO `items_com` ( - `uid`,`item_id`,`items_id`,`name`,`level`,`img`,`massa`,`point`,`price`,`time`,`city`,`buy`,`delete`,`iznosNow`,`iznosMax`,`tr_align`,`group` - ) VALUES ( - :uid , :item_id , :items_id , :name , :level , :img , :massa , :point , :price , :time , :city , 0 , 0 , :iznosNOW , :iznosMAX , :align , :group - )' , array( - 'uid' => \Core\User::$data['id'], - 'item_id' => $itm_user['uiid'], - 'items_id' => $itm_main['id'], - 'name' => $itm_main['name'], - 'level' => $itm_po['tr_lvl'], - 'img' => $itm_main['img'], - 'massa' => ($itm_x['i'] * $itm_main['massa']), - 'point' => $point, - 'price' => $r['give_price'], - 'time' => OK, - 'city' => \Core\User::$data['city'], - 'align' => $itm_po['tr_align'], - 'iznosNOW' => $itm_user['iznosNOW'], - 'iznosMAX' => $itm_user['iznosMAX'], - 'group' => $r['give_x'] - )); - }else{ - $r['give_error'] = 9; - } - } - - // - }elseif( isset($_GET['buy_item']) && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK ) { - //Продать предмет - $itm = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `id` = :cid AND `city` = :city AND `items_id` = :items_id AND `delete` = 0 LIMIT 1' , array( - 'cid' => $_GET['buy_item'], - 'items_id' => $_GET['items_id'], - 'city' => \Core\User::$data['city'] - ) , true ); - $itm_user = \Core\Database::query( 'SELECT * FROM `items_users` WHERE `id` = :id AND `uid` = 0 LIMIT 1' , array( - 'id' => $itm['item_id'] - ) , true ); - $user = \Core\Database::query( 'SELECT * FROM `users` WHERE `id` = :id ORDER BY `id` ASC LIMIT 1' , array( - 'id' => $itm['uid'] - ) , true ); - if( !isset($itm['id']) || !isset($itm_user['id']) ) { - //Предмет не найден, возможно его кто-то уже купил - if( isset($itm['id']) ) { - \Core\Database::query( 'UPDATE `items_com` SET `buy` = :uid, `delete` = :delete WHERE `id` = :id LIMIT 1' , array( - 'id' => $itm['id'], - 'uid' => 111, - 'delete' => OK - )); - } - $r['buy_error'] = 1; - }elseif( \Core\User::$data['align'] == 2 ) { - //Хаосникам нельзя пользоваться комиссионным магазином - $r['buy_error'] = 3; - }elseif( \Core\User::$data['level'] < 1 ) { - //Персонажам ниже 1-го уровня запрещено пользоваться комиссионным магазином - $r['buy_error'] = 4; - }elseif( $itm['price'] > \Core\User::$data['money']) { - //У вас недостаточно денег - $r['buy_error'] = 2; - }else{ - //Без ошибок, купили предмет - \Core\Database::query( 'UPDATE `items_com` SET `buy` = :uid, `delete` = :delete WHERE `id` = :id LIMIT 1' , array( - 'id' => $itm['id'], - 'uid' => \Core\User::$data['id'], - 'delete' => OK - )); - // - \Core\Database::query( 'UPDATE `items_users` SET `uid` = :uid, `lastUPD` = :time, `inGroup` = 0 WHERE `id` = :id LIMIT 1' , array( - 'id' => $itm['item_id'], - 'uid' => \Core\User::$data['id'], - 'time' => OK - )); - // - \Core\Database::query( 'UPDATE `items_users` SET `uid` = :uid, `lastUPD` = :time, `inGroup` = 0 WHERE `inGroup` = :id AND `uid` = 0 LIMIT ' . $itm['group'] , array( - 'id' => $itm['item_id'], - 'uid' => \Core\User::$data['id'], - 'time' => OK - )); - \Core\User::$data['money'] -= $itm['price']; - \Core\Database::query( 'UPDATE `users` SET `money` = :money WHERE `id` = :id ORDER BY `id` ASC LIMIT 1' , array( - 'id' => \Core\User::$data['id'], - 'money' => \Core\User::$data['money'] - )); - // - $post_money = round($itm['price']*0.9,2); - if( $itm['group'] > 1 ) { - $itm['name'] .= ' (x'.$itm['group'].')'; - } - \Core\Chat::send_system( $user['login'] , 'Персонаж ' . \Core\User::$data['login'] . ' приобрел вашу вещь "'.$itm['name'].'" из комиссионного магазина за '.$post_money.' кр. (+1 кр. комиссионных). Деньги отправлены к вам на почту.' ); - $post_money += 1; //Комиссионные - // - $tmgo = 1; - \Core\Database::query( 'INSERT INTO `items_users` (`item_id`,`1price`,`uid`,`delete`,`lastUPD`) VALUES ( - 1220 , :money , :uid , 0 , :time - )' , array( - 'uid' => '-51' . $user['id'], - 'money' => $post_money, - 'time' => OK + $tmgo * 60 - )); - $txt = 'Деньги от '.\Core\User::$data['login'].': '.$post_money.' кр. Прибытие: '.date('d.m.Y H:i',(OK + $tmgo*60)).''; - \Core\Database::query( 'INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES - ( :user_to , :user_from , :time , :money , :txt )' , array( - 'user_from' => \Core\User::$data['id'], - 'user_to' => $user['id'], - 'time' => OK, - 'txt' => $txt, - 'money' => $post_money - )); - $txt = 'Деньги к '.$user['login'].': '.$post_money.' кр. Прибытие: '.date('d.m.Y H:i',(OK + $tmgo*60)).''; - \Core\Database::query( 'INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES - ( :user_from , :user_to , :time , :money , :txt )' , array( - 'user_from' => \Core\User::$data['id'], - 'user_to' => $user['id'], - 'time' => OK, - 'txt' => $txt, - 'money' => $post_money - )); - // - $r['buy_error'] = 0; - $r['buy_item'] = $itm['id']; - $r['buy_name'] = $itm['name']; - $r['buy_price'] = $itm['price']; - $r['buy_massa'] = $itm['massa']; - // - $itm_last = \Core\Database::query( 'SELECT COUNT(*) AS `i` FROM `items_com` WHERE `city` = :city AND `items_id` = :items_id AND `delete` = 0 LIMIT 1' , array( - 'items_id' => $_GET['items_id'], - 'city' => \Core\User::$data['city'] - ) , true ); - $r['buy_last'] = $itm_last['i']; - } - }elseif($_GET['point'] == 'give' && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK) { - //Положить предмет - $pl = \Core\Database::query( 'SELECT `id`,`inGroup`,`item_id` FROM `items_users` WHERE `uid` = :uid AND `gift` = "" AND `data` NOT LIKE "%sudba=%" AND `data` NOT LIKE "%zazuby=%" AND `data` NOT LIKE "%|notransfer=%" AND `data` NOT LIKE "%fromshop=2%" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 ORDER BY `lastUPD` DESC' , array( - 'uid' => \Core\User::$data['id'] - ) , true , true ); - // - $i = 0; $j = 0; - while( $i < count($pl) ) { - if( !isset($r['it']['g'][$pl[$i]['item_id']][$pl[$i]['inGroup']]) ) { - $itm = \Core\Item::getItemUser( $pl[$i]['id'] ); - $itm = \Core\Item::infoItem( $itm ); - $itm['iid'] = $pl[$i]['item_id']; - $r['it'][] = $itm; - $j++; - } - if( $pl[$i]['inGroup'] > 0 ) { - $r['it']['g'][$pl[$i]['item_id']][$pl[$i]['inGroup']]++; - } - $i++; - } - $r['it']['i'] = $j; - // - }elseif($_GET['point'] == 'pick' && \Core\User::$data['invBlock'] < OK && \Core\User::$data['allLock'] < OK) { - //Забрать предмет раздел - $pl = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `uid` = :uid AND `city` = :city AND `delete` = 0 ORDER BY `time` DESC' , array( - 'uid' => \Core\User::$data['id'], - 'city' => \Core\User::$data['city'] - ) , true , true ); - // - $i = 0; - // - while( $i < count($pl) ) { - $itm = \Core\Item::getItemUser( $pl[$i]['item_id'] ); - if( !isset($r['it']['n']) ) { - $r['it']['n'] = $itm['name']; - } - $itm = \Core\Item::infoItem( $itm ); - $itm['iid'] = $pl[$i]['items_id']; - $itm['prc'] = $pl[$i]['price']; - $itm['cid'] = $pl[$i]['id']; - $itm['x'] = $pl[$i]['group']; - $itm['timeend'] = date('d.m.Y H:i',( $pl[$i]['time'] + 86400 * 14 )); - $r['it'][] = $itm; - $i++; - } - // - $r['it']['l'] = $_GET['lookIt']; - $r['it']['i'] = $i; - }elseif( $_GET['type'] == 1 ) { - //Просмотр предметов - $pl = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `items_id` = :items_id AND `city` = :city AND `delete` = 0 ORDER BY `price` ASC' , array( - 'items_id' => $_GET['lookIt'], - 'city' => \Core\User::$data['city'] - ) , true , true ); - // - $i = 0; - // - while( $i < count($pl) ) { - $itm = \Core\Item::getItemUser( $pl[$i]['item_id'] ); - if( !isset($r['it']['n']) ) { - $r['it']['n'] = $itm['name']; - } - $itm = \Core\Item::infoItem( $itm ); - $itm['iid'] = $pl[$i]['items_id']; - $itm['prc'] = $pl[$i]['price']; - $itm['cid'] = $pl[$i]['id']; - $itm['x'] = $pl[$i]['group']; - $r['it'][] = $itm; - $i++; - } - // - $r['it']['l'] = $_GET['lookIt']; - $r['it']['i'] = $i; - }elseif( $_GET['type'] == 0 ) { - //Просмотр раздела - $pl = \Core\Database::query( 'SELECT * FROM `items_com` WHERE `point` = :point AND `city` = :city AND `delete` = 0 GROUP BY `items_id` ORDER BY `time` DESC' , array( - 'point' => $_GET['point'], - 'city' => \Core\User::$data['city'] - ) , true , true ); - // - $i = 0; - while( $i < count($pl) ) { - // - $col = \Core\Database::query( 'SELECT COUNT(`id`) AS `i` FROM `items_com` WHERE `items_id` = :iid AND `city` = :city AND `delete` = 0', array( - 'iid' => $pl[$i]['items_id'], - 'city' => \Core\User::$data['city'] - ),true); //количество предметов - $col = $col['i']; - // - $prs1 = \Core\Database::query( 'SELECT `price` AS `i` FROM `items_com` WHERE `items_id` = :iid AND `city` = :city AND `delete` = 0 ORDER BY `price` ASC', array( - 'iid' => $pl[$i]['items_id'], - 'city' => \Core\User::$data['city'] - ),true); //Минимальная цена предмета - $prs1 = $prs1['i']; - // - $prs2 = \Core\Database::query( 'SELECT `price` AS `i` FROM `items_com` WHERE `items_id` = :iid AND `city` = :city AND `delete` = 0 ORDER BY `price` DESC', array( - 'iid' => $pl[$i]['items_id'], - 'city' => \Core\User::$data['city'] - ),true); //Максимальная цена предмета - $prs2 = $prs2['i']; - // - $izns1 = \Core\Database::query( 'SELECT `iznosNow` AS `i`,`iznosMax` AS `j` FROM `items_com` WHERE `items_id` = :iid AND `city` = :city AND `delete` = 0 ORDER BY `iznosMax` ASC', array( - 'iid' => $pl[$i]['items_id'], - 'city' => \Core\User::$data['city'] - ),true); //Минимальная цена предмета - // - $izns2 = \Core\Database::query( 'SELECT `iznosNow` AS `i`,`iznosMax` AS `j` FROM `items_com` WHERE `items_id` = :iid AND `city` = :city AND `delete` = 0 ORDER BY `iznosMax` DESC', array( - 'iid' => $pl[$i]['items_id'], - 'city' => \Core\User::$data['city'] - ),true); //Максимальная цена предмета - // - $r['it'][] = array( - $pl[$i]['id'], - $pl[$i]['items_id'], - array($izns1['i'],$izns2['i']), - array($izns1['j'],$izns2['j']), - $pl[$i]['name'], - $pl[$i]['img'], - $pl[$i]['massa'], - array($prs1,$prs2), - $col, - $pl[$i]['level'] - ); - $i++; - } - $r['it']['i'] = $i; - } - - return \Core\Utils::jsonencode( $r ); - } - -} - -?> \ No newline at end of file diff --git a/core1/app/logic/debuger.php b/core1/app/logic/debuger.php deleted file mode 100644 index 1e6b1375..00000000 --- a/core1/app/logic/debuger.php +++ /dev/null @@ -1,83 +0,0 @@ -главную страницу.'; - }elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) { - echo self::getJSON(); - }else{ - echo self::getHTML(); - } - } - - /* - @ Метод выводящий HTML-контент на сторону пользователя - @ Через конкретный шаблонизатор - */ - public static function getHTML() { - //PC версия главной страницы - // - $skills = array(); - $pl = \Core\Database::query( 'SELECT * FROM `priems` WHERE `activ` = 1 ORDER BY `img` ASC', array( - // - ), true , true ); - $i = 0; - while( $i != -1 ) { - if(!isset($pl[$i])) { - $i = -2; - }else{ - $skills .= ',[' . $pl[$i]['id'] . ',"' . $pl[$i]['img'] . '","' . $pl[$i]['name'] . '"]'; - } - $i++; - } - $skills = ltrim($skills,','); - // - return view::generateTpl( 'debuger', array( - 'title' => COPY . ' :: Вопросы по игре и сдача багов', - - //Передаем данные пакетов - 'user' => \Core\User::$data, - 'stats' => \Core\User::$stats, - 'room' => \Core\User::$room, - - 'OK' => OK, - 'copy' => COPY, - 'rights' => RIGHTS, - - 'skills' => $skills, - - 'ver' => '0.0.1' - ) ); - } - - /* - @ Метод выводящий JSON-контент на сторону пользователя - @ Информация берется из переменной self::$JSON - */ - public static function getJSON() { - $r = array(); - - return \Core\Utils::jsonencode( $r ); - } - -} - -?> \ No newline at end of file diff --git a/core1/index.php b/core1/index.php deleted file mode 100644 index 262340eb..00000000 --- a/core1/index.php +++ /dev/null @@ -1,31 +0,0 @@ - diff --git a/core1/lib/.htaccess b/core1/lib/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/lib/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/lib/Twig/.htaccess b/core1/lib/Twig/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/core1/lib/Twig/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/core1/lib/Twig/Autoloader.php b/core1/lib/Twig/Autoloader.php deleted file mode 100644 index d1e005b1..00000000 --- a/core1/lib/Twig/Autoloader.php +++ /dev/null @@ -1,43 +0,0 @@ - - */ -class Twig_Autoloader -{ - /** - * Registers Twig_Autoloader as an SPL autoloader. - */ - public static function register() - { - ini_set('unserialize_callback_func', 'spl_autoload_call'); - spl_autoload_register(array(new self, 'autoload')); - } - - /** - * Handles autoloading of classes. - * - * @param string $class A class name. - */ - public static function autoload($class) - { - if (0 !== strpos($class, 'Twig')) { - return; - } - - if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { - require $file; - } - } -} diff --git a/core1/lib/Twig/Compiler.php b/core1/lib/Twig/Compiler.php deleted file mode 100644 index 99aecbcc..00000000 --- a/core1/lib/Twig/Compiler.php +++ /dev/null @@ -1,267 +0,0 @@ - - */ -class Twig_Compiler implements Twig_CompilerInterface -{ - protected $lastLine; - protected $source; - protected $indentation; - protected $env; - protected $debugInfo; - protected $sourceOffset; - protected $sourceLine; - protected $filename; - - /** - * Constructor. - * - * @param Twig_Environment $env The twig environment instance - */ - public function __construct(Twig_Environment $env) - { - $this->env = $env; - $this->debugInfo = array(); - } - - public function getFilename() - { - return $this->filename; - } - - /** - * Returns the environment instance related to this compiler. - * - * @return Twig_Environment The environment instance - */ - public function getEnvironment() - { - return $this->env; - } - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource() - { - return $this->source; - } - - /** - * Compiles a node. - * - * @param Twig_NodeInterface $node The node to compile - * @param integer $indentation The current indentation - * - * @return Twig_Compiler The current compiler instance - */ - public function compile(Twig_NodeInterface $node, $indentation = 0) - { - $this->lastLine = null; - $this->source = ''; - $this->sourceOffset = 0; - // source code starts at 1 (as we then increment it when we encounter new lines) - $this->sourceLine = 1; - $this->indentation = $indentation; - - if ($node instanceof Twig_Node_Module) { - $this->filename = $node->getAttribute('filename'); - } - - $node->compile($this); - - return $this; - } - - public function subcompile(Twig_NodeInterface $node, $raw = true) - { - if (false === $raw) { - $this->addIndentation(); - } - - $node->compile($this); - - return $this; - } - - /** - * Adds a raw string to the compiled code. - * - * @param string $string The string - * - * @return Twig_Compiler The current compiler instance - */ - public function raw($string) - { - $this->source .= $string; - - return $this; - } - - /** - * Writes a string to the compiled code by adding indentation. - * - * @return Twig_Compiler The current compiler instance - */ - public function write() - { - $strings = func_get_args(); - foreach ($strings as $string) { - $this->addIndentation(); - $this->source .= $string; - } - - return $this; - } - - /** - * Appends an indentation to the current PHP code after compilation. - * - * @return Twig_Compiler The current compiler instance - */ - public function addIndentation() - { - $this->source .= str_repeat(' ', $this->indentation * 4); - - return $this; - } - - /** - * Adds a quoted string to the compiled code. - * - * @param string $value The string - * - * @return Twig_Compiler The current compiler instance - */ - public function string($value) - { - $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); - - return $this; - } - - /** - * Returns a PHP representation of a given value. - * - * @param mixed $value The value to convert - * - * @return Twig_Compiler The current compiler instance - */ - public function repr($value) - { - if (is_int($value) || is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, 0)) { - setlocale(LC_NUMERIC, 'C'); - } - - $this->raw($value); - - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - } elseif (null === $value) { - $this->raw('null'); - } elseif (is_bool($value)) { - $this->raw($value ? 'true' : 'false'); - } elseif (is_array($value)) { - $this->raw('array('); - $i = 0; - foreach ($value as $key => $value) { - if ($i++) { - $this->raw(', '); - } - $this->repr($key); - $this->raw(' => '); - $this->repr($value); - } - $this->raw(')'); - } else { - $this->string($value); - } - - return $this; - } - - /** - * Adds debugging information. - * - * @param Twig_NodeInterface $node The related twig node - * - * @return Twig_Compiler The current compiler instance - */ - public function addDebugInfo(Twig_NodeInterface $node) - { - if ($node->getLine() != $this->lastLine) { - $this->write("// line {$node->getLine()}\n"); - - // when mbstring.func_overload is set to 2 - // mb_substr_count() replaces substr_count() - // but they have different signatures! - if (((int) ini_get('mbstring.func_overload')) & 2) { - // this is much slower than the "right" version - $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n"); - } else { - $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); - } - $this->sourceOffset = strlen($this->source); - $this->debugInfo[$this->sourceLine] = $node->getLine(); - - $this->lastLine = $node->getLine(); - } - - return $this; - } - - public function getDebugInfo() - { - return $this->debugInfo; - } - - /** - * Indents the generated code. - * - * @param integer $step The number of indentation to add - * - * @return Twig_Compiler The current compiler instance - */ - public function indent($step = 1) - { - $this->indentation += $step; - - return $this; - } - - /** - * Outdents the generated code. - * - * @param integer $step The number of indentation to remove - * - * @return Twig_Compiler The current compiler instance - */ - public function outdent($step = 1) - { - // can't outdent by more steps than the current indentation level - if ($this->indentation < $step) { - throw new LogicException('Unable to call outdent() as the indentation would become negative'); - } - - $this->indentation -= $step; - - return $this; - } -} diff --git a/core1/lib/Twig/CompilerInterface.php b/core1/lib/Twig/CompilerInterface.php deleted file mode 100644 index e293ec91..00000000 --- a/core1/lib/Twig/CompilerInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_CompilerInterface -{ - /** - * Compiles a node. - * - * @param Twig_NodeInterface $node The node to compile - * - * @return Twig_CompilerInterface The current compiler instance - */ - public function compile(Twig_NodeInterface $node); - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource(); -} diff --git a/core1/lib/Twig/Environment.php b/core1/lib/Twig/Environment.php deleted file mode 100644 index 04339e40..00000000 --- a/core1/lib/Twig/Environment.php +++ /dev/null @@ -1,1217 +0,0 @@ - - */ -class Twig_Environment -{ - const VERSION = '1.12.3-DEV'; - - protected $charset; - protected $loader; - protected $debug; - protected $autoReload; - protected $cache; - protected $lexer; - protected $parser; - protected $compiler; - protected $baseTemplateClass; - protected $extensions; - protected $parsers; - protected $visitors; - protected $filters; - protected $tests; - protected $functions; - protected $globals; - protected $runtimeInitialized; - protected $extensionInitialized; - protected $loadedTemplates; - protected $strictVariables; - protected $unaryOperators; - protected $binaryOperators; - protected $templateClassPrefix = '__TwigTemplate_'; - protected $functionCallbacks; - protected $filterCallbacks; - protected $staging; - - /** - * Constructor. - * - * Available options: - * - * * debug: When set to true, it automatically set "auto_reload" to true as - * well (default to false). - * - * * charset: The charset used by the templates (default to utf-8). - * - * * base_template_class: The base template class to use for generated - * templates (default to Twig_Template). - * - * * cache: An absolute path where to store the compiled templates, or - * false to disable compilation cache (default). - * - * * auto_reload: Whether to reload the template is the original source changed. - * If you don't provide the auto_reload option, it will be - * determined automatically base on the debug value. - * - * * strict_variables: Whether to ignore invalid variables in templates - * (default to false). - * - * * autoescape: Whether to enable auto-escaping (default to html): - * * false: disable auto-escaping - * * true: equivalent to html - * * html, js: set the autoescaping to one of the supported strategies - * * PHP callback: a PHP callback that returns an escaping strategy based on the template "filename" - * - * * optimizations: A flag that indicates which optimizations to apply - * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable). - * - * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance - * @param array $options An array of options - */ - public function __construct(Twig_LoaderInterface $loader = null, $options = array()) - { - if (null !== $loader) { - $this->setLoader($loader); - } - - $options = array_merge(array( - 'debug' => false, - 'charset' => 'UTF-8', - 'base_template_class' => 'Twig_Template', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - ), $options); - - $this->debug = (bool) $options['debug']; - $this->charset = $options['charset']; - $this->baseTemplateClass = $options['base_template_class']; - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; - $this->runtimeInitialized = false; - $this->setCache($options['cache']); - $this->functionCallbacks = array(); - $this->filterCallbacks = array(); - - $this->addExtension(new Twig_Extension_Core()); - $this->addExtension(new Twig_Extension_Escaper($options['autoescape'])); - $this->addExtension(new Twig_Extension_Optimizer($options['optimizations'])); - $this->extensionInitialized = false; - $this->staging = new Twig_Extension_Staging(); - } - - /** - * Gets the base template class for compiled templates. - * - * @return string The base template class name - */ - public function getBaseTemplateClass() - { - return $this->baseTemplateClass; - } - - /** - * Sets the base template class for compiled templates. - * - * @param string $class The base template class name - */ - public function setBaseTemplateClass($class) - { - $this->baseTemplateClass = $class; - } - - /** - * Enables debugging mode. - */ - public function enableDebug() - { - $this->debug = true; - } - - /** - * Disables debugging mode. - */ - public function disableDebug() - { - $this->debug = false; - } - - /** - * Checks if debug mode is enabled. - * - * @return Boolean true if debug mode is enabled, false otherwise - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Enables the auto_reload option. - */ - public function enableAutoReload() - { - $this->autoReload = true; - } - - /** - * Disables the auto_reload option. - */ - public function disableAutoReload() - { - $this->autoReload = false; - } - - /** - * Checks if the auto_reload option is enabled. - * - * @return Boolean true if auto_reload is enabled, false otherwise - */ - public function isAutoReload() - { - return $this->autoReload; - } - - /** - * Enables the strict_variables option. - */ - public function enableStrictVariables() - { - $this->strictVariables = true; - } - - /** - * Disables the strict_variables option. - */ - public function disableStrictVariables() - { - $this->strictVariables = false; - } - - /** - * Checks if the strict_variables option is enabled. - * - * @return Boolean true if strict_variables is enabled, false otherwise - */ - public function isStrictVariables() - { - return $this->strictVariables; - } - - /** - * Gets the cache directory or false if cache is disabled. - * - * @return string|false - */ - public function getCache() - { - return $this->cache; - } - - /** - * Sets the cache directory or false if cache is disabled. - * - * @param string|false $cache The absolute path to the compiled templates, - * or false to disable cache - */ - public function setCache($cache) - { - $this->cache = $cache ? $cache : false; - } - - /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * - * @return string The cache file name - */ - public function getCacheFilename($name) - { - if (false === $this->cache) { - return false; - } - - $class = substr($this->getTemplateClass($name), strlen($this->templateClassPrefix)); - - return $this->getCache().'/'.substr($class, 0, 2).'/'.substr($class, 2, 2).'/'.substr($class, 4).'.php'; - } - - /** - * Gets the template class associated with the given string. - * - * @param string $name The name for which to calculate the template class name - * @param integer $index The index if it is an embedded template - * - * @return string The template class name - */ - public function getTemplateClass($name, $index = null) - { - return $this->templateClassPrefix.md5($this->getLoader()->getCacheKey($name)).(null === $index ? '' : '_'.$index); - } - - /** - * Gets the template class prefix. - * - * @return string The template class prefix - */ - public function getTemplateClassPrefix() - { - return $this->templateClassPrefix; - } - - /** - * Renders a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - */ - public function render($name, array $context = array()) - { - return $this->loadTemplate($name)->render($context); - } - - /** - * Displays a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - */ - public function display($name, array $context = array()) - { - $this->loadTemplate($name)->display($context); - } - - /** - * Loads a template by name. - * - * @param string $name The template name - * @param integer $index The index if it is an embedded template - * - * @return Twig_TemplateInterface A template instance representing the given template name - */ - public function loadTemplate($name, $index = null) - { - $cls = $this->getTemplateClass($name, $index); - - if (isset($this->loadedTemplates[$cls])) { - return $this->loadedTemplates[$cls]; - } - - if (!class_exists($cls, false)) { - if (false === $cache = $this->getCacheFilename($name)) { - eval('?>'.$this->compileSource($this->getLoader()->getSource($name), $name)); - } else { - if (!is_file($cache) || ($this->isAutoReload() && !$this->isTemplateFresh($name, filemtime($cache)))) { - $this->writeCacheFile($cache, $this->compileSource($this->getLoader()->getSource($name), $name)); - } - - require_once $cache; - } - } - - if (!$this->runtimeInitialized) { - $this->initRuntime(); - } - - return $this->loadedTemplates[$cls] = new $cls($this); - } - - /** - * Returns true if the template is still fresh. - * - * Besides checking the loader for freshness information, - * this method also checks if the enabled extensions have - * not changed. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template - * - * @return Boolean true if the template is fresh, false otherwise - */ - public function isTemplateFresh($name, $time) - { - foreach ($this->extensions as $extension) { - $r = new ReflectionObject($extension); - if (filemtime($r->getFileName()) > $time) { - return false; - } - } - - return $this->getLoader()->isFresh($name, $time); - } - - public function resolveTemplate($names) - { - if (!is_array($names)) { - $names = array($names); - } - - foreach ($names as $name) { - if ($name instanceof Twig_Template) { - return $name; - } - - try { - return $this->loadTemplate($name); - } catch (Twig_Error_Loader $e) { - } - } - - if (1 === count($names)) { - throw $e; - } - - throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); - } - - /** - * Clears the internal template cache. - */ - public function clearTemplateCache() - { - $this->loadedTemplates = array(); - } - - /** - * Clears the template cache files on the filesystem. - */ - public function clearCacheFiles() - { - if (false === $this->cache) { - return; - } - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->cache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($file->isFile()) { - @unlink($file->getPathname()); - } - } - } - - /** - * Gets the Lexer instance. - * - * @return Twig_LexerInterface A Twig_LexerInterface instance - */ - public function getLexer() - { - if (null === $this->lexer) { - $this->lexer = new Twig_Lexer($this); - } - - return $this->lexer; - } - - /** - * Sets the Lexer instance. - * - * @param Twig_LexerInterface A Twig_LexerInterface instance - */ - public function setLexer(Twig_LexerInterface $lexer) - { - $this->lexer = $lexer; - } - - /** - * Tokenizes a source code. - * - * @param string $source The template source code - * @param string $name The template name - * - * @return Twig_TokenStream A Twig_TokenStream instance - */ - public function tokenize($source, $name = null) - { - return $this->getLexer()->tokenize($source, $name); - } - - /** - * Gets the Parser instance. - * - * @return Twig_ParserInterface A Twig_ParserInterface instance - */ - public function getParser() - { - if (null === $this->parser) { - $this->parser = new Twig_Parser($this); - } - - return $this->parser; - } - - /** - * Sets the Parser instance. - * - * @param Twig_ParserInterface A Twig_ParserInterface instance - */ - public function setParser(Twig_ParserInterface $parser) - { - $this->parser = $parser; - } - - /** - * Parses a token stream. - * - * @param Twig_TokenStream $tokens A Twig_TokenStream instance - * - * @return Twig_Node_Module A Node tree - */ - public function parse(Twig_TokenStream $tokens) - { - return $this->getParser()->parse($tokens); - } - - /** - * Gets the Compiler instance. - * - * @return Twig_CompilerInterface A Twig_CompilerInterface instance - */ - public function getCompiler() - { - if (null === $this->compiler) { - $this->compiler = new Twig_Compiler($this); - } - - return $this->compiler; - } - - /** - * Sets the Compiler instance. - * - * @param Twig_CompilerInterface $compiler A Twig_CompilerInterface instance - */ - public function setCompiler(Twig_CompilerInterface $compiler) - { - $this->compiler = $compiler; - } - - /** - * Compiles a Node. - * - * @param Twig_NodeInterface $node A Twig_NodeInterface instance - * - * @return string The compiled PHP source code - */ - public function compile(Twig_NodeInterface $node) - { - return $this->getCompiler()->compile($node)->getSource(); - } - - /** - * Compiles a template source code. - * - * @param string $source The template source code - * @param string $name The template name - * - * @return string The compiled PHP source code - */ - public function compileSource($source, $name = null) - { - try { - return $this->compile($this->parse($this->tokenize($source, $name))); - } catch (Twig_Error $e) { - $e->setTemplateFile($name); - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $name, $e); - } - } - - /** - * Sets the Loader instance. - * - * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance - */ - public function setLoader(Twig_LoaderInterface $loader) - { - $this->loader = $loader; - } - - /** - * Gets the Loader instance. - * - * @return Twig_LoaderInterface A Twig_LoaderInterface instance - */ - public function getLoader() - { - if (null === $this->loader) { - throw new LogicException('You must set a loader first.'); - } - - return $this->loader; - } - - /** - * Sets the default template charset. - * - * @param string $charset The default charset - */ - public function setCharset($charset) - { - $this->charset = $charset; - } - - /** - * Gets the default template charset. - * - * @return string The default charset - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Initializes the runtime environment. - */ - public function initRuntime() - { - $this->runtimeInitialized = true; - - foreach ($this->getExtensions() as $extension) { - $extension->initRuntime($this); - } - } - - /** - * Returns true if the given extension is registered. - * - * @param string $name The extension name - * - * @return Boolean Whether the extension is registered or not - */ - public function hasExtension($name) - { - return isset($this->extensions[$name]); - } - - /** - * Gets an extension by name. - * - * @param string $name The extension name - * - * @return Twig_ExtensionInterface A Twig_ExtensionInterface instance - */ - public function getExtension($name) - { - if (!isset($this->extensions[$name])) { - throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $name)); - } - - return $this->extensions[$name]; - } - - /** - * Registers an extension. - * - * @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance - */ - public function addExtension(Twig_ExtensionInterface $extension) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); - } - - $this->extensions[$extension->getName()] = $extension; - } - - /** - * Removes an extension by name. - * - * This method is deprecated and you should not use it. - * - * @param string $name The extension name - * - * @deprecated since 1.12 (to be removed in 2.0) - */ - public function removeExtension($name) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); - } - - unset($this->extensions[$name]); - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - foreach ($extensions as $extension) { - $this->addExtension($extension); - } - } - - /** - * Returns all registered extensions. - * - * @return array An array of extensions - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Registers a Token Parser. - * - * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance - */ - public function addTokenParser(Twig_TokenParserInterface $parser) - { - if ($this->extensionInitialized) { - throw new LogicException('Unable to add a token parser as extensions have already been initialized.'); - } - - $this->staging->addTokenParser($parser); - } - - /** - * Gets the registered Token Parsers. - * - * @return Twig_TokenParserBrokerInterface A broker containing token parsers - */ - public function getTokenParsers() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->parsers; - } - - /** - * Gets registered tags. - * - * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes. - * - * @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances - */ - public function getTags() - { - $tags = array(); - foreach ($this->getTokenParsers()->getParsers() as $parser) { - if ($parser instanceof Twig_TokenParserInterface) { - $tags[$parser->getTag()] = $parser; - } - } - - return $tags; - } - - /** - * Registers a Node Visitor. - * - * @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance - */ - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - if ($this->extensionInitialized) { - throw new LogicException('Unable to add a node visitor as extensions have already been initialized.', $extension->getName()); - } - - $this->staging->addNodeVisitor($visitor); - } - - /** - * Gets the registered Node Visitors. - * - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->visitors; - } - - /** - * Registers a Filter. - * - * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance - * @param Twig_FilterInterface|Twig_SimpleFilter $filter A Twig_FilterInterface instance or a Twig_SimpleFilter instance - */ - public function addFilter($name, $filter = null) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); - } - - if (!$name instanceof Twig_SimpleFilter && !($filter instanceof Twig_SimpleFilter || $filter instanceof Twig_FilterInterface)) { - throw new LogicException('A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter'); - } - - if ($name instanceof Twig_SimpleFilter) { - $filter = $name; - $name = $filter->getName(); - } - - $this->staging->addFilter($name, $filter); - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist - */ - public function getFilter($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->filters[$name])) { - return $this->filters[$name]; - } - - foreach ($this->filters as $pattern => $filter) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $filter->setArguments($matches); - - return $filter; - } - } - } - - foreach ($this->filterCallbacks as $callback) { - if (false !== $filter = call_user_func($callback, $name)) { - return $filter; - } - } - - return false; - } - - public function registerUndefinedFilterCallback($callable) - { - $this->filterCallbacks[] = $callable; - } - - /** - * Gets the registered Filters. - * - * Be warned that this method cannot return filters defined with registerUndefinedFunctionCallback. - * - * @return Twig_FilterInterface[] An array of Twig_FilterInterface instances - * - * @see registerUndefinedFilterCallback - */ - public function getFilters() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->filters; - } - - /** - * Registers a Test. - * - * @param string|Twig_SimpleTest $name The test name or a Twig_SimpleTest instance - * @param Twig_TestInterface|Twig_SimpleTest $test A Twig_TestInterface instance or a Twig_SimpleTest instance - */ - public function addTest($name, $test = null) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); - } - - if (!$name instanceof Twig_SimpleTest && !($test instanceof Twig_SimpleTest || $test instanceof Twig_TestInterface)) { - throw new LogicException('A test must be an instance of Twig_TestInterface or Twig_SimpleTest'); - } - - if ($name instanceof Twig_SimpleTest) { - $test = $name; - $name = $test->getName(); - } - - $this->staging->addTest($name, $test); - } - - /** - * Gets the registered Tests. - * - * @return Twig_TestInterface[] An array of Twig_TestInterface instances - */ - public function getTests() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->tests; - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return Twig_Test|false A Twig_Test instance or false if the test does not exist - */ - public function getTest($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->tests[$name])) { - return $this->tests[$name]; - } - - return false; - } - - /** - * Registers a Function. - * - * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance - * @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance - */ - public function addFunction($name, $function = null) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); - } - - if (!$name instanceof Twig_SimpleFunction && !($function instanceof Twig_SimpleFunction || $function instanceof Twig_FunctionInterface)) { - throw new LogicException('A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction'); - } - - if ($name instanceof Twig_SimpleFunction) { - $function = $name; - $name = $function->getName(); - } - - $this->staging->addFunction($name, $function); - } - - /** - * Get a function by name. - * - * Subclasses may override this method and load functions differently; - * so no list of functions is available. - * - * @param string $name function name - * - * @return Twig_Function|false A Twig_Function instance or false if the function does not exist - */ - public function getFunction($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->functions[$name])) { - return $this->functions[$name]; - } - - foreach ($this->functions as $pattern => $function) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $function->setArguments($matches); - - return $function; - } - } - } - - foreach ($this->functionCallbacks as $callback) { - if (false !== $function = call_user_func($callback, $name)) { - return $function; - } - } - - return false; - } - - public function registerUndefinedFunctionCallback($callable) - { - $this->functionCallbacks[] = $callable; - } - - /** - * Gets registered functions. - * - * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. - * - * @return Twig_FunctionInterface[] An array of Twig_FunctionInterface instances - * - * @see registerUndefinedFunctionCallback - */ - public function getFunctions() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->functions; - } - - /** - * Registers a Global. - * - * New globals can be added before compiling or rendering a template; - * but after, you can only update existing globals. - * - * @param string $name The global name - * @param mixed $value The global value - */ - public function addGlobal($name, $value) - { - if ($this->extensionInitialized || $this->runtimeInitialized) { - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - /* This condition must be uncommented in Twig 2.0 - if (!array_key_exists($name, $this->globals)) { - throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); - } - */ - } - - if ($this->extensionInitialized || $this->runtimeInitialized) { - // update the value - $this->globals[$name] = $value; - } else { - $this->staging->addGlobal($name, $value); - } - } - - /** - * Gets the registered Globals. - * - * @return array An array of globals - */ - public function getGlobals() - { - if (!$this->runtimeInitialized && !$this->extensionInitialized) { - return $this->initGlobals(); - } - - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - return $this->globals; - } - - /** - * Merges a context with the defined globals. - * - * @param array $context An array representing the context - * - * @return array The context merged with the globals - */ - public function mergeGlobals(array $context) - { - // we don't use array_merge as the context being generally - // bigger than globals, this code is faster. - foreach ($this->getGlobals() as $key => $value) { - if (!array_key_exists($key, $context)) { - $context[$key] = $value; - } - } - - return $context; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - */ - public function getUnaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - */ - public function getBinaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->binaryOperators; - } - - public function computeAlternatives($name, $items) - { - $alternatives = array(); - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - asort($alternatives); - - return array_keys($alternatives); - } - - protected function initGlobals() - { - $globals = array(); - foreach ($this->extensions as $extension) { - $globals = array_merge($globals, $extension->getGlobals()); - } - - return array_merge($globals, $this->staging->getGlobals()); - } - - protected function initExtensions() - { - if ($this->extensionInitialized) { - return; - } - - $this->extensionInitialized = true; - $this->parsers = new Twig_TokenParserBroker(); - $this->filters = array(); - $this->functions = array(); - $this->tests = array(); - $this->visitors = array(); - $this->unaryOperators = array(); - $this->binaryOperators = array(); - - foreach ($this->extensions as $extension) { - $this->initExtension($extension); - } - $this->initExtension($this->staging); - } - - protected function initExtension(Twig_ExtensionInterface $extension) - { - // filters - foreach ($extension->getFilters() as $name => $filter) { - if ($name instanceof Twig_SimpleFilter) { - $filter = $name; - $name = $filter->getName(); - } elseif ($filter instanceof Twig_SimpleFilter) { - $name = $filter->getName(); - } - - $this->filters[$name] = $filter; - } - - // functions - foreach ($extension->getFunctions() as $name => $function) { - if ($name instanceof Twig_SimpleFunction) { - $function = $name; - $name = $function->getName(); - } elseif ($function instanceof Twig_SimpleFunction) { - $name = $function->getName(); - } - - $this->functions[$name] = $function; - } - - // tests - foreach ($extension->getTests() as $name => $test) { - if ($name instanceof Twig_SimpleTest) { - $test = $name; - $name = $test->getName(); - } elseif ($test instanceof Twig_SimpleTest) { - $name = $test->getName(); - } - - $this->tests[$name] = $test; - } - - // token parsers - foreach ($extension->getTokenParsers() as $parser) { - if ($parser instanceof Twig_TokenParserInterface) { - $this->parsers->addTokenParser($parser); - } elseif ($parser instanceof Twig_TokenParserBrokerInterface) { - $this->parsers->addTokenParserBroker($parser); - } else { - throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances'); - } - } - - // node visitors - foreach ($extension->getNodeVisitors() as $visitor) { - $this->visitors[] = $visitor; - } - - // operators - if ($operators = $extension->getOperators()) { - if (2 !== count($operators)) { - throw new InvalidArgumentException(sprintf('"%s::getOperators()" does not return a valid operators array.', get_class($extension))); - } - - $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); - $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); - } - } - - protected function writeCacheFile($file, $content) - { - $dir = dirname($file); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir)); - } - } elseif (!is_writable($dir)) { - throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir)); - } - - $tmpFile = tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, $content)) { - // rename does not work on Win32 before 5.2.6 - if (@rename($tmpFile, $file) || (@copy($tmpFile, $file) && unlink($tmpFile))) { - @chmod($file, 0666 & ~umask()); - - return; - } - } - - throw new RuntimeException(sprintf('Failed to write cache file "%s".', $file)); - } -} diff --git a/core1/lib/Twig/Error.php b/core1/lib/Twig/Error.php deleted file mode 100644 index e77ec98d..00000000 --- a/core1/lib/Twig/Error.php +++ /dev/null @@ -1,232 +0,0 @@ - - */ -class Twig_Error extends Exception -{ - protected $lineno; - protected $filename; - protected $rawMessage; - protected $previous; - - /** - * Constructor. - * - * Set both the line number and the filename to false to - * disable automatic guessing of the original template name - * and line number. - * - * Set the line number to -1 to enable its automatic guessing. - * Set the filename to null to enable its automatic guessing. - * - * By default, automatic guessing is enabled. - * - * @param string $message The error message - * @param integer $lineno The template line where the error occurred - * @param string $filename The template file name where the error occurred - * @param Exception $previous The previous exception - */ - public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) - { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - $this->previous = $previous; - parent::__construct(''); - } else { - parent::__construct('', 0, $previous); - } - - $this->lineno = $lineno; - $this->filename = $filename; - - if (-1 === $this->lineno || null === $this->filename) { - $this->guessTemplateInfo(); - } - - $this->rawMessage = $message; - - $this->updateRepr(); - } - - /** - * Gets the raw message. - * - * @return string The raw message - */ - public function getRawMessage() - { - return $this->rawMessage; - } - - /** - * Gets the filename where the error occurred. - * - * @return string The filename - */ - public function getTemplateFile() - { - return $this->filename; - } - - /** - * Sets the filename where the error occurred. - * - * @param string $filename The filename - */ - public function setTemplateFile($filename) - { - $this->filename = $filename; - - $this->updateRepr(); - } - - /** - * Gets the template line where the error occurred. - * - * @return integer The template line - */ - public function getTemplateLine() - { - return $this->lineno; - } - - /** - * Sets the template line where the error occurred. - * - * @param integer $lineno The template line - */ - public function setTemplateLine($lineno) - { - $this->lineno = $lineno; - - $this->updateRepr(); - } - - public function guess() - { - $this->guessTemplateInfo(); - $this->updateRepr(); - } - - /** - * For PHP < 5.3.0, provides access to the getPrevious() method. - * - * @param string $method The method name - * @param array $arguments The parameters to be passed to the method - * - * @return Exception The previous exception or null - * - * @throws BadMethodCallException - */ - public function __call($method, $arguments) - { - if ('getprevious' == strtolower($method)) { - return $this->previous; - } - - throw new BadMethodCallException(sprintf('Method "Twig_Error::%s()" does not exist.', $method)); - } - - protected function updateRepr() - { - $this->message = $this->rawMessage; - - $dot = false; - if ('.' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - if ($this->filename) { - if (is_string($this->filename) || (is_object($this->filename) && method_exists($this->filename, '__toString'))) { - $filename = sprintf('"%s"', $this->filename); - } else { - $filename = json_encode($this->filename); - } - $this->message .= sprintf(' in %s', $filename); - } - - if ($this->lineno && $this->lineno >= 0) { - $this->message .= sprintf(' at line %d', $this->lineno); - } - - if ($dot) { - $this->message .= '.'; - } - } - - protected function guessTemplateInfo() - { - $template = null; - foreach (debug_backtrace() as $trace) { - if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { - if (null === $this->filename || $this->filename == $trace['object']->getTemplateName()) { - $template = $trace['object']; - } - } - } - - // update template filename - if (null !== $template && null === $this->filename) { - $this->filename = $template->getTemplateName(); - } - - if (null === $template || $this->lineno > -1) { - return; - } - - $r = new ReflectionObject($template); - $file = $r->getFileName(); - - $exceptions = array($e = $this); - while (($e instanceof self || method_exists($e, 'getPrevious')) && $e = $e->getPrevious()) { - $exceptions[] = $e; - } - - while ($e = array_pop($exceptions)) { - $traces = $e->getTrace(); - while ($trace = array_shift($traces)) { - if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { - continue; - } - - foreach ($template->getDebugInfo() as $codeLine => $templateLine) { - if ($codeLine <= $trace['line']) { - // update template line - $this->lineno = $templateLine; - - return; - } - } - } - } - } -} diff --git a/core1/lib/Twig/Error/Loader.php b/core1/lib/Twig/Error/Loader.php deleted file mode 100644 index 68efb574..00000000 --- a/core1/lib/Twig/Error/Loader.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Twig_Error_Loader extends Twig_Error -{ - public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, false, false, $previous); - } -} diff --git a/core1/lib/Twig/Error/Runtime.php b/core1/lib/Twig/Error/Runtime.php deleted file mode 100644 index 8b6ceddb..00000000 --- a/core1/lib/Twig/Error/Runtime.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -class Twig_Error_Runtime extends Twig_Error -{ -} diff --git a/core1/lib/Twig/Error/Syntax.php b/core1/lib/Twig/Error/Syntax.php deleted file mode 100644 index 0f5c5792..00000000 --- a/core1/lib/Twig/Error/Syntax.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -class Twig_Error_Syntax extends Twig_Error -{ -} diff --git a/core1/lib/Twig/ExistsLoaderInterface.php b/core1/lib/Twig/ExistsLoaderInterface.php deleted file mode 100644 index ce434765..00000000 --- a/core1/lib/Twig/ExistsLoaderInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_ExistsLoaderInterface -{ - /** - * Check if we have the source code of a template, given its name. - * - * @param string $name The name of the template to check if we can load - * - * @return boolean If the template source code is handled by this loader or not - */ - public function exists($name); -} diff --git a/core1/lib/Twig/ExpressionParser.php b/core1/lib/Twig/ExpressionParser.php deleted file mode 100644 index f4d16cc7..00000000 --- a/core1/lib/Twig/ExpressionParser.php +++ /dev/null @@ -1,600 +0,0 @@ - - */ -class Twig_ExpressionParser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; - - protected $parser; - protected $unaryOperators; - protected $binaryOperators; - - public function __construct(Twig_Parser $parser, array $unaryOperators, array $binaryOperators) - { - $this->parser = $parser; - $this->unaryOperators = $unaryOperators; - $this->binaryOperators = $binaryOperators; - } - - public function parseExpression($precedence = 0) - { - $expr = $this->getPrimary(); - $token = $this->parser->getCurrentToken(); - while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - - if (isset($op['callable'])) { - $expr = call_user_func($op['callable'], $this->parser, $expr); - } else { - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $class = $op['class']; - $expr = new $class($expr, $expr1, $token->getLine()); - } - - $token = $this->parser->getCurrentToken(); - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - protected function getPrimary() - { - $token = $this->parser->getCurrentToken(); - - if ($this->isUnary($token)) { - $operator = $this->unaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - $expr = $this->parseExpression($operator['precedence']); - $class = $operator['class']; - - return $this->parsePostfixExpression(new $class($expr, $token->getLine())); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - protected function parseConditionalExpression($expr) - { - while ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '?')) { - $this->parser->getStream()->next(); - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $this->parser->getStream()->next(); - $expr3 = $this->parseExpression(); - } else { - $expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine()); - } - } else { - $this->parser->getStream()->next(); - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new Twig_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); - } - - return $expr; - } - - protected function isUnary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); - } - - protected function isBinary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case Twig_Token::NAME_TYPE: - $this->parser->getStream()->next(); - switch ($token->getValue()) { - case 'true': - case 'TRUE': - $node = new Twig_Node_Expression_Constant(true, $token->getLine()); - break; - - case 'false': - case 'FALSE': - $node = new Twig_Node_Expression_Constant(false, $token->getLine()); - break; - - case 'none': - case 'NONE': - case 'null': - case 'NULL': - $node = new Twig_Node_Expression_Constant(null, $token->getLine()); - break; - - default: - if ('(' === $this->parser->getCurrentToken()->getValue()) { - $node = $this->getFunctionNode($token->getValue(), $token->getLine()); - } else { - $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine()); - } - } - break; - - case Twig_Token::NUMBER_TYPE: - $this->parser->getStream()->next(); - $node = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - break; - - case Twig_Token::STRING_TYPE: - case Twig_Token::INTERPOLATION_START_TYPE: - $node = $this->parseStringExpression(); - break; - - default: - if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseHashExpression(); - } else { - throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($token->getType(), $token->getLine()), $token->getValue()), $token->getLine(), $this->parser->getFilename()); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseStringExpression() - { - $stream = $this->parser->getStream(); - - $nodes = array(); - // a string cannot be followed by another string in a single expression - $nextCanBeString = true; - while (true) { - if ($stream->test(Twig_Token::STRING_TYPE) && $nextCanBeString) { - $token = $stream->next(); - $nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->test(Twig_Token::INTERPOLATION_START_TYPE)) { - $stream->next(); - $nodes[] = $this->parseExpression(); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new Twig_Node_Expression_Binary_Concat($expr, $node, $node->getLine()); - } - - return $expr; - } - - public function parseArrayExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if ($stream->test(Twig_Token::STRING_TYPE) || $stream->test(Twig_Token::NAME_TYPE) || $stream->test(Twig_Token::NUMBER_TYPE)) { - $token = $stream->next(); - $key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - } elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($current->getType(), $current->getLine()), $current->getValue()), $current->getLine(), $this->parser->getFilename()); - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - while (true) { - $token = $this->parser->getCurrentToken(); - if ($token->getType() == Twig_Token::PUNCTUATION_TYPE) { - if ('.' == $token->getValue() || '[' == $token->getValue()) { - $node = $this->parseSubscriptExpression($node); - } elseif ('|' == $token->getValue()) { - $node = $this->parseFilterExpression($node); - } else { - break; - } - } else { - break; - } - } - - return $node; - } - - public function getFunctionNode($name, $line) - { - switch ($name) { - case 'parent': - $args = $this->parseArguments(); - if (!count($this->parser->getBlockStack())) { - throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden', $line, $this->parser->getFilename()); - } - - if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden', $line, $this->parser->getFilename()); - } - - return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line); - case 'block': - return new Twig_Node_Expression_BlockReference($this->parseArguments()->getNode(0), false, $line); - case 'attribute': - $args = $this->parseArguments(); - if (count($args) < 2) { - throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes)', $line, $this->parser->getFilename()); - } - - return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : new Twig_Node_Expression_Array(array(), $line), Twig_TemplateInterface::ANY_CALL, $line); - default: - if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { - $arguments = new Twig_Node_Expression_Array(array(), $line); - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - - $node = new Twig_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line); - $node->setAttribute('safe', true); - - return $node; - } - - $args = $this->parseArguments(true); - $class = $this->getFunctionNodeClass($name, $line); - - return new $class($name, $args, $line); - } - } - - public function parseSubscriptExpression($node) - { - $stream = $this->parser->getStream(); - $token = $stream->next(); - $lineno = $token->getLine(); - $arguments = new Twig_Node_Expression_Array(array(), $lineno); - $type = Twig_TemplateInterface::ANY_CALL; - if ($token->getValue() == '.') { - $token = $stream->next(); - if ( - $token->getType() == Twig_Token::NAME_TYPE - || - $token->getType() == Twig_Token::NUMBER_TYPE - || - ($token->getType() == Twig_Token::OPERATOR_TYPE && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); - - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $type = Twig_TemplateInterface::METHOD_CALL; - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - } - } else { - throw new Twig_Error_Syntax('Expected name or number', $lineno, $this->parser->getFilename()); - } - - if ($node instanceof Twig_Node_Expression_Name && null !== $alias = $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { - if (!$arg instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s")', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); - } - - $node = new Twig_Node_Expression_MethodCall($node, 'get'.$arg->getAttribute('value'), $arguments, $lineno); - $node->setAttribute('safe', true); - - return $node; - } - } else { - $type = Twig_TemplateInterface::ARRAY_CALL; - - // slice? - $slice = false; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - $arg = new Twig_Node_Expression_Constant(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - $stream->next(); - } - - if ($slice) { - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - $length = new Twig_Node_Expression_Constant(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $class = $this->getFilterNodeClass('slice', $token->getLine()); - $arguments = new Twig_Node(array($arg, $length)); - $filter = new $class($node, new Twig_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine()); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - - return $filter; - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - } - - return new Twig_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node, $tag = null) - { - while (true) { - $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE); - - $name = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = new Twig_Node(); - } else { - $arguments = $this->parseArguments(true); - } - - $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); - - $node = new $class($node, $name, $arguments, $token->getLine(), $tag); - - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '|')) { - break; - } - - $this->parser->getStream()->next(); - } - - return $node; - } - - /** - * Parses arguments. - * - * @param Boolean $namedArguments Whether to allow named arguments or not - * @param Boolean $definition Whether we are parsing arguments for a function definition - */ - public function parseArguments($namedArguments = false, $definition = false) - { - $args = array(); - $stream = $this->parser->getStream(); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); - } - - if ($definition) { - $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'An argument must be a name'); - $value = new Twig_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine()); - } else { - $value = $this->parseExpression(); - } - - $name = null; - if ($namedArguments && $stream->test(Twig_Token::OPERATOR_TYPE, '=')) { - $token = $stream->next(); - if (!$value instanceof Twig_Node_Expression_Name) { - throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given', get_class($value)), $token->getLine(), $this->parser->getFilename()); - } - $name = $value->getAttribute('name'); - - if ($definition) { - $value = $this->parsePrimaryExpression(); - - if (!$this->checkConstantExpression($value)) { - throw new Twig_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $this->parser->getFilename()); - } - } else { - $value = $this->parseExpression(); - } - } - - if ($definition) { - if (null === $name) { - $name = $value->getAttribute('name'); - $value = new Twig_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine()); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Twig_Node($args); - } - - public function parseAssignmentExpression() - { - $targets = array(); - while (true) { - $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to'); - if (in_array($token->getValue(), array('true', 'false', 'none'))) { - throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s"', $token->getValue()), $token->getLine(), $this->parser->getFilename()); - } - $targets[] = new Twig_Node_Expression_AssignName($token->getValue(), $token->getLine()); - - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - $this->parser->getStream()->next(); - } - - return new Twig_Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = array(); - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - $this->parser->getStream()->next(); - } - - return new Twig_Node($targets); - } - - protected function getFunctionNodeClass($name, $line) - { - $env = $this->parser->getEnvironment(); - - if (false === $function = $env->getFunction($name)) { - $message = sprintf('The function "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFunctions()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } - - throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); - } - - if ($function instanceof Twig_SimpleFunction) { - return $function->getNodeClass(); - } - - return $function instanceof Twig_Function_Node ? $function->getClass() : 'Twig_Node_Expression_Function'; - } - - protected function getFilterNodeClass($name, $line) - { - $env = $this->parser->getEnvironment(); - - if (false === $filter = $env->getFilter($name)) { - $message = sprintf('The filter "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFilters()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } - - throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); - } - - if ($filter instanceof Twig_SimpleFilter) { - return $filter->getNodeClass(); - } - - return $filter instanceof Twig_Filter_Node ? $filter->getClass() : 'Twig_Node_Expression_Filter'; - } - - // checks that the node only contains "constant" elements - protected function checkConstantExpression(Twig_NodeInterface $node) - { - if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array)) { - return false; - } - - foreach ($node as $n) { - if (!$this->checkConstantExpression($n)) { - return false; - } - } - - return true; - } -} diff --git a/core1/lib/Twig/Extension.php b/core1/lib/Twig/Extension.php deleted file mode 100644 index 931fc033..00000000 --- a/core1/lib/Twig/Extension.php +++ /dev/null @@ -1,93 +0,0 @@ -dateFormats[0] = $format; - } - - if (null !== $dateIntervalFormat) { - $this->dateFormats[1] = $dateIntervalFormat; - } - } - - /** - * Gets the default format to be used by the date filter. - * - * @return array The default date format string and the default date interval format string - */ - public function getDateFormat() - { - return $this->dateFormats; - } - - /** - * Sets the default timezone to be used by the date filter. - * - * @param DateTimeZone|string $timezone The default timezone string or a DateTimeZone object - */ - public function setTimezone($timezone) - { - $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); - } - - /** - * Gets the default timezone to be used by the date filter. - * - * @return DateTimeZone The default timezone currently in use - */ - public function getTimezone() - { - if (null === $this->timezone) { - $this->timezone = new DateTimeZone(date_default_timezone_get()); - } - - return $this->timezone; - } - - /** - * Sets the default format to be used by the number_format filter. - * - * @param integer $decimal The number of decimal places to use. - * @param string $decimalPoint The character(s) to use for the decimal point. - * @param string $thousandSep The character(s) to use for the thousands separator. - */ - public function setNumberFormat($decimal, $decimalPoint, $thousandSep) - { - $this->numberFormat = array($decimal, $decimalPoint, $thousandSep); - } - - /** - * Get the default format used by the number_format filter. - * - * @return array The arguments for number_format() - */ - public function getNumberFormat() - { - return $this->numberFormat; - } - - /** - * Returns the token parser instance to add to the existing list. - * - * @return array An array of Twig_TokenParser instances - */ - public function getTokenParsers() - { - return array( - new Twig_TokenParser_For(), - new Twig_TokenParser_If(), - new Twig_TokenParser_Extends(), - new Twig_TokenParser_Include(), - new Twig_TokenParser_Block(), - new Twig_TokenParser_Use(), - new Twig_TokenParser_Filter(), - new Twig_TokenParser_Macro(), - new Twig_TokenParser_Import(), - new Twig_TokenParser_From(), - new Twig_TokenParser_Set(), - new Twig_TokenParser_Spaceless(), - new Twig_TokenParser_Flush(), - new Twig_TokenParser_Do(), - new Twig_TokenParser_Embed(), - ); - } - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters() - { - $filters = array( - // formatting filters - new Twig_SimpleFilter('date', 'twig_date_format_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('date_modify', 'twig_date_modify_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('format', 'sprintf'), - new Twig_SimpleFilter('replace', 'strtr'), - new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('abs', 'abs'), - - // encoding - new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'), - new Twig_SimpleFilter('json_encode', 'twig_jsonencode_filter'), - new Twig_SimpleFilter('convert_encoding', 'twig_convert_encoding'), - - // string filters - new Twig_SimpleFilter('title', 'twig_title_string_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('capitalize', 'twig_capitalize_string_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('upper', 'strtoupper'), - new Twig_SimpleFilter('lower', 'strtolower'), - new Twig_SimpleFilter('striptags', 'strip_tags'), - new Twig_SimpleFilter('trim', 'trim'), - new Twig_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), - - // array helpers - new Twig_SimpleFilter('join', 'twig_join_filter'), - new Twig_SimpleFilter('split', 'twig_split_filter'), - new Twig_SimpleFilter('sort', 'twig_sort_filter'), - new Twig_SimpleFilter('merge', 'twig_array_merge'), - new Twig_SimpleFilter('batch', 'twig_array_batch'), - - // string/array filters - new Twig_SimpleFilter('reverse', 'twig_reverse_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('length', 'twig_length_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('slice', 'twig_slice', array('needs_environment' => true)), - new Twig_SimpleFilter('first', 'twig_first', array('needs_environment' => true)), - new Twig_SimpleFilter('last', 'twig_last', array('needs_environment' => true)), - - // iteration and runtime - new Twig_SimpleFilter('default', '_twig_default_filter', array('node_class' => 'Twig_Node_Expression_Filter_Default')), - new Twig_SimpleFilter('keys', 'twig_get_array_keys_filter'), - - // escaping - new Twig_SimpleFilter('escape', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - new Twig_SimpleFilter('e', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - ); - - if (function_exists('mb_get_info')) { - $filters[] = new Twig_SimpleFilter('upper', 'twig_upper_filter', array('needs_environment' => true)); - $filters[] = new Twig_SimpleFilter('lower', 'twig_lower_filter', array('needs_environment' => true)); - } - - return $filters; - } - - /** - * Returns a list of global functions to add to the existing list. - * - * @return array An array of global functions - */ - public function getFunctions() - { - return array( - new Twig_SimpleFunction('range', 'range'), - new Twig_SimpleFunction('constant', 'twig_constant'), - new Twig_SimpleFunction('cycle', 'twig_cycle'), - new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)), - new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)), - new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true)), - ); - } - - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ - public function getTests() - { - return array( - new Twig_SimpleTest('even', null, array('node_class' => 'Twig_Node_Expression_Test_Even')), - new Twig_SimpleTest('odd', null, array('node_class' => 'Twig_Node_Expression_Test_Odd')), - new Twig_SimpleTest('defined', null, array('node_class' => 'Twig_Node_Expression_Test_Defined')), - new Twig_SimpleTest('sameas', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas')), - new Twig_SimpleTest('none', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_SimpleTest('null', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_SimpleTest('divisibleby', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby')), - new Twig_SimpleTest('constant', null, array('node_class' => 'Twig_Node_Expression_Test_Constant')), - new Twig_SimpleTest('empty', 'twig_test_empty'), - new Twig_SimpleTest('iterable', 'twig_test_iterable'), - ); - } - - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array( - array( - 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), - '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), - ), - array( - 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is' => array('precedence' => 100, 'callable' => array($this, 'parseTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is not' => array('precedence' => 100, 'callable' => array($this, 'parseNotTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), - ), - ); - } - - public function parseNotTestExpression(Twig_Parser $parser, $node) - { - return new Twig_Node_Expression_Unary_Not($this->parseTestExpression($parser, $node), $parser->getCurrentToken()->getLine()); - } - - public function parseTestExpression(Twig_Parser $parser, $node) - { - $stream = $parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - $arguments = null; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = $parser->getExpressionParser()->parseArguments(true); - } - - $class = $this->getTestNodeClass($parser, $name, $node->getLine()); - - return new $class($node, $name, $arguments, $parser->getCurrentToken()->getLine()); - } - - protected function getTestNodeClass(Twig_Parser $parser, $name, $line) - { - $env = $parser->getEnvironment(); - $testMap = $env->getTests(); - if (!isset($testMap[$name])) { - $message = sprintf('The test "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getTests()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } - - throw new Twig_Error_Syntax($message, $line, $parser->getFilename()); - } - - if ($testMap[$name] instanceof Twig_SimpleTest) { - return $testMap[$name]->getNodeClass(); - } - - return $testMap[$name] instanceof Twig_Test_Node ? $testMap[$name]->getClass() : 'Twig_Node_Expression_Test'; - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'core'; - } -} - -/** - * Cycles over a value. - * - * @param ArrayAccess|array $values An array or an ArrayAccess instance - * @param integer $position The cycle position - * - * @return string The next value in the cycle - */ -function twig_cycle($values, $position) -{ - if (!is_array($values) && !$values instanceof ArrayAccess) { - return $values; - } - - return $values[$position % count($values)]; -} - -/** - * Returns a random value depending on the supplied parameter type: - * - a random item from a Traversable or array - * - a random character from a string - * - a random integer between 0 and the integer parameter - * - * @param Twig_Environment $env A Twig_Environment instance - * @param Traversable|array|integer|string $values The values to pick a random item from - * - * @throws Twig_Error_Runtime When $values is an empty array (does not apply to an empty string which is returned as is). - * - * @return mixed A random value from the given sequence - */ -function twig_random(Twig_Environment $env, $values = null) -{ - if (null === $values) { - return mt_rand(); - } - - if (is_int($values) || is_float($values)) { - return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values); - } - - if ($values instanceof Traversable) { - $values = iterator_to_array($values); - } elseif (is_string($values)) { - if ('' === $values) { - return ''; - } - if (null !== $charset = $env->getCharset()) { - if ('UTF-8' != $charset) { - $values = twig_convert_encoding($values, 'UTF-8', $charset); - } - - // unicode version of str_split() - // split at all positions, but not after the start and not before the end - $values = preg_split('/(? $value) { - $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); - } - } - } else { - return $values[mt_rand(0, strlen($values) - 1)]; - } - } - - if (!is_array($values)) { - return $values; - } - - if (0 === count($values)) { - throw new Twig_Error_Runtime('The random function cannot pick from an empty array.'); - } - - return $values[array_rand($values, 1)]; -} - -/** - * Converts a date to the given format. - * - *
    - *   {{ post.published_at|date("m/d/Y") }}
    - * 
    - * - * @param Twig_Environment $env A Twig_Environment instance - * @param DateTime|DateInterval|string $date A date - * @param string $format A format - * @param DateTimeZone|string $timezone A timezone - * - * @return string The formatted date - */ -function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null) -{ - if (null === $format) { - $formats = $env->getExtension('core')->getDateFormat(); - $format = $date instanceof DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof DateInterval) { - return $date->format($format); - } - - return twig_date_converter($env, $date, $timezone)->format($format); -} - -/** - * Returns a new date object modified - * - *
    - *   {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
    - * 
    - * - * @param Twig_Environment $env A Twig_Environment instance - * @param DateTime|string $date A date - * @param string $modifier A modifier string - * - * @return DateTime A new date object - */ -function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) -{ - $date = twig_date_converter($env, $date, false); - $date->modify($modifier); - - return $date; -} - -/** - * Converts an input to a DateTime instance. - * - *
    - *    {% if date(user.created_at) < date('+2days') %}
    - *      {# do something #}
    - *    {% endif %}
    - * 
    - * - * @param Twig_Environment $env A Twig_Environment instance - * @param DateTime|string $date A date - * @param DateTimeZone|string $timezone A timezone - * - * @return DateTime A DateTime instance - */ -function twig_date_converter(Twig_Environment $env, $date = null, $timezone = null) -{ - // determine the timezone - if (!$timezone) { - $defaultTimezone = $env->getExtension('core')->getTimezone(); - } elseif (!$timezone instanceof DateTimeZone) { - $defaultTimezone = new DateTimeZone($timezone); - } else { - $defaultTimezone = $timezone; - } - - if ($date instanceof DateTime) { - $date = clone $date; - if (false !== $timezone) { - $date->setTimezone($defaultTimezone); - } - - return $date; - } - - $asString = (string) $date; - if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { - $date = '@'.$date; - } - - $date = new DateTime($date, $defaultTimezone); - if (false !== $timezone) { - $date->setTimezone($defaultTimezone); - } - - return $date; -} - -/** - * Number format filter. - * - * All of the formatting options can be left null, in that case the defaults will - * be used. Supplying any of the parameters will override the defaults set in the - * environment object. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $number A float/int/string of the number to format - * @param integer $decimal The number of decimal points to display. - * @param string $decimalPoint The character(s) to use for the decimal point. - * @param string $thousandSep The character(s) to use for the thousands separator. - * - * @return string The formatted number - */ -function twig_number_format_filter(Twig_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - $defaults = $env->getExtension('core')->getNumberFormat(); - if (null === $decimal) { - $decimal = $defaults[0]; - } - - if (null === $decimalPoint) { - $decimalPoint = $defaults[1]; - } - - if (null === $thousandSep) { - $thousandSep = $defaults[2]; - } - - return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * URL encodes a string as a path segment or an array as a query string. - * - * @param string|array $url A URL or an array of query parameters - * @param bool $raw true to use rawurlencode() instead of urlencode - * - * @return string The URL encoded value - */ -function twig_urlencode_filter($url, $raw = false) -{ - if (is_array($url)) { - return https_build_query($url, '', '&'); - } - - if ($raw) { - return rawurlencode($url); - } - - return urlencode($url); -} - -if (version_compare(PHP_VERSION, '5.3.0', '<')) { - /** - * JSON encodes a variable. - * - * @param mixed $value The value to encode. - * @param integer $options Not used on PHP 5.2.x - * - * @return mixed The JSON encoded value - */ - function twig_jsonencode_filter($value, $options = 0) - { - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } elseif (is_array($value)) { - array_walk_recursive($value, '_twig_markup2string'); - } - - return json_encode($value); - } -} else { - /** - * JSON encodes a variable. - * - * @param mixed $value The value to encode. - * @param integer $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT - * - * @return mixed The JSON encoded value - */ - function twig_jsonencode_filter($value, $options = 0) - { - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } elseif (is_array($value)) { - array_walk_recursive($value, '_twig_markup2string'); - } - - return json_encode($value, $options); - } -} - -function _twig_markup2string(&$value) -{ - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } -} - -/** - * Merges an array with another one. - * - *
    - *  {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
    - *
    - *  {% set items = items|merge({ 'peugeot': 'car' }) %}
    - *
    - *  {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
    - * 
    - * - * @param array $arr1 An array - * @param array $arr2 An array - * - * @return array The merged array - */ -function twig_array_merge($arr1, $arr2) -{ - if (!is_array($arr1) || !is_array($arr2)) { - throw new Twig_Error_Runtime('The merge filter only works with arrays or hashes.'); - } - - return array_merge($arr1, $arr2); -} - -/** - * Slices a variable. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $item A variable - * @param integer $start Start of the slice - * @param integer $length Size of the slice - * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array) - * - * @return mixed The sliced variable - */ -function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - if ($item instanceof Traversable) { - $item = iterator_to_array($item, false); - } - - if (is_array($item)) { - return array_slice($item, $start, $length, $preserveKeys); - } - - $item = (string) $item; - - if (function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { - return mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); - } - - return null === $length ? substr($item, $start) : substr($item, $start, $length); -} - -/** - * Returns the first element of the item. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $item A variable - * - * @return mixed The first element of the item - */ -function twig_first(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, 0, 1, false); - - return is_string($elements) ? $elements[0] : current($elements); -} - -/** - * Returns the last element of the item. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $item A variable - * - * @return mixed The last element of the item - */ -function twig_last(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, -1, 1, false); - - return is_string($elements) ? $elements[0] : current($elements); -} - -/** - * Joins the values to a string. - * - * The separator between elements is an empty string per default, you can define it with the optional parameter. - * - *
    - *  {{ [1, 2, 3]|join('|') }}
    - *  {# returns 1|2|3 #}
    - *
    - *  {{ [1, 2, 3]|join }}
    - *  {# returns 123 #}
    - * 
    - * - * @param array $value An array - * @param string $glue The separator - * - * @return string The concatenated string - */ -function twig_join_filter($value, $glue = '') -{ - if ($value instanceof Traversable) { - $value = iterator_to_array($value, false); - } - - return implode($glue, (array) $value); -} - -/** - * Splits the string into an array. - * - *
    - *  {{ "one,two,three"|split(',') }}
    - *  {# returns [one, two, three] #}
    - *
    - *  {{ "one,two,three,four,five"|split(',', 3) }}
    - *  {# returns [one, two, "three,four,five"] #}
    - *
    - *  {{ "123"|split('') }}
    - *  {# returns [1, 2, 3] #}
    - *
    - *  {{ "aabbcc"|split('', 2) }}
    - *  {# returns [aa, bb, cc] #}
    - * 
    - * - * @param string $value A string - * @param string $delimiter The delimiter - * @param integer $limit The limit - * - * @return array The split string as an array - */ -function twig_split_filter($value, $delimiter, $limit = null) -{ - if (empty($delimiter)) { - return str_split($value, null === $limit ? 1 : $limit); - } - - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); -} - -// The '_default' filter is used internally to avoid using the ternary operator -// which costs a lot for big contexts (before PHP 5.4). So, on average, -// a function call is cheaper. -function _twig_default_filter($value, $default = '') -{ - if (twig_test_empty($value)) { - return $default; - } - - return $value; -} - -/** - * Returns the keys for the given array. - * - * It is useful when you want to iterate over the keys of an array: - * - *
    - *  {% for key in array|keys %}
    - *      {# ... #}
    - *  {% endfor %}
    - * 
    - * - * @param array $array An array - * - * @return array The keys - */ -function twig_get_array_keys_filter($array) -{ - if (is_object($array) && $array instanceof Traversable) { - return array_keys(iterator_to_array($array)); - } - - if (!is_array($array)) { - return array(); - } - - return array_keys($array); -} - -/** - * Reverses a variable. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param array|Traversable|string $item An array, a Traversable instance, or a string - * @param Boolean $preserveKeys Whether to preserve key or not - * - * @return mixed The reversed input - */ -function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false) -{ - if (is_object($item) && $item instanceof Traversable) { - return array_reverse(iterator_to_array($item), $preserveKeys); - } - - if (is_array($item)) { - return array_reverse($item, $preserveKeys); - } - - if (null !== $charset = $env->getCharset()) { - $string = (string) $item; - - if ('UTF-8' != $charset) { - $item = twig_convert_encoding($string, 'UTF-8', $charset); - } - - preg_match_all('/./us', $item, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - } - - return strrev((string) $item); -} - -/** - * Sorts an array. - * - * @param array $array An array - */ -function twig_sort_filter($array) -{ - asort($array); - - return $array; -} - -/* used internally */ -function twig_in_filter($value, $compare) -{ - if (is_array($compare)) { - return in_array($value, $compare, is_object($value)); - } elseif (is_string($compare)) { - if (!strlen($value)) { - return empty($compare); - } - - return false !== strpos($compare, (string) $value); - } elseif ($compare instanceof Traversable) { - return in_array($value, iterator_to_array($compare, false), is_object($value)); - } - - return false; -} - -/** - * Escapes a string. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param Boolean $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - */ -function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) -{ - if ($autoescape && is_object($string) && $string instanceof Twig_Markup) { - return $string; - } - - if (!is_string($string) && !(is_object($string) && method_exists($string, '__toString'))) { - return $string; - } - - if (null === $charset) { - $charset = $env->getCharset(); - } - - $string = (string) $string; - - switch ($strategy) { - case 'js': - // escape all non-alphanumeric characters - // into their \xHH or \uHHHH representations - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); - - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'css': - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); - - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'html_attr': - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); - - if ('UTF-8' != $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'html': - // see https://php.net/htmlspecialchars - - // Using a static variable to avoid initializing the array - // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping strategies. - static $htmlspecialcharsCharsets = array( - 'iso-8859-1' => true, 'iso8859-1' => true, - 'iso-8859-15' => true, 'iso8859-15' => true, - 'utf-8' => true, - 'cp866' => true, 'ibm866' => true, '866' => true, - 'cp1251' => true, 'windows-1251' => true, 'win-1251' => true, - '1251' => true, - 'cp1252' => true, 'windows-1252' => true, '1252' => true, - 'koi8-r' => true, 'koi8-ru' => true, 'koi8r' => true, - 'big5' => true, '950' => true, - 'gb2312' => true, '936' => true, - 'big5-hkscs' => true, - 'shift_jis' => true, 'sjis' => true, '932' => true, - 'euc-jp' => true, 'eucjp' => true, - 'iso8859-5' => true, 'iso-8859-5' => true, 'macroman' => true, - ); - - if (isset($htmlspecialcharsCharsets[strtolower($charset)])) { - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - $string = twig_convert_encoding($string, 'UTF-8', $charset); - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); - - return twig_convert_encoding($string, $charset, 'UTF-8'); - - case 'url': - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - return str_replace('%7E', '~', rawurlencode($string)); - } - - return rawurlencode($string); - - default: - throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: html, js, url, css, and html_attr).', $strategy)); - } -} - -/* used internally */ -function twig_escape_filter_is_safe(Twig_Node $filterArgs) -{ - foreach ($filterArgs as $arg) { - if ($arg instanceof Twig_Node_Expression_Constant) { - return array($arg->getAttribute('value')); - } - - return array(); - } - - return array('html'); -} - -if (function_exists('mb_convert_encoding')) { - function twig_convert_encoding($string, $to, $from) - { - return mb_convert_encoding($string, $to, $from); - } -} elseif (function_exists('iconv')) { - function twig_convert_encoding($string, $to, $from) - { - return iconv($from, $to, $string); - } -} else { - function twig_convert_encoding($string, $to, $from) - { - throw new Twig_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); - } -} - -function _twig_escape_js_callback($matches) -{ - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - - return '\\u'.strtoupper(substr('0000'.bin2hex($char), -4)); -} - -function _twig_escape_css_callback($matches) -{ - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - $hex = ltrim(strtoupper(bin2hex($char)), '0'); - if (0 === strlen($hex)) { - $hex = '0'; - } - - return '\\'.$hex.' '; - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - - return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; -} - -/** - * This function is adapted from code coming from Zend Framework. - * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) - * @license https://framework.zend.com/license/new-bsd New BSD License - */ -function _twig_escape_html_attr_callback($matches) -{ - /* - * While HTML supports far more named entities, the lowest common denominator - * has become HTML5's XML Serialisation which is restricted to the those named - * entities that XML supports. Using HTML entities would result in this error: - * XML Parsing Error: undefined entity - */ - static $entityMap = array( - 34 => 'quot', /* quotation mark */ - 38 => 'amp', /* ampersand */ - 60 => 'lt', /* less-than sign */ - 62 => 'gt', /* greater-than sign */ - ); - - $chr = $matches[0]; - $ord = ord($chr); - - /** - * The following replaces characters undefined in HTML with the - * hex entity for the Unicode replacement character. - */ - if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) { - return '�'; - } - - /** - * Check if the current character to escape has a name entity we should - * replace it with while grabbing the hex value of the character. - */ - if (strlen($chr) == 1) { - $hex = strtoupper(substr('00'.bin2hex($chr), -2)); - } else { - $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); - $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); - } - - $int = hexdec($hex); - if (array_key_exists($int, $entityMap)) { - return sprintf('&%s;', $entityMap[$int]); - } - - /** - * Per OWASP recommendations, we'll use hex entities for any other - * characters where a named entity does not exist. - */ - - return sprintf('&#x%s;', $hex); -} - -// add multibyte extensions if possible -if (function_exists('mb_get_info')) { - /** - * Returns the length of a variable. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $thing A variable - * - * @return integer The length of the value - */ - function twig_length_filter(Twig_Environment $env, $thing) - { - return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing); - } - - /** - * Converts a string to uppercase. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The uppercased string - */ - function twig_upper_filter(Twig_Environment $env, $string) - { - if (null !== ($charset = $env->getCharset())) { - return mb_strtoupper($string, $charset); - } - - return strtoupper($string); - } - - /** - * Converts a string to lowercase. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The lowercased string - */ - function twig_lower_filter(Twig_Environment $env, $string) - { - if (null !== ($charset = $env->getCharset())) { - return mb_strtolower($string, $charset); - } - - return strtolower($string); - } - - /** - * Returns a titlecased string. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Twig_Environment $env, $string) - { - if (null !== ($charset = $env->getCharset())) { - return mb_convert_case($string, MB_CASE_TITLE, $charset); - } - - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Twig_Environment $env, $string) - { - if (null !== ($charset = $env->getCharset())) { - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset). - mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset); - } - - return ucfirst(strtolower($string)); - } -} -// and byte fallback -else { - /** - * Returns the length of a variable. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $thing A variable - * - * @return integer The length of the value - */ - function twig_length_filter(Twig_Environment $env, $thing) - { - return is_scalar($thing) ? strlen($thing) : count($thing); - } - - /** - * Returns a titlecased string. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Twig_Environment $env, $string) - { - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Twig_Environment $env, $string) - { - return ucfirst(strtolower($string)); - } -} - -/* used internally */ -function twig_ensure_traversable($seq) -{ - if ($seq instanceof Traversable || is_array($seq)) { - return $seq; - } - - return array(); -} - -/** - * Checks if a variable is empty. - * - *
    - * {# evaluates to true if the foo variable is null, false, or the empty string #}
    - * {% if foo is empty %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    - * - * @param mixed $value A variable - * - * @return Boolean true if the value is empty, false otherwise - */ -function twig_test_empty($value) -{ - if ($value instanceof Countable) { - return 0 == count($value); - } - - return '' === $value || false === $value || null === $value || array() === $value; -} - -/** - * Checks if a variable is traversable. - * - *
    - * {# evaluates to true if the foo variable is an array or a traversable object #}
    - * {% if foo is traversable %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    - * - * @param mixed $value A variable - * - * @return Boolean true if the value is traversable - */ -function twig_test_iterable($value) -{ - return $value instanceof Traversable || is_array($value); -} - -/** - * Renders a template. - * - * @param string template The template to render - * @param array variables The variables to pass to the template - * @param Boolean with_context Whether to pass the current context variables or not - * @param Boolean ignore_missing Whether to ignore missing templates or not - * @param Boolean sandboxed Whether to sandbox the template or not - * - * @return string The rendered template - */ -function twig_include(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - if ($withContext) { - $variables = array_merge($context, $variables); - } - - if ($isSandboxed = $sandboxed && $env->hasExtension('sandbox')) { - $sandbox = $env->getExtension('sandbox'); - if (!$alreadySandboxed = $sandbox->isSandboxed()) { - $sandbox->enableSandbox(); - } - } - - try { - return $env->resolveTemplate($template)->display($variables); - } catch (Twig_Error_Loader $e) { - if (!$ignoreMissing) { - throw $e; - } - } - - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } -} - -/** - * Provides the ability to get constants from instances as well as class/global constants. - * - * @param string $constant The name of the constant - * @param null|object $object The object to get the constant from - * - * @return string - */ -function twig_constant($constant, $object = null) -{ - if (null !== $object) { - $constant = get_class($object).'::'.$constant; - } - - return constant($constant); -} - -/** - * Batches item. - * - * @param array $items An array of items - * @param integer $size The size of the batch - * @param string $fill A string to fill missing items - * - * @return array - */ -function twig_array_batch($items, $size, $fill = null) -{ - if ($items instanceof Traversable) { - $items = iterator_to_array($items, false); - } - - $size = ceil($size); - - $result = array_chunk($items, $size, true); - - if (null !== $fill) { - $last = count($result) - 1; - $result[$last] = array_merge( - $result[$last], - array_fill(0, $size - count($result[$last]), $fill) - ); - } - - return $result; -} diff --git a/core1/lib/Twig/Extension/Debug.php b/core1/lib/Twig/Extension/Debug.php deleted file mode 100644 index 97007fb1..00000000 --- a/core1/lib/Twig/Extension/Debug.php +++ /dev/null @@ -1,70 +0,0 @@ - $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), - ); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'debug'; - } -} - -function twig_var_dump(Twig_Environment $env, $context) -{ - if (!$env->isDebug()) { - return; - } - - ob_start(); - - $count = func_num_args(); - if (2 === $count) { - $vars = array(); - foreach ($context as $key => $value) { - if (!$value instanceof Twig_Template) { - $vars[$key] = $value; - } - } - - var_dump($vars); - } else { - for ($i = 2; $i < $count; $i++) { - var_dump(func_get_arg($i)); - } - } - - return ob_get_clean(); -} diff --git a/core1/lib/Twig/Extension/Escaper.php b/core1/lib/Twig/Extension/Escaper.php deleted file mode 100644 index c9a7f68e..00000000 --- a/core1/lib/Twig/Extension/Escaper.php +++ /dev/null @@ -1,107 +0,0 @@ -setDefaultStrategy($defaultStrategy); - } - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(new Twig_TokenParser_AutoEscape()); - } - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Escaper()); - } - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters() - { - return array( - new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), - ); - } - - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * "filename" as an argument and returns the strategy to use. - * - * @param mixed $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) - { - // for BC - if (true === $defaultStrategy) { - $defaultStrategy = 'html'; - } - - $this->defaultStrategy = $defaultStrategy; - } - - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $filename The template "filename" - * - * @return string The default strategy to use for the template - */ - public function getDefaultStrategy($filename) - { - // disable string callables to avoid calling a function named html or js, - // or any other upcoming escaping strategy - if (!is_string($this->defaultStrategy) && is_callable($this->defaultStrategy)) { - return call_user_func($this->defaultStrategy, $filename); - } - - return $this->defaultStrategy; - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'escaper'; - } -} - -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - */ -function twig_raw_filter($string) -{ - return $string; -} diff --git a/core1/lib/Twig/Extension/Optimizer.php b/core1/lib/Twig/Extension/Optimizer.php deleted file mode 100644 index 013fcb62..00000000 --- a/core1/lib/Twig/Extension/Optimizer.php +++ /dev/null @@ -1,35 +0,0 @@ -optimizers = $optimizers; - } - - /** - * {@inheritdoc} - */ - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'optimizer'; - } -} diff --git a/core1/lib/Twig/Extension/Sandbox.php b/core1/lib/Twig/Extension/Sandbox.php deleted file mode 100644 index bf76c11a..00000000 --- a/core1/lib/Twig/Extension/Sandbox.php +++ /dev/null @@ -1,112 +0,0 @@ -policy = $policy; - $this->sandboxedGlobally = $sandboxed; - } - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(new Twig_TokenParser_Sandbox()); - } - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Sandbox()); - } - - public function enableSandbox() - { - $this->sandboxed = true; - } - - public function disableSandbox() - { - $this->sandboxed = false; - } - - public function isSandboxed() - { - return $this->sandboxedGlobally || $this->sandboxed; - } - - public function isSandboxedGlobally() - { - return $this->sandboxedGlobally; - } - - public function setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy) - { - $this->policy = $policy; - } - - public function getSecurityPolicy() - { - return $this->policy; - } - - public function checkSecurity($tags, $filters, $functions) - { - if ($this->isSandboxed()) { - $this->policy->checkSecurity($tags, $filters, $functions); - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkMethodAllowed($obj, $method); - } - } - - public function checkPropertyAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkPropertyAllowed($obj, $method); - } - } - - public function ensureToStringAllowed($obj) - { - if (is_object($obj)) { - $this->policy->checkMethodAllowed($obj, '__toString'); - } - - return $obj; - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'sandbox'; - } -} diff --git a/core1/lib/Twig/Extension/Staging.php b/core1/lib/Twig/Extension/Staging.php deleted file mode 100644 index 8ab0f459..00000000 --- a/core1/lib/Twig/Extension/Staging.php +++ /dev/null @@ -1,113 +0,0 @@ - - */ -class Twig_Extension_Staging extends Twig_Extension -{ - protected $functions = array(); - protected $filters = array(); - protected $visitors = array(); - protected $tokenParsers = array(); - protected $globals = array(); - protected $tests = array(); - - public function addFunction($name, $function) - { - $this->functions[$name] = $function; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return $this->functions; - } - - public function addFilter($name, $filter) - { - $this->filters[$name] = $filter; - } - - /** - * {@inheritdoc} - */ - public function getFilters() - { - return $this->filters; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - $this->visitors[] = $visitor; - } - - /** - * {@inheritdoc} - */ - public function getNodeVisitors() - { - return $this->visitors; - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - $this->tokenParsers[] = $parser; - } - - /** - * {@inheritdoc} - */ - public function getTokenParsers() - { - return $this->tokenParsers; - } - - public function addGlobal($name, $value) - { - $this->globals[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function getGlobals() - { - return $this->globals; - } - - public function addTest($name, $test) - { - $this->tests[$name] = $test; - } - - /** - * {@inheritdoc} - */ - public function getTests() - { - return $this->tests; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'staging'; - } -} diff --git a/core1/lib/Twig/Extension/StringLoader.php b/core1/lib/Twig/Extension/StringLoader.php deleted file mode 100644 index d5b881bf..00000000 --- a/core1/lib/Twig/Extension/StringLoader.php +++ /dev/null @@ -1,64 +0,0 @@ - true)), - ); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'string_loader'; - } -} - -/** - * Loads a template from a string. - * - *
    - * {% include template_from_string("Hello {{ name }}") }}
    - * 
    - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $template A template as a string - * - * @return Twig_Template A Twig_Template instance - */ -function twig_template_from_string(Twig_Environment $env, $template) -{ - static $loader; - - if (null === $loader) { - $loader = new Twig_Loader_String(); - } - - $current = $env->getLoader(); - $env->setLoader($loader); - try { - $template = $env->loadTemplate($template); - } catch (Exception $e) { - $env->setLoader($current); - - throw $e; - } - $env->setLoader($current); - - return $template; -} diff --git a/core1/lib/Twig/ExtensionInterface.php b/core1/lib/Twig/ExtensionInterface.php deleted file mode 100644 index f189e9d9..00000000 --- a/core1/lib/Twig/ExtensionInterface.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ -interface Twig_ExtensionInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - public function initRuntime(Twig_Environment $environment); - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ - public function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators(); - - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals(); - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(); -} diff --git a/core1/lib/Twig/Filter.php b/core1/lib/Twig/Filter.php deleted file mode 100644 index 18917885..00000000 --- a/core1/lib/Twig/Filter.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface -{ - protected $options; - protected $arguments = array(); - - public function __construct(array $options = array()) - { - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'pre_escape' => null, - 'preserves_safety' => null, - 'callable' => null, - ), $options); - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $filterArgs) - { - if (isset($this->options['is_safe'])) { - return $this->options['is_safe']; - } - - if (isset($this->options['is_safe_callback'])) { - return call_user_func($this->options['is_safe_callback'], $filterArgs); - } - - return null; - } - - public function getPreservesSafety() - { - return $this->options['preserves_safety']; - } - - public function getPreEscape() - { - return $this->options['pre_escape']; - } - - public function getCallable() - { - return $this->options['callable']; - } -} diff --git a/core1/lib/Twig/Filter/Function.php b/core1/lib/Twig/Filter/Function.php deleted file mode 100644 index ad374a55..00000000 --- a/core1/lib/Twig/Filter/Function.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Filter_Function extends Twig_Filter -{ - protected $function; - - public function __construct($function, array $options = array()) - { - $options['callable'] = $function; - - parent::__construct($options); - - $this->function = $function; - } - - public function compile() - { - return $this->function; - } -} diff --git a/core1/lib/Twig/Filter/Method.php b/core1/lib/Twig/Filter/Method.php deleted file mode 100644 index 63c8c3be..00000000 --- a/core1/lib/Twig/Filter/Method.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Filter_Method extends Twig_Filter -{ - protected $extension; - protected $method; - - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) - { - $options['callable'] = array($extension, $method); - - parent::__construct($options); - - $this->extension = $extension; - $this->method = $method; - } - - public function compile() - { - return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); - } -} diff --git a/core1/lib/Twig/Filter/Node.php b/core1/lib/Twig/Filter/Node.php deleted file mode 100644 index 8744c5e0..00000000 --- a/core1/lib/Twig/Filter/Node.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Filter_Node extends Twig_Filter -{ - protected $class; - - public function __construct($class, array $options = array()) - { - parent::__construct($options); - - $this->class = $class; - } - - public function getClass() - { - return $this->class; - } - - public function compile() - { - } -} diff --git a/core1/lib/Twig/FilterCallableInterface.php b/core1/lib/Twig/FilterCallableInterface.php deleted file mode 100644 index 145534df..00000000 --- a/core1/lib/Twig/FilterCallableInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_FilterCallableInterface -{ - public function getCallable(); -} diff --git a/core1/lib/Twig/FilterInterface.php b/core1/lib/Twig/FilterInterface.php deleted file mode 100644 index 5319ecc9..00000000 --- a/core1/lib/Twig/FilterInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_FilterInterface -{ - /** - * Compiles a filter. - * - * @return string The PHP code for the filter - */ - public function compile(); - - public function needsEnvironment(); - - public function needsContext(); - - public function getSafe(Twig_Node $filterArgs); - - public function getPreservesSafety(); - - public function getPreEscape(); - - public function setArguments($arguments); - - public function getArguments(); -} diff --git a/core1/lib/Twig/Function.php b/core1/lib/Twig/Function.php deleted file mode 100644 index b5ffb2b0..00000000 --- a/core1/lib/Twig/Function.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface -{ - protected $options; - protected $arguments = array(); - - public function __construct(array $options = array()) - { - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'callable' => null, - ), $options); - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $functionArgs) - { - if (isset($this->options['is_safe'])) { - return $this->options['is_safe']; - } - - if (isset($this->options['is_safe_callback'])) { - return call_user_func($this->options['is_safe_callback'], $functionArgs); - } - - return array(); - } - - public function getCallable() - { - return $this->options['callable']; - } -} diff --git a/core1/lib/Twig/Function/Function.php b/core1/lib/Twig/Function/Function.php deleted file mode 100644 index d1e1b96a..00000000 --- a/core1/lib/Twig/Function/Function.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Function_Function extends Twig_Function -{ - protected $function; - - public function __construct($function, array $options = array()) - { - $options['callable'] = $function; - - parent::__construct($options); - - $this->function = $function; - } - - public function compile() - { - return $this->function; - } -} diff --git a/core1/lib/Twig/Function/Method.php b/core1/lib/Twig/Function/Method.php deleted file mode 100644 index 67039a95..00000000 --- a/core1/lib/Twig/Function/Method.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Function_Method extends Twig_Function -{ - protected $extension; - protected $method; - - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) - { - $options['callable'] = array($extension, $method); - - parent::__construct($options); - - $this->extension = $extension; - $this->method = $method; - } - - public function compile() - { - return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); - } -} diff --git a/core1/lib/Twig/Function/Node.php b/core1/lib/Twig/Function/Node.php deleted file mode 100644 index 06a0d0db..00000000 --- a/core1/lib/Twig/Function/Node.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Function_Node extends Twig_Function -{ - protected $class; - - public function __construct($class, array $options = array()) - { - parent::__construct($options); - - $this->class = $class; - } - - public function getClass() - { - return $this->class; - } - - public function compile() - { - } -} diff --git a/core1/lib/Twig/FunctionCallableInterface.php b/core1/lib/Twig/FunctionCallableInterface.php deleted file mode 100644 index 0aab4f5e..00000000 --- a/core1/lib/Twig/FunctionCallableInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_FunctionCallableInterface -{ - public function getCallable(); -} diff --git a/core1/lib/Twig/FunctionInterface.php b/core1/lib/Twig/FunctionInterface.php deleted file mode 100644 index 67f4f89c..00000000 --- a/core1/lib/Twig/FunctionInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_FunctionInterface -{ - /** - * Compiles a function. - * - * @return string The PHP code for the function - */ - public function compile(); - - public function needsEnvironment(); - - public function needsContext(); - - public function getSafe(Twig_Node $filterArgs); - - public function setArguments($arguments); - - public function getArguments(); -} diff --git a/core1/lib/Twig/Lexer.php b/core1/lib/Twig/Lexer.php deleted file mode 100644 index 000b038e..00000000 --- a/core1/lib/Twig/Lexer.php +++ /dev/null @@ -1,408 +0,0 @@ - - */ -class Twig_Lexer implements Twig_LexerInterface -{ - protected $tokens; - protected $code; - protected $cursor; - protected $lineno; - protected $end; - protected $state; - protected $states; - protected $brackets; - protected $env; - protected $filename; - protected $options; - protected $regexes; - protected $position; - protected $positions; - protected $currentVarBlockLine; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - const STATE_STRING = 3; - const STATE_INTERPOLATION = 4; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; - const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const REGEX_DQ_STRING_DELIM = '/"/A'; - const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; - const PUNCTUATION = '()[]{}?:.,|'; - - public function __construct(Twig_Environment $env, array $options = array()) - { - $this->env = $env; - - $this->options = array_merge(array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'whitespace_trim' => '-', - 'interpolation' => array('#{', '}'), - ), $options); - - $this->regexes = array( - 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', - 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', - 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', - 'operator' => $this->getOperatorRegex(), - 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', - 'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As', - 'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', - 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', - 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', - 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', - ); - } - - /** - * Tokenizes a source code. - * - * @param string $code The source code - * @param string $filename A unique identifier for the source code - * - * @return Twig_TokenStream A token stream instance - */ - public function tokenize($code, $filename = null) - { - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - $this->code = str_replace(array("\r\n", "\r"), "\n", $code); - $this->filename = $filename; - $this->cursor = 0; - $this->lineno = 1; - $this->end = strlen($this->code); - $this->tokens = array(); - $this->state = self::STATE_DATA; - $this->states = array(); - $this->brackets = array(); - $this->position = -1; - - // find all token starts in one go - preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); - $this->positions = $matches; - - while ($this->cursor < $this->end) { - // dispatch to the lexing functions depending - // on the current state - switch ($this->state) { - case self::STATE_DATA: - $this->lexData(); - break; - - case self::STATE_BLOCK: - $this->lexBlock(); - break; - - case self::STATE_VAR: - $this->lexVar(); - break; - - case self::STATE_STRING: - $this->lexString(); - break; - - case self::STATE_INTERPOLATION: - $this->lexInterpolation(); - break; - } - } - - $this->pushToken(Twig_Token::EOF_TYPE); - - if (!empty($this->brackets)) { - list($expect, $lineno) = array_pop($this->brackets); - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); - } - - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - - return new Twig_TokenStream($this->tokens, $this->filename); - } - - protected function lexData() - { - // if no matches are left we return the rest of the template as simple text token - if ($this->position == count($this->positions[0]) - 1) { - $this->pushToken(Twig_Token::TEXT_TYPE, substr($this->code, $this->cursor)); - $this->cursor = $this->end; - - return; - } - - // Find the first token after the current cursor - $position = $this->positions[0][++$this->position]; - while ($position[1] < $this->cursor) { - if ($this->position == count($this->positions[0]) - 1) { - return; - } - $position = $this->positions[0][++$this->position]; - } - - // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); - if (isset($this->positions[2][$this->position][0])) { - $text = rtrim($text); - } - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - $this->moveCursor($textContent.$position[0]); - - switch ($this->positions[1][$this->position][0]) { - case $this->options['tag_comment'][0]: - $this->lexComment(); - break; - - case $this->options['tag_block'][0]: - // raw data? - if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lexRawData($match[1]); - // {% line \d+ %} - } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lineno = (int) $match[1]; - } else { - $this->pushToken(Twig_Token::BLOCK_START_TYPE); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(Twig_Token::VAR_START_TYPE); - $this->pushState(self::STATE_VAR); - $this->currentVarBlockLine = $this->lineno; - break; - } - } - - protected function lexBlock() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::BLOCK_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexVar() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::VAR_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexExpression() - { - // whitespace - if (preg_match('/\s+/A', $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - - if ($this->cursor >= $this->end) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->filename); - } - } - - // operators - if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::OPERATOR_TYPE, $match[0]); - $this->moveCursor($match[0]); - } - // names - elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::NAME_TYPE, $match[0]); - $this->moveCursor($match[0]); - } - // numbers - elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $this->pushToken(Twig_Token::NUMBER_TYPE, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (false !== strpos('([{', $this->code[$this->cursor])) { - $this->brackets[] = array($this->code[$this->cursor], $this->lineno); - } - // closing bracket - elseif (false !== strpos(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new Twig_Error_Syntax(sprintf('Unexpected "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); - } - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); - } - } - - $this->pushToken(Twig_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); - $this->moveCursor($match[0]); - } - // opening double quoted string - elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array('"', $this->lineno); - $this->pushState(self::STATE_STRING); - $this->moveCursor($match[0]); - } - // unlexable - else { - throw new Twig_Error_Syntax(sprintf('Unexpected character "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); - } - } - - protected function lexRawData($tag) - { - if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block', $tag), $this->lineno, $this->filename); - } - - $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->moveCursor($text.$match[0][0]); - - if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { - $text = rtrim($text); - } - - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - } - - protected function lexComment() - { - if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax('Unclosed comment', $this->lineno, $this->filename); - } - - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); - } - - protected function lexString() - { - if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array($this->options['interpolation'][0], $this->lineno); - $this->pushToken(Twig_Token::INTERPOLATION_START_TYPE); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0])); - $this->moveCursor($match[0]); - - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != '"') { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); - } - - $this->popState(); - ++$this->cursor; - } - } - - protected function lexInterpolation() - { - $bracket = end($this->brackets); - if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) { - array_pop($this->brackets); - $this->pushToken(Twig_Token::INTERPOLATION_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function pushToken($type, $value = '') - { - // do not push empty text tokens - if (Twig_Token::TEXT_TYPE === $type && '' === $value) { - return; - } - - $this->tokens[] = new Twig_Token($type, $value, $this->lineno); - } - - protected function moveCursor($text) - { - $this->cursor += strlen($text); - $this->lineno += substr_count($text, "\n"); - } - - protected function getOperatorRegex() - { - $operators = array_merge( - array('='), - array_keys($this->env->getUnaryOperators()), - array_keys($this->env->getBinaryOperators()) - ); - - $operators = array_combine($operators, array_map('strlen', $operators)); - arsort($operators); - - $regex = array(); - foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - if (ctype_alpha($operator[$length - 1])) { - $regex[] = preg_quote($operator, '/').'(?=[\s()])'; - } else { - $regex[] = preg_quote($operator, '/'); - } - } - - return '/'.implode('|', $regex).'/A'; - } - - protected function pushState($state) - { - $this->states[] = $this->state; - $this->state = $state; - } - - protected function popState() - { - if (0 === count($this->states)) { - throw new Exception('Cannot pop state without a previous state'); - } - - $this->state = array_pop($this->states); - } -} diff --git a/core1/lib/Twig/LexerInterface.php b/core1/lib/Twig/LexerInterface.php deleted file mode 100644 index 4b83f81b..00000000 --- a/core1/lib/Twig/LexerInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_LexerInterface -{ - /** - * Tokenizes a source code. - * - * @param string $code The source code - * @param string $filename A unique identifier for the source code - * - * @return Twig_TokenStream A token stream instance - */ - public function tokenize($code, $filename = null); -} diff --git a/core1/lib/Twig/Loader/Array.php b/core1/lib/Twig/Loader/Array.php deleted file mode 100644 index 89087aea..00000000 --- a/core1/lib/Twig/Loader/Array.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ -class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface -{ - protected $templates; - - /** - * Constructor. - * - * @param array $templates An array of templates (keys are the names, and values are the source code) - * - * @see Twig_Loader - */ - public function __construct(array $templates) - { - $this->templates = array(); - foreach ($templates as $name => $template) { - $this->templates[$name] = $template; - } - } - - /** - * Adds or overrides a template. - * - * @param string $name The template name - * @param string $template The template source - */ - public function setTemplate($name, $template) - { - $this->templates[(string) $name] = $template; - } - - /** - * {@inheritdoc} - */ - public function getSource($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return $this->templates[$name]; - } - - /** - * {@inheritdoc} - */ - public function exists($name) - { - return isset($this->templates[(string) $name]); - } - - /** - * {@inheritdoc} - */ - public function getCacheKey($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return $this->templates[$name]; - } - - /** - * {@inheritdoc} - */ - public function isFresh($name, $time) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return true; - } -} diff --git a/core1/lib/Twig/Loader/Chain.php b/core1/lib/Twig/Loader/Chain.php deleted file mode 100644 index cd64b051..00000000 --- a/core1/lib/Twig/Loader/Chain.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface -{ - private $hasSourceCache = array(); - protected $loaders; - - /** - * Constructor. - * - * @param Twig_LoaderInterface[] $loaders An array of loader instances - */ - public function __construct(array $loaders = array()) - { - $this->loaders = array(); - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - /** - * Adds a loader instance. - * - * @param Twig_LoaderInterface $loader A Loader instance - */ - public function addLoader(Twig_LoaderInterface $loader) - { - $this->loaders[] = $loader; - $this->hasSourceCache = array(); - } - - /** - * {@inheritdoc} - */ - public function getSource($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->getSource($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = $e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(', ', $exceptions))); - } - - /** - * {@inheritdoc} - */ - public function exists($name) - { - $name = (string) $name; - - if (isset($this->hasSourceCache[$name])) { - return $this->hasSourceCache[$name]; - } - - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && $loader->exists($name)) { - return $this->hasSourceCache[$name] = true; - } - - try { - $loader->getSource($name); - - return $this->hasSourceCache[$name] = true; - } catch (Twig_Error_Loader $e) { - } - } - - return $this->hasSourceCache[$name] = false; - } - - /** - * {@inheritdoc} - */ - public function getCacheKey($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->getCacheKey($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions))); - } - - /** - * {@inheritdoc} - */ - public function isFresh($name, $time) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->isFresh($name, $time); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions))); - } -} diff --git a/core1/lib/Twig/Loader/Filesystem.php b/core1/lib/Twig/Loader/Filesystem.php deleted file mode 100644 index faf27e3e..00000000 --- a/core1/lib/Twig/Loader/Filesystem.php +++ /dev/null @@ -1,220 +0,0 @@ - - */ -class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface -{ - protected $paths; - protected $cache; - - /** - * Constructor. - * - * @param string|array $paths A path or an array of paths where to look for templates - */ - public function __construct($paths) - { - $this->setPaths($paths); - } - - /** - * Returns the paths to the templates. - * - * @param string $namespace A path namespace - * - * @return array The array of paths where to look for templates - */ - public function getPaths($namespace = '__main__') - { - return isset($this->paths[$namespace]) ? $this->paths[$namespace] : array(); - } - - /** - * Returns the path namespaces. - * - * The "__main__" namespace is always defined. - * - * @return array The array of defined namespaces - */ - public function getNamespaces() - { - return array_keys($this->paths); - } - - /** - * Sets the paths where templates are stored. - * - * @param string|array $paths A path or an array of paths where to look for templates - * @param string $namespace A path namespace - */ - public function setPaths($paths, $namespace = '__main__') - { - if (!is_array($paths)) { - $paths = array($paths); - } - - $this->paths[$namespace] = array(); - foreach ($paths as $path) { - $this->addPath($path, $namespace); - } - } - - /** - * Adds a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path name - * - * @throws Twig_Error_Loader - */ - public function addPath($path, $namespace = '__main__') - { - // invalidate the cache - $this->cache = array(); - - if (!is_dir($path)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); - } - - $this->paths[$namespace][] = rtrim($path, '/\\'); - } - - /** - * Prepends a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path name - * - * @throws Twig_Error_Loader - */ - public function prependPath($path, $namespace = '__main__') - { - // invalidate the cache - $this->cache = array(); - - if (!is_dir($path)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); - } - - $path = rtrim($path, '/\\'); - - if (!isset($this->paths[$namespace])) { - $this->paths[$namespace][] = $path; - } else { - array_unshift($this->paths[$namespace], $path); - } - } - - /** - * {@inheritdoc} - */ - public function getSource($name) - { - return file_get_contents($this->findTemplate($name)); - } - - /** - * {@inheritdoc} - */ - public function getCacheKey($name) - { - return $this->findTemplate($name); - } - - /** - * {@inheritdoc} - */ - public function exists($name) - { - $name = (string) $name; - if (isset($this->cache[$name])) { - return true; - } - - try { - $this->findTemplate($name); - - return true; - } catch (Twig_Error_Loader $exception) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function isFresh($name, $time) - { - return filemtime($this->findTemplate($name)) <= $time; - } - - protected function findTemplate($name) - { - $name = (string) $name; - - // normalize name - $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); - - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - - $this->validateName($name); - - $namespace = '__main__'; - if (isset($name[0]) && '@' == $name[0]) { - if (false === $pos = strpos($name, '/')) { - throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); - } - - $namespace = substr($name, 1, $pos - 1); - - $name = substr($name, $pos + 1); - } - - if (!isset($this->paths[$namespace])) { - throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace)); - } - - foreach ($this->paths[$namespace] as $path) { - if (is_file($path.'/'.$name)) { - return $this->cache[$name] = $path.'/'.$name; - } - } - - throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace]))); - } - - protected function validateName($name) - { - if (false !== strpos($name, "\0")) { - throw new Twig_Error_Loader('A template name cannot contain NUL bytes.'); - } - - $parts = explode('/', $name); - $level = 0; - foreach ($parts as $part) { - if ('..' === $part) { - --$level; - } elseif ('.' !== $part) { - ++$level; - } - - if ($level < 0) { - throw new Twig_Error_Loader(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); - } - } - } -} diff --git a/core1/lib/Twig/Loader/String.php b/core1/lib/Twig/Loader/String.php deleted file mode 100644 index 8ad9856c..00000000 --- a/core1/lib/Twig/Loader/String.php +++ /dev/null @@ -1,59 +0,0 @@ - - */ -class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface -{ - /** - * {@inheritdoc} - */ - public function getSource($name) - { - return $name; - } - - /** - * {@inheritdoc} - */ - public function exists($name) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getCacheKey($name) - { - return $name; - } - - /** - * {@inheritdoc} - */ - public function isFresh($name, $time) - { - return true; - } -} diff --git a/core1/lib/Twig/LoaderInterface.php b/core1/lib/Twig/LoaderInterface.php deleted file mode 100644 index 927786d1..00000000 --- a/core1/lib/Twig/LoaderInterface.php +++ /dev/null @@ -1,52 +0,0 @@ - - */ -interface Twig_LoaderInterface -{ - /** - * Gets the source code of a template, given its name. - * - * @param string $name The name of the template to load - * - * @return string The template source code - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getSource($name); - - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template - * - * @return Boolean true if the template is fresh, false otherwise - * - * @throws Twig_Error_Loader When $name is not found - */ - public function isFresh($name, $time); -} diff --git a/core1/lib/Twig/Markup.php b/core1/lib/Twig/Markup.php deleted file mode 100644 index 69871fcb..00000000 --- a/core1/lib/Twig/Markup.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class Twig_Markup implements Countable -{ - protected $content; - protected $charset; - - public function __construct($content, $charset) - { - $this->content = (string) $content; - $this->charset = $charset; - } - - public function __toString() - { - return $this->content; - } - - public function count() - { - return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); - } -} diff --git a/core1/lib/Twig/Node.php b/core1/lib/Twig/Node.php deleted file mode 100644 index 931b4635..00000000 --- a/core1/lib/Twig/Node.php +++ /dev/null @@ -1,226 +0,0 @@ - - */ -class Twig_Node implements Twig_NodeInterface -{ - protected $nodes; - protected $attributes; - protected $lineno; - protected $tag; - - /** - * Constructor. - * - * The nodes are automatically made available as properties ($this->node). - * The attributes are automatically made available as array items ($this['name']). - * - * @param array $nodes An array of named nodes - * @param array $attributes An array of attributes (should not be nodes) - * @param integer $lineno The line number - * @param string $tag The tag name associated with the Node - */ - public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) - { - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - $this->tag = $tag; - } - - public function __toString() - { - $attributes = array(); - foreach ($this->attributes as $name => $value) { - $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); - } - - $repr = array(get_class($this).'('.implode(', ', $attributes)); - - if (count($this->nodes)) { - foreach ($this->nodes as $name => $node) { - $len = strlen($name) + 4; - $noderepr = array(); - foreach (explode("\n", (string) $node) as $line) { - $noderepr[] = str_repeat(' ', $len).$line; - } - - $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); - } - - $repr[] = ')'; - } else { - $repr[0] .= ')'; - } - - return implode("\n", $repr); - } - - public function toXml($asDom = false) - { - $dom = new DOMDocument('1.0', 'UTF-8'); - $dom->formatOutput = true; - $dom->appendChild($xml = $dom->createElement('twig')); - - $xml->appendChild($node = $dom->createElement('node')); - $node->setAttribute('class', get_class($this)); - - foreach ($this->attributes as $name => $value) { - $node->appendChild($attribute = $dom->createElement('attribute')); - $attribute->setAttribute('name', $name); - $attribute->appendChild($dom->createTextNode($value)); - } - - foreach ($this->nodes as $name => $n) { - if (null === $n) { - continue; - } - - $child = $n->toXml(true)->getElementsByTagName('node')->item(0); - $child = $dom->importNode($child, true); - $child->setAttribute('name', $name); - - $node->appendChild($child); - } - - return $asDom ? $dom : $dom->saveXml(); - } - - public function compile(Twig_Compiler $compiler) - { - foreach ($this->nodes as $node) { - $node->compile($compiler); - } - } - - public function getLine() - { - return $this->lineno; - } - - public function getNodeTag() - { - return $this->tag; - } - - /** - * Returns true if the attribute is defined. - * - * @param string The attribute name - * - * @return Boolean true if the attribute is defined, false otherwise - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * Gets an attribute. - * - * @param string The attribute name - * - * @return mixed The attribute value - */ - public function getAttribute($name) - { - if (!array_key_exists($name, $this->attributes)) { - throw new LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->attributes[$name]; - } - - /** - * Sets an attribute. - * - * @param string The attribute name - * @param mixed The attribute value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - /** - * Removes an attribute. - * - * @param string The attribute name - */ - public function removeAttribute($name) - { - unset($this->attributes[$name]); - } - - /** - * Returns true if the node with the given identifier exists. - * - * @param string The node name - * - * @return Boolean true if the node with the given name exists, false otherwise - */ - public function hasNode($name) - { - return array_key_exists($name, $this->nodes); - } - - /** - * Gets a node by name. - * - * @param string The node name - * - * @return Twig_Node A Twig_Node instance - */ - public function getNode($name) - { - if (!array_key_exists($name, $this->nodes)) { - throw new LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->nodes[$name]; - } - - /** - * Sets a node. - * - * @param string The node name - * @param Twig_Node A Twig_Node instance - */ - public function setNode($name, $node = null) - { - $this->nodes[$name] = $node; - } - - /** - * Removes a node by name. - * - * @param string The node name - */ - public function removeNode($name) - { - unset($this->nodes[$name]); - } - - public function count() - { - return count($this->nodes); - } - - public function getIterator() - { - return new ArrayIterator($this->nodes); - } -} diff --git a/core1/lib/Twig/Node/AutoEscape.php b/core1/lib/Twig/Node/AutoEscape.php deleted file mode 100644 index 8f190e0b..00000000 --- a/core1/lib/Twig/Node/AutoEscape.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Twig_Node_AutoEscape extends Twig_Node -{ - public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape') - { - parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('body')); - } -} diff --git a/core1/lib/Twig/Node/Block.php b/core1/lib/Twig/Node/Block.php deleted file mode 100644 index 50eb67ed..00000000 --- a/core1/lib/Twig/Node/Block.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class Twig_Node_Block extends Twig_Node -{ - public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") - ->indent() - ; - - $compiler - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n\n") - ; - } -} diff --git a/core1/lib/Twig/Node/BlockReference.php b/core1/lib/Twig/Node/BlockReference.php deleted file mode 100644 index 013e369e..00000000 --- a/core1/lib/Twig/Node/BlockReference.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('name' => $name), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) - ; - } -} diff --git a/core1/lib/Twig/Node/Body.php b/core1/lib/Twig/Node/Body.php deleted file mode 100644 index 3ffb1342..00000000 --- a/core1/lib/Twig/Node/Body.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -class Twig_Node_Body extends Twig_Node -{ -} diff --git a/core1/lib/Twig/Node/Do.php b/core1/lib/Twig/Node/Do.php deleted file mode 100644 index c528066b..00000000 --- a/core1/lib/Twig/Node/Do.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class Twig_Node_Do extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} diff --git a/core1/lib/Twig/Node/Embed.php b/core1/lib/Twig/Node/Embed.php deleted file mode 100644 index 4c9456dc..00000000 --- a/core1/lib/Twig/Node/Embed.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class Twig_Node_Embed extends Twig_Node_Include -{ - // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) - public function __construct($filename, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); - - $this->setAttribute('filename', $filename); - $this->setAttribute('index', $index); - } - - protected function addGetTemplate(Twig_Compiler $compiler) - { - $compiler - ->write("\$this->env->loadTemplate(") - ->string($this->getAttribute('filename')) - ->raw(', ') - ->string($this->getAttribute('index')) - ->raw(")") - ; - } -} diff --git a/core1/lib/Twig/Node/Expression.php b/core1/lib/Twig/Node/Expression.php deleted file mode 100644 index a7382e7d..00000000 --- a/core1/lib/Twig/Node/Expression.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -abstract class Twig_Node_Expression extends Twig_Node -{ -} diff --git a/core1/lib/Twig/Node/Expression/Array.php b/core1/lib/Twig/Node/Expression/Array.php deleted file mode 100644 index 1da785fe..00000000 --- a/core1/lib/Twig/Node/Expression/Array.php +++ /dev/null @@ -1,86 +0,0 @@ -index = -1; - foreach ($this->getKeyValuePairs() as $pair) { - if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { - $this->index = $pair['key']->getAttribute('value'); - } - } - } - - public function getKeyValuePairs() - { - $pairs = array(); - - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array( - 'key' => $pair[0], - 'value' => $pair[1], - ); - } - - return $pairs; - } - - public function hasElement(Twig_Node_Expression $key) - { - foreach ($this->getKeyValuePairs() as $pair) { - // we compare the string representation of the keys - // to avoid comparing the line numbers which are not relevant here. - if ((string) $key == (string) $pair['key']) { - return true; - } - } - - return false; - } - - public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null) - { - if (null === $key) { - $key = new Twig_Node_Expression_Constant(++$this->index, $value->getLine()); - } - - array_push($this->nodes, $key, $value); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('array('); - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ->subcompile($pair['value']) - ; - } - $compiler->raw(')'); - } -} diff --git a/core1/lib/Twig/Node/Expression/AssignName.php b/core1/lib/Twig/Node/Expression/AssignName.php deleted file mode 100644 index 2ddea78c..00000000 --- a/core1/lib/Twig/Node/Expression/AssignName.php +++ /dev/null @@ -1,28 +0,0 @@ -raw('$context[') - ->string($this->getAttribute('name')) - ->raw(']') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary.php b/core1/lib/Twig/Node/Expression/Binary.php deleted file mode 100644 index 9dd5de2c..00000000 --- a/core1/lib/Twig/Node/Expression/Binary.php +++ /dev/null @@ -1,40 +0,0 @@ - $left, 'right' => $right), array(), $lineno); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('left')) - ->raw(' ') - ; - $this->operator($compiler); - $compiler - ->raw(' ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - abstract public function operator(Twig_Compiler $compiler); -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Add.php b/core1/lib/Twig/Node/Expression/Binary/Add.php deleted file mode 100644 index 0ef8e117..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Add.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('+'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/And.php b/core1/lib/Twig/Node/Expression/Binary/And.php deleted file mode 100644 index d5752ebb..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/And.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('&&'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/core1/lib/Twig/Node/Expression/Binary/BitwiseAnd.php deleted file mode 100644 index 9a46d845..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('&'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/core1/lib/Twig/Node/Expression/Binary/BitwiseOr.php deleted file mode 100644 index 058a20bf..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/BitwiseOr.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('|'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/core1/lib/Twig/Node/Expression/Binary/BitwiseXor.php deleted file mode 100644 index f4da73d4..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/BitwiseXor.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('^'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Concat.php b/core1/lib/Twig/Node/Expression/Binary/Concat.php deleted file mode 100644 index f9a64627..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Concat.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('.'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Div.php b/core1/lib/Twig/Node/Expression/Binary/Div.php deleted file mode 100644 index e0797a61..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Div.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('/'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Equal.php b/core1/lib/Twig/Node/Expression/Binary/Equal.php deleted file mode 100644 index 7b1236d0..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Equal.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('=='); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/FloorDiv.php b/core1/lib/Twig/Node/Expression/Binary/FloorDiv.php deleted file mode 100644 index 7fbd0556..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/FloorDiv.php +++ /dev/null @@ -1,29 +0,0 @@ -raw('intval(floor('); - parent::compile($compiler); - $compiler->raw('))'); - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('/'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Greater.php b/core1/lib/Twig/Node/Expression/Binary/Greater.php deleted file mode 100644 index a110bd92..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Greater.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('>'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/core1/lib/Twig/Node/Expression/Binary/GreaterEqual.php deleted file mode 100644 index 3754fed2..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/GreaterEqual.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('>='); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/In.php b/core1/lib/Twig/Node/Expression/Binary/In.php deleted file mode 100644 index 788f9377..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/In.php +++ /dev/null @@ -1,33 +0,0 @@ -raw('twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('in'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Less.php b/core1/lib/Twig/Node/Expression/Binary/Less.php deleted file mode 100644 index 45fd3004..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Less.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('<'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/LessEqual.php b/core1/lib/Twig/Node/Expression/Binary/LessEqual.php deleted file mode 100644 index e38e257c..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/LessEqual.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('<='); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Mod.php b/core1/lib/Twig/Node/Expression/Binary/Mod.php deleted file mode 100644 index 9924114f..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Mod.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('%'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Mul.php b/core1/lib/Twig/Node/Expression/Binary/Mul.php deleted file mode 100644 index c91529ca..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Mul.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('*'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/NotEqual.php b/core1/lib/Twig/Node/Expression/Binary/NotEqual.php deleted file mode 100644 index 26867ba2..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/NotEqual.php +++ /dev/null @@ -1,17 +0,0 @@ -raw('!='); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/NotIn.php b/core1/lib/Twig/Node/Expression/Binary/NotIn.php deleted file mode 100644 index f347b7b6..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/NotIn.php +++ /dev/null @@ -1,33 +0,0 @@ -raw('!twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('not in'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Or.php b/core1/lib/Twig/Node/Expression/Binary/Or.php deleted file mode 100644 index adba49c6..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Or.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('||'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Power.php b/core1/lib/Twig/Node/Expression/Binary/Power.php deleted file mode 100644 index b2c59040..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Power.php +++ /dev/null @@ -1,33 +0,0 @@ -raw('pow(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('**'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Range.php b/core1/lib/Twig/Node/Expression/Binary/Range.php deleted file mode 100644 index bea4f2a6..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Range.php +++ /dev/null @@ -1,33 +0,0 @@ -raw('range(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('..'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Binary/Sub.php b/core1/lib/Twig/Node/Expression/Binary/Sub.php deleted file mode 100644 index d4463991..00000000 --- a/core1/lib/Twig/Node/Expression/Binary/Sub.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('-'); - } -} diff --git a/core1/lib/Twig/Node/Expression/BlockReference.php b/core1/lib/Twig/Node/Expression/BlockReference.php deleted file mode 100644 index 647196eb..00000000 --- a/core1/lib/Twig/Node/Expression/BlockReference.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -class Twig_Node_Expression_BlockReference extends Twig_Node_Expression -{ - public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null) - { - parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('as_string')) { - $compiler->raw('(string) '); - } - - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write("\$this->displayBlock(") - ->subcompile($this->getNode('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw("\$this->renderBlock(") - ->subcompile($this->getNode('name')) - ->raw(", \$context, \$blocks)") - ; - } - } -} diff --git a/core1/lib/Twig/Node/Expression/Call.php b/core1/lib/Twig/Node/Expression/Call.php deleted file mode 100644 index a97b3b57..00000000 --- a/core1/lib/Twig/Node/Expression/Call.php +++ /dev/null @@ -1,171 +0,0 @@ -getAttribute('callable'); - - $closingParenthesis = false; - if ($callable) { - if (is_string($callable)) { - $compiler->raw($callable); - } elseif (is_array($callable) && $callable[0] instanceof Twig_ExtensionInterface) { - $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', $callable[0]->getName(), $callable[1])); - } else { - $type = ucfirst($this->getAttribute('type')); - $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', $type, $this->getAttribute('name'))); - $closingParenthesis = true; - } - } else { - $compiler->raw($this->getAttribute('thing')->compile()); - } - - $this->compileArguments($compiler); - - if ($closingParenthesis) { - $compiler->raw(')'); - } - } - - protected function compileArguments(Twig_Compiler $compiler) - { - $compiler->raw('('); - - $first = true; - - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - $compiler->raw('$this->env'); - $first = false; - } - - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$context'); - $first = false; - } - - if ($this->hasAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->string($argument); - $first = false; - } - } - - if ($this->hasNode('node')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($this->getNode('node')); - $first = false; - } - - if ($this->hasNode('arguments') && null !== $this->getNode('arguments')) { - $callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null; - - $arguments = $this->getArguments($callable, $this->getNode('arguments')); - - foreach ($arguments as $node) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($node); - $first = false; - } - } - - $compiler->raw(')'); - } - - protected function getArguments($callable, $arguments) - { - $parameters = array(); - $named = false; - foreach ($arguments as $name => $node) { - if (!is_int($name)) { - $named = true; - $name = $this->normalizeName($name); - } - $parameters[$name] = $node; - } - - if (!$named) { - return $parameters; - } - - if (!$callable) { - throw new LogicException(sprintf('Named arguments are not supported for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name'))); - } - - // manage named arguments - if (is_array($callable)) { - $r = new ReflectionMethod($callable[0], $callable[1]); - } elseif (is_object($callable) && !$callable instanceof Closure) { - $r = new ReflectionObject($callable); - $r = $r->getMethod('__invoke'); - } else { - $r = new ReflectionFunction($callable); - } - - $definition = $r->getParameters(); - if ($this->hasNode('node')) { - array_shift($definition); - } - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - array_shift($definition); - } - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - array_shift($definition); - } - if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - array_shift($definition); - } - } - - $arguments = array(); - $pos = 0; - foreach ($definition as $param) { - $name = $this->normalizeName($param->name); - - if (array_key_exists($name, $parameters)) { - $arguments[] = $parameters[$name]; - unset($parameters[$name]); - } elseif (array_key_exists($pos, $parameters)) { - $arguments[] = $parameters[$pos]; - unset($parameters[$pos]); - ++$pos; - } elseif ($param->isDefaultValueAvailable()) { - $arguments[] = new Twig_Node_Expression_Constant($param->getDefaultValue(), -1); - } elseif ($param->isOptional()) { - break; - } else { - throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); - } - } - - foreach (array_keys($parameters) as $name) { - throw new Twig_Error_Syntax(sprintf('Unknown argument "%s" for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); - } - - return $arguments; - } - - protected function normalizeName($name) - { - return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $name)); - } -} diff --git a/core1/lib/Twig/Node/Expression/Conditional.php b/core1/lib/Twig/Node/Expression/Conditional.php deleted file mode 100644 index edcb1e2d..00000000 --- a/core1/lib/Twig/Node/Expression/Conditional.php +++ /dev/null @@ -1,31 +0,0 @@ - $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ? (') - ->subcompile($this->getNode('expr2')) - ->raw(') : (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Constant.php b/core1/lib/Twig/Node/Expression/Constant.php deleted file mode 100644 index a91dc698..00000000 --- a/core1/lib/Twig/Node/Expression/Constant.php +++ /dev/null @@ -1,23 +0,0 @@ - $value), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->repr($this->getAttribute('value')); - } -} diff --git a/core1/lib/Twig/Node/Expression/ExtensionReference.php b/core1/lib/Twig/Node/Expression/ExtensionReference.php deleted file mode 100644 index 00ac6701..00000000 --- a/core1/lib/Twig/Node/Expression/ExtensionReference.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('name' => $name), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); - } -} diff --git a/core1/lib/Twig/Node/Expression/Filter.php b/core1/lib/Twig/Node/Expression/Filter.php deleted file mode 100644 index 207b062a..00000000 --- a/core1/lib/Twig/Node/Expression/Filter.php +++ /dev/null @@ -1,36 +0,0 @@ - $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getNode('filter')->getAttribute('value'); - $filter = $compiler->getEnvironment()->getFilter($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'filter'); - $this->setAttribute('thing', $filter); - $this->setAttribute('needs_environment', $filter->needsEnvironment()); - $this->setAttribute('needs_context', $filter->needsContext()); - $this->setAttribute('arguments', $filter->getArguments()); - if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { - $this->setAttribute('callable', $filter->getCallable()); - } - - $this->compileCallable($compiler); - } -} diff --git a/core1/lib/Twig/Node/Expression/Filter/Default.php b/core1/lib/Twig/Node/Expression/Filter/Default.php deleted file mode 100644 index 1827c888..00000000 --- a/core1/lib/Twig/Node/Expression/Filter/Default.php +++ /dev/null @@ -1,43 +0,0 @@ - - * {{ var.foo|default('foo item on var is not defined') }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter -{ - public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) - { - $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine()); - - if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { - $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine()); - $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine()); - - $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine()); - } else { - $node = $default; - } - - parent::__construct($node, $filterName, $arguments, $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} diff --git a/core1/lib/Twig/Node/Expression/Function.php b/core1/lib/Twig/Node/Expression/Function.php deleted file mode 100644 index 3e1f6b55..00000000 --- a/core1/lib/Twig/Node/Expression/Function.php +++ /dev/null @@ -1,35 +0,0 @@ - $arguments), array('name' => $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $function = $compiler->getEnvironment()->getFunction($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'function'); - $this->setAttribute('thing', $function); - $this->setAttribute('needs_environment', $function->needsEnvironment()); - $this->setAttribute('needs_context', $function->needsContext()); - $this->setAttribute('arguments', $function->getArguments()); - if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) { - $this->setAttribute('callable', $function->getCallable()); - } - - $this->compileCallable($compiler); - } -} diff --git a/core1/lib/Twig/Node/Expression/GetAttr.php b/core1/lib/Twig/Node/Expression/GetAttr.php deleted file mode 100644 index 81a9b137..00000000 --- a/core1/lib/Twig/Node/Expression/GetAttr.php +++ /dev/null @@ -1,53 +0,0 @@ - $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) { - $compiler->raw('twig_template_get_attributes($this, '); - } else { - $compiler->raw('$this->getAttribute('); - } - - if ($this->getAttribute('ignore_strict_check')) { - $this->getNode('node')->setAttribute('ignore_strict_check', true); - } - - $compiler->subcompile($this->getNode('node')); - - $compiler->raw(', ')->subcompile($this->getNode('attribute')); - - if (count($this->getNode('arguments')) || Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { - $compiler->raw(', ')->subcompile($this->getNode('arguments')); - - if (Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { - $compiler->raw(', ')->repr($this->getAttribute('type')); - } - - if ($this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { - $compiler->raw(', '.($this->getAttribute('is_defined_test') ? 'true' : 'false')); - } - - if ($this->getAttribute('ignore_strict_check')) { - $compiler->raw(', '.($this->getAttribute('ignore_strict_check') ? 'true' : 'false')); - } - } - - $compiler->raw(')'); - } -} diff --git a/core1/lib/Twig/Node/Expression/MethodCall.php b/core1/lib/Twig/Node/Expression/MethodCall.php deleted file mode 100644 index 620b02bf..00000000 --- a/core1/lib/Twig/Node/Expression/MethodCall.php +++ /dev/null @@ -1,41 +0,0 @@ - $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); - - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('always_defined', true); - } - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->subcompile($this->getNode('node')) - ->raw('->') - ->raw($this->getAttribute('method')) - ->raw('(') - ; - $first = true; - foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler->subcompile($pair['value']); - } - $compiler->raw(')'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Name.php b/core1/lib/Twig/Node/Expression/Name.php deleted file mode 100644 index 3b8fae01..00000000 --- a/core1/lib/Twig/Node/Expression/Name.php +++ /dev/null @@ -1,88 +0,0 @@ - '$this', - '_context' => '$context', - '_charset' => '$this->env->getCharset()', - ); - - public function __construct($name, $lineno) - { - parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - - if ($this->getAttribute('is_defined_test')) { - if ($this->isSpecial()) { - $compiler->repr(true); - } else { - $compiler->raw('array_key_exists(')->repr($name)->raw(', $context)'); - } - } elseif ($this->isSpecial()) { - $compiler->raw($this->specialVars[$name]); - } elseif ($this->getAttribute('always_defined')) { - $compiler - ->raw('$context[') - ->string($name) - ->raw(']') - ; - } else { - // remove the non-PHP 5.4 version when PHP 5.3 support is dropped - // as the non-optimized version is just a workaround for slow ternary operator - // when the context has a lot of variables - if (version_compare(phpversion(), '5.4.0RC1', '>=')) { - // PHP 5.4 ternary operator performance was optimized - $compiler - ->raw('(isset($context[') - ->string($name) - ->raw(']) ? $context[') - ->string($name) - ->raw('] : ') - ; - - if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { - $compiler->raw('null)'); - } else { - $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); - } - } else { - $compiler - ->raw('$this->getContext($context, ') - ->string($name) - ; - - if ($this->getAttribute('ignore_strict_check')) { - $compiler->raw(', true'); - } - - $compiler - ->raw(')') - ; - } - } - } - - public function isSpecial() - { - return isset($this->specialVars[$this->getAttribute('name')]); - } - - public function isSimple() - { - return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Parent.php b/core1/lib/Twig/Node/Expression/Parent.php deleted file mode 100644 index dcf618c0..00000000 --- a/core1/lib/Twig/Node/Expression/Parent.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class Twig_Node_Expression_Parent extends Twig_Node_Expression -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write("\$this->displayParentBlock(") - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw("\$this->renderParentBlock(") - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks)") - ; - } - } -} diff --git a/core1/lib/Twig/Node/Expression/TempName.php b/core1/lib/Twig/Node/Expression/TempName.php deleted file mode 100644 index e6b058e8..00000000 --- a/core1/lib/Twig/Node/Expression/TempName.php +++ /dev/null @@ -1,26 +0,0 @@ - $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('$_') - ->raw($this->getAttribute('name')) - ->raw('_') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test.php b/core1/lib/Twig/Node/Expression/Test.php deleted file mode 100644 index 639f501a..00000000 --- a/core1/lib/Twig/Node/Expression/Test.php +++ /dev/null @@ -1,32 +0,0 @@ - $node, 'arguments' => $arguments), array('name' => $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $test = $compiler->getEnvironment()->getTest($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'test'); - $this->setAttribute('thing', $test); - if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) { - $this->setAttribute('callable', $test->getCallable()); - } - - $this->compileCallable($compiler); - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Constant.php b/core1/lib/Twig/Node/Expression/Test/Constant.php deleted file mode 100644 index 45b1e5da..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Constant.php +++ /dev/null @@ -1,35 +0,0 @@ - - * {% if post.status is constant('Post::PUBLISHED') %} - * the status attribute is exactly the same as Post::PUBLISHED - * {% endif %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === constant(') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw('))') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Defined.php b/core1/lib/Twig/Node/Expression/Test/Defined.php deleted file mode 100644 index 85b07f59..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Defined.php +++ /dev/null @@ -1,54 +0,0 @@ - - * {# defined works with variable names and variable attributes #} - * {% if foo is defined %} - * {# ... #} - * {% endif %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test -{ - public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) - { - parent::__construct($node, $name, $arguments, $lineno); - - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_GetAttr) { - $node->setAttribute('is_defined_test', true); - - $this->changeIgnoreStrictCheck($node); - } else { - throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine(), $compiler->getFilename()); - } - } - - protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node) - { - $node->setAttribute('ignore_strict_check', true); - - if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) { - $this->changeIgnoreStrictCheck($node->getNode('node')); - } - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Divisibleby.php b/core1/lib/Twig/Node/Expression/Test/Divisibleby.php deleted file mode 100644 index 0aceb530..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Divisibleby.php +++ /dev/null @@ -1,33 +0,0 @@ - - * {% if loop.index is divisibleby(3) %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(0 == ') - ->subcompile($this->getNode('node')) - ->raw(' % ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Even.php b/core1/lib/Twig/Node/Expression/Test/Even.php deleted file mode 100644 index d7853e89..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Even.php +++ /dev/null @@ -1,32 +0,0 @@ - - * {{ var is even }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 0') - ->raw(')') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Null.php b/core1/lib/Twig/Node/Expression/Test/Null.php deleted file mode 100644 index 1c83825a..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Null.php +++ /dev/null @@ -1,31 +0,0 @@ - - * {{ var is none }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(null === ') - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Odd.php b/core1/lib/Twig/Node/Expression/Test/Odd.php deleted file mode 100644 index 421c19e8..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Odd.php +++ /dev/null @@ -1,32 +0,0 @@ - - * {{ var is odd }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Test/Sameas.php b/core1/lib/Twig/Node/Expression/Test/Sameas.php deleted file mode 100644 index b48905ee..00000000 --- a/core1/lib/Twig/Node/Expression/Test/Sameas.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} diff --git a/core1/lib/Twig/Node/Expression/Unary.php b/core1/lib/Twig/Node/Expression/Unary.php deleted file mode 100644 index c514388e..00000000 --- a/core1/lib/Twig/Node/Expression/Unary.php +++ /dev/null @@ -1,30 +0,0 @@ - $node), array(), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('('); - $this->operator($compiler); - $compiler - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } - - abstract public function operator(Twig_Compiler $compiler); -} diff --git a/core1/lib/Twig/Node/Expression/Unary/Neg.php b/core1/lib/Twig/Node/Expression/Unary/Neg.php deleted file mode 100644 index 2a3937ec..00000000 --- a/core1/lib/Twig/Node/Expression/Unary/Neg.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('-'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Unary/Not.php b/core1/lib/Twig/Node/Expression/Unary/Not.php deleted file mode 100644 index f94073cf..00000000 --- a/core1/lib/Twig/Node/Expression/Unary/Not.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('!'); - } -} diff --git a/core1/lib/Twig/Node/Expression/Unary/Pos.php b/core1/lib/Twig/Node/Expression/Unary/Pos.php deleted file mode 100644 index 04edb52a..00000000 --- a/core1/lib/Twig/Node/Expression/Unary/Pos.php +++ /dev/null @@ -1,18 +0,0 @@ -raw('+'); - } -} diff --git a/core1/lib/Twig/Node/Flush.php b/core1/lib/Twig/Node/Flush.php deleted file mode 100644 index 0467ddce..00000000 --- a/core1/lib/Twig/Node/Flush.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class Twig_Node_Flush extends Twig_Node -{ - public function __construct($lineno, $tag) - { - parent::__construct(array(), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("flush();\n") - ; - } -} diff --git a/core1/lib/Twig/Node/For.php b/core1/lib/Twig/Node/For.php deleted file mode 100644 index 20e543c2..00000000 --- a/core1/lib/Twig/Node/For.php +++ /dev/null @@ -1,112 +0,0 @@ - - */ -class Twig_Node_For extends Twig_Node -{ - protected $loop; - - public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null) - { - $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag))); - - if (null !== $ifexpr) { - $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag); - } - - parent::__construct(array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body, 'else' => $else), array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - // the (array) cast bypasses a PHP 5.2.6 bug - ->write("\$context['_parent'] = (array) \$context;\n") - ->write("\$context['_seq'] = twig_ensure_traversable(") - ->subcompile($this->getNode('seq')) - ->raw(");\n") - ; - - if (null !== $this->getNode('else')) { - $compiler->write("\$context['_iterated'] = false;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("\$context['loop'] = array(\n") - ->write(" 'parent' => \$context['_parent'],\n") - ->write(" 'index0' => 0,\n") - ->write(" 'index' => 1,\n") - ->write(" 'first' => true,\n") - ->write(");\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) {\n") - ->indent() - ->write("\$length = count(\$context['_seq']);\n") - ->write("\$context['loop']['revindex0'] = \$length - 1;\n") - ->write("\$context['loop']['revindex'] = \$length;\n") - ->write("\$context['loop']['length'] = \$length;\n") - ->write("\$context['loop']['last'] = 1 === \$length;\n") - ->outdent() - ->write("}\n") - ; - } - } - - $this->loop->setAttribute('else', null !== $this->getNode('else')); - $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); - $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); - - $compiler - ->write("foreach (\$context['_seq'] as ") - ->subcompile($this->getNode('key_target')) - ->raw(" => ") - ->subcompile($this->getNode('value_target')) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n") - ; - - if (null !== $this->getNode('else')) { - $compiler - ->write("if (!\$context['_iterated']) {\n") - ->indent() - ->subcompile($this->getNode('else')) - ->outdent() - ->write("}\n") - ; - } - - $compiler->write("\$_parent = \$context['_parent'];\n"); - - // remove some "private" loop variables (needed for nested loops) - $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); - - // keep the values set in the inner context for variables defined in the outer context - $compiler->write("\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent));\n"); - } -} diff --git a/core1/lib/Twig/Node/ForLoop.php b/core1/lib/Twig/Node/ForLoop.php deleted file mode 100644 index b8841583..00000000 --- a/core1/lib/Twig/Node/ForLoop.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -class Twig_Node_ForLoop extends Twig_Node -{ - public function __construct($lineno, $tag = null) - { - parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('else')) { - $compiler->write("\$context['_iterated'] = true;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("++\$context['loop']['index0'];\n") - ->write("++\$context['loop']['index'];\n") - ->write("\$context['loop']['first'] = false;\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (isset(\$context['loop']['length'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } - } -} diff --git a/core1/lib/Twig/Node/If.php b/core1/lib/Twig/Node/If.php deleted file mode 100644 index 4296a8d6..00000000 --- a/core1/lib/Twig/Node/If.php +++ /dev/null @@ -1,66 +0,0 @@ - - */ -class Twig_Node_If extends Twig_Node -{ - public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null) - { - parent::__construct(array('tests' => $tests, 'else' => $else), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0; $i < count($this->getNode('tests')); $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write("} elseif (") - ; - } else { - $compiler - ->write('if (') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else') && null !== $this->getNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} diff --git a/core1/lib/Twig/Node/Import.php b/core1/lib/Twig/Node/Import.php deleted file mode 100644 index 99efc091..00000000 --- a/core1/lib/Twig/Node/Import.php +++ /dev/null @@ -1,50 +0,0 @@ - - */ -class Twig_Node_Import extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('var')) - ->raw(' = ') - ; - - if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { - $compiler->raw("\$this"); - } else { - $compiler - ->raw('$this->env->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(")") - ; - } - - $compiler->raw(";\n"); - } -} diff --git a/core1/lib/Twig/Node/Include.php b/core1/lib/Twig/Node/Include.php deleted file mode 100644 index ed4a3751..00000000 --- a/core1/lib/Twig/Node/Include.php +++ /dev/null @@ -1,99 +0,0 @@ - - */ -class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (Boolean) $only, 'ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->write("try {\n") - ->indent() - ; - } - - $this->addGetTemplate($compiler); - - $compiler->raw('->display('); - - $this->addTemplateArguments($compiler); - - $compiler->raw(");\n"); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n\n") - ; - } - } - - protected function addGetTemplate(Twig_Compiler $compiler) - { - if ($this->getNode('expr') instanceof Twig_Node_Expression_Constant) { - $compiler - ->write("\$this->env->loadTemplate(") - ->subcompile($this->getNode('expr')) - ->raw(")") - ; - } else { - $compiler - ->write("\$template = \$this->env->resolveTemplate(") - ->subcompile($this->getNode('expr')) - ->raw(");\n") - ->write('$template') - ; - } - } - - protected function addTemplateArguments(Twig_Compiler $compiler) - { - if (false === $this->getAttribute('only')) { - if (null === $this->getNode('variables')) { - $compiler->raw('$context'); - } else { - $compiler - ->raw('array_merge($context, ') - ->subcompile($this->getNode('variables')) - ->raw(')') - ; - } - } else { - if (null === $this->getNode('variables')) { - $compiler->raw('array()'); - } else { - $compiler->subcompile($this->getNode('variables')); - } - } - } -} diff --git a/core1/lib/Twig/Node/Macro.php b/core1/lib/Twig/Node/Macro.php deleted file mode 100644 index 89910618..00000000 --- a/core1/lib/Twig/Node/Macro.php +++ /dev/null @@ -1,96 +0,0 @@ - - */ -class Twig_Node_Macro extends Twig_Node -{ - public function __construct($name, Twig_NodeInterface $body, Twig_NodeInterface $arguments, $lineno, $tag = null) - { - parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("public function get%s(", $this->getAttribute('name'))) - ; - - $count = count($this->getNode('arguments')); - $pos = 0; - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->raw('$_'.$name.' = ') - ->subcompile($default) - ; - - if (++$pos < $count) { - $compiler->raw(', '); - } - } - - $compiler - ->raw(")\n") - ->write("{\n") - ->indent() - ; - - if (!count($this->getNode('arguments'))) { - $compiler->write("\$context = \$this->env->getGlobals();\n\n"); - } else { - $compiler - ->write("\$context = \$this->env->mergeGlobals(array(\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $_'.$name) - ->raw(",\n") - ; - } - - $compiler - ->outdent() - ->write("));\n\n") - ; - } - - $compiler - ->write("\$blocks = array();\n\n") - ->write("ob_start();\n") - ->write("try {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("} catch (Exception \$e) {\n") - ->indent() - ->write("ob_end_clean();\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n") - ->outdent() - ->write("}\n\n") - ; - } -} diff --git a/core1/lib/Twig/Node/Module.php b/core1/lib/Twig/Node/Module.php deleted file mode 100644 index 585048b8..00000000 --- a/core1/lib/Twig/Node/Module.php +++ /dev/null @@ -1,371 +0,0 @@ - - */ -class Twig_Node_Module extends Twig_Node -{ - public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $filename) - { - // embedded templates are set as attributes so that they are only visited once by the visitors - parent::__construct(array('parent' => $parent, 'body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits), array('filename' => $filename, 'index' => null, 'embedded_templates' => $embeddedTemplates), 1); - } - - public function setIndex($index) - { - $this->setAttribute('index', $index); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $this->compileTemplate($compiler); - - foreach ($this->getAttribute('embedded_templates') as $template) { - $compiler->subcompile($template); - } - } - - protected function compileTemplate(Twig_Compiler $compiler) - { - if (!$this->getAttribute('index')) { - $compiler->write('compileClassHeader($compiler); - - if (count($this->getNode('blocks')) || count($this->getNode('traits')) || null === $this->getNode('parent') || $this->getNode('parent') instanceof Twig_Node_Expression_Constant) { - $this->compileConstructor($compiler); - } - - $this->compileGetParent($compiler); - - $this->compileDisplayHeader($compiler); - - $this->compileDisplayBody($compiler); - - $this->compileDisplayFooter($compiler); - - $compiler->subcompile($this->getNode('blocks')); - - $this->compileMacros($compiler); - - $this->compileGetTemplateName($compiler); - - $this->compileIsTraitable($compiler); - - $this->compileDebugInfo($compiler); - - $this->compileClassFooter($compiler); - } - - protected function compileGetParent(Twig_Compiler $compiler) - { - if (null === $this->getNode('parent')) { - return; - } - - $compiler - ->write("protected function doGetParent(array \$context)\n", "{\n") - ->indent() - ->write("return ") - ; - - if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { - $compiler->subcompile($this->getNode('parent')); - } else { - $compiler - ->raw("\$this->env->resolveTemplate(") - ->subcompile($this->getNode('parent')) - ->raw(")") - ; - } - - $compiler - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDisplayBody(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('body')); - - if (null !== $this->getNode('parent')) { - if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { - $compiler->write("\$this->parent"); - } else { - $compiler->write("\$this->getParent(\$context)"); - } - $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); - } - } - - protected function compileClassHeader(Twig_Compiler $compiler) - { - $compiler - ->write("\n\n") - // if the filename contains */, add a blank to avoid a PHP parse error - ->write("/* ".str_replace('*/', '* /', $this->getAttribute('filename'))." */\n") - ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'), $this->getAttribute('index'))) - ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass())) - ->write("{\n") - ->indent() - ; - } - - protected function compileConstructor(Twig_Compiler $compiler) - { - $compiler - ->write("public function __construct(Twig_Environment \$env)\n", "{\n") - ->indent() - ->write("parent::__construct(\$env);\n\n") - ; - - // parent - if (null === $this->getNode('parent')) { - $compiler->write("\$this->parent = false;\n\n"); - } elseif ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { - $compiler - ->write("\$this->parent = \$this->env->loadTemplate(") - ->subcompile($this->getNode('parent')) - ->raw(");\n\n") - ; - } - - $countTraits = count($this->getNode('traits')); - if ($countTraits) { - // traits - foreach ($this->getNode('traits') as $i => $trait) { - $this->compileLoadTemplate($compiler, $trait->getNode('template'), sprintf('$_trait_%s', $i)); - - $compiler - ->addDebugInfo($trait->getNode('template')) - ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) - ->indent() - ->write("throw new Twig_Error_Runtime('Template \"'.") - ->subcompile($trait->getNode('template')) - ->raw(".'\" cannot be used as a trait.');\n") - ->outdent() - ->write("}\n") - ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) - ; - - foreach ($trait->getNode('targets') as $key => $value) { - $compiler - ->write(sprintf("\$_trait_%s_blocks[", $i)) - ->subcompile($value) - ->raw(sprintf("] = \$_trait_%s_blocks[", $i)) - ->string($key) - ->raw(sprintf("]; unset(\$_trait_%s_blocks[", $i)) - ->string($key) - ->raw("]);\n\n") - ; - } - } - - if ($countTraits > 1) { - $compiler - ->write("\$this->traits = array_merge(\n") - ->indent() - ; - - for ($i = 0; $i < $countTraits; $i++) { - $compiler - ->write(sprintf("\$_trait_%s_blocks".($i == $countTraits - 1 ? '' : ',')."\n", $i)) - ; - } - - $compiler - ->outdent() - ->write(");\n\n") - ; - } else { - $compiler - ->write("\$this->traits = \$_trait_0_blocks;\n\n") - ; - } - - $compiler - ->write("\$this->blocks = array_merge(\n") - ->indent() - ->write("\$this->traits,\n") - ->write("array(\n") - ; - } else { - $compiler - ->write("\$this->blocks = array(\n") - ; - } - - // blocks - $compiler - ->indent() - ; - - foreach ($this->getNode('blocks') as $name => $node) { - $compiler - ->write(sprintf("'%s' => array(\$this, 'block_%s'),\n", $name, $name)) - ; - } - - if ($countTraits) { - $compiler - ->outdent() - ->write(")\n") - ; - } - - $compiler - ->outdent() - ->write(");\n") - ->outdent() - ->write("}\n\n"); - ; - } - - protected function compileDisplayHeader(Twig_Compiler $compiler) - { - $compiler - ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n") - ->indent() - ; - } - - protected function compileDisplayFooter(Twig_Compiler $compiler) - { - $compiler - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassFooter(Twig_Compiler $compiler) - { - $compiler - ->outdent() - ->write("}\n") - ; - } - - protected function compileMacros(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('macros')); - } - - protected function compileGetTemplateName(Twig_Compiler $compiler) - { - $compiler - ->write("public function getTemplateName()\n", "{\n") - ->indent() - ->write('return ') - ->repr($this->getAttribute('filename')) - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileIsTraitable(Twig_Compiler $compiler) - { - // A template can be used as a trait if: - // * it has no parent - // * it has no macros - // * it has no body - // - // Put another way, a template can be used as a trait if it - // only contains blocks and use statements. - $traitable = null === $this->getNode('parent') && 0 === count($this->getNode('macros')); - if ($traitable) { - if ($this->getNode('body') instanceof Twig_Node_Body) { - $nodes = $this->getNode('body')->getNode(0); - } else { - $nodes = $this->getNode('body'); - } - - if (!count($nodes)) { - $nodes = new Twig_Node(array($nodes)); - } - - foreach ($nodes as $node) { - if (!count($node)) { - continue; - } - - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if ($node instanceof Twig_Node_BlockReference) { - continue; - } - - $traitable = false; - break; - } - } - - if ($traitable) { - return; - } - - $compiler - ->write("public function isTraitable()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDebugInfo(Twig_Compiler $compiler) - { - $compiler - ->write("public function getDebugInfo()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) - ->outdent() - ->write("}\n") - ; - } - - protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) - { - if ($node instanceof Twig_Node_Expression_Constant) { - $compiler - ->write(sprintf("%s = \$this->env->loadTemplate(", $var)) - ->subcompile($node) - ->raw(");\n") - ; - } else { - $compiler - ->write(sprintf("%s = ", $var)) - ->subcompile($node) - ->raw(";\n") - ->write(sprintf("if (!%s", $var)) - ->raw(" instanceof Twig_Template) {\n") - ->indent() - ->write(sprintf("%s = \$this->env->loadTemplate(%s);\n", $var, $var)) - ->outdent() - ->write("}\n") - ; - } - } -} diff --git a/core1/lib/Twig/Node/Print.php b/core1/lib/Twig/Node/Print.php deleted file mode 100644 index b0c41d1d..00000000 --- a/core1/lib/Twig/Node/Print.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} diff --git a/core1/lib/Twig/Node/Sandbox.php b/core1/lib/Twig/Node/Sandbox.php deleted file mode 100644 index 8cf3ed44..00000000 --- a/core1/lib/Twig/Node/Sandbox.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class Twig_Node_Sandbox extends Twig_Node -{ - public function __construct(Twig_NodeInterface $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("\$sandbox = \$this->env->getExtension('sandbox');\n") - ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") - ->indent() - ->write("\$sandbox->enableSandbox();\n") - ->outdent() - ->write("}\n") - ->subcompile($this->getNode('body')) - ->write("if (!\$alreadySandboxed) {\n") - ->indent() - ->write("\$sandbox->disableSandbox();\n") - ->outdent() - ->write("}\n") - ; - } -} diff --git a/core1/lib/Twig/Node/SandboxedModule.php b/core1/lib/Twig/Node/SandboxedModule.php deleted file mode 100644 index be1f5daa..00000000 --- a/core1/lib/Twig/Node/SandboxedModule.php +++ /dev/null @@ -1,60 +0,0 @@ - - */ -class Twig_Node_SandboxedModule extends Twig_Node_Module -{ - protected $usedFilters; - protected $usedTags; - protected $usedFunctions; - - public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions) - { - parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('embedded_templates'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag()); - - $this->setAttribute('index', $node->getAttribute('index')); - - $this->usedFilters = $usedFilters; - $this->usedTags = $usedTags; - $this->usedFunctions = $usedFunctions; - } - - protected function compileDisplayBody(Twig_Compiler $compiler) - { - $compiler->write("\$this->checkSecurity();\n"); - - parent::compileDisplayBody($compiler); - } - - protected function compileDisplayFooter(Twig_Compiler $compiler) - { - parent::compileDisplayFooter($compiler); - - $compiler - ->write("protected function checkSecurity()\n", "{\n") - ->indent() - ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n") - ->indent() - ->write(!$this->usedTags ? "array(),\n" : "array('".implode('\', \'', $this->usedTags)."'),\n") - ->write(!$this->usedFilters ? "array(),\n" : "array('".implode('\', \'', $this->usedFilters)."'),\n") - ->write(!$this->usedFunctions ? "array()\n" : "array('".implode('\', \'', $this->usedFunctions)."')\n") - ->outdent() - ->write(");\n") - ->outdent() - ->write("}\n\n") - ; - } -} diff --git a/core1/lib/Twig/Node/SandboxedPrint.php b/core1/lib/Twig/Node/SandboxedPrint.php deleted file mode 100644 index 73dfaa96..00000000 --- a/core1/lib/Twig/Node/SandboxedPrint.php +++ /dev/null @@ -1,59 +0,0 @@ - - */ -class Twig_Node_SandboxedPrint extends Twig_Node_Print -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct($expr, $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo $this->env->getExtension(\'sandbox\')->ensureToStringAllowed(') - ->subcompile($this->getNode('expr')) - ->raw(");\n") - ; - } - - /** - * Removes node filters. - * - * This is mostly needed when another visitor adds filters (like the escaper one). - * - * @param Twig_Node $node A Node - */ - protected function removeNodeFilter($node) - { - if ($node instanceof Twig_Node_Expression_Filter) { - return $this->removeNodeFilter($node->getNode('node')); - } - - return $node; - } -} diff --git a/core1/lib/Twig/Node/Set.php b/core1/lib/Twig/Node/Set.php deleted file mode 100644 index 4c9c16ce..00000000 --- a/core1/lib/Twig/Node/Set.php +++ /dev/null @@ -1,101 +0,0 @@ - - */ -class Twig_Node_Set extends Twig_Node -{ - public function __construct($capture, Twig_NodeInterface $names, Twig_NodeInterface $values, $lineno, $tag = null) - { - parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag); - - /* - * Optimizes the node when capture is used for a large block of text. - * - * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig_Markup("foo"); - */ - if ($this->getAttribute('capture')) { - $this->setAttribute('safe', true); - - $values = $this->getNode('values'); - if ($values instanceof Twig_Node_Text) { - $this->setNode('values', new Twig_Node_Expression_Constant($values->getAttribute('data'), $values->getLine())); - $this->setAttribute('capture', false); - } - } - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if (count($this->getNode('names')) > 1) { - $compiler->write('list('); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('capture')) { - $compiler - ->write("ob_start();\n") - ->subcompile($this->getNode('values')) - ; - } - - $compiler->subcompile($this->getNode('names'), false); - - if ($this->getAttribute('capture')) { - $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())"); - } - } - - if (!$this->getAttribute('capture')) { - $compiler->raw(' = '); - - if (count($this->getNode('names')) > 1) { - $compiler->write('array('); - foreach ($this->getNode('values') as $idx => $value) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($value); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('safe')) { - $compiler - ->raw("('' === \$tmp = ") - ->subcompile($this->getNode('values')) - ->raw(") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())") - ; - } else { - $compiler->subcompile($this->getNode('values')); - } - } - } - - $compiler->raw(";\n"); - } -} diff --git a/core1/lib/Twig/Node/SetTemp.php b/core1/lib/Twig/Node/SetTemp.php deleted file mode 100644 index 3bdd1cb7..00000000 --- a/core1/lib/Twig/Node/SetTemp.php +++ /dev/null @@ -1,35 +0,0 @@ - $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $compiler - ->addDebugInfo($this) - ->write('if (isset($context[') - ->string($name) - ->raw('])) { $_') - ->raw($name) - ->raw('_ = $context[') - ->repr($name) - ->raw(']; } else { $_') - ->raw($name) - ->raw("_ = null; }\n") - ; - } -} diff --git a/core1/lib/Twig/Node/Spaceless.php b/core1/lib/Twig/Node/Spaceless.php deleted file mode 100644 index 7555fa0f..00000000 --- a/core1/lib/Twig/Node/Spaceless.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class Twig_Node_Spaceless extends Twig_Node -{ - public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless') - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("ob_start();\n") - ->subcompile($this->getNode('body')) - ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") - ; - } -} diff --git a/core1/lib/Twig/Node/Text.php b/core1/lib/Twig/Node/Text.php deleted file mode 100644 index 21bdcea1..00000000 --- a/core1/lib/Twig/Node/Text.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($data, $lineno) - { - parent::__construct(array(), array('data' => $data), $lineno); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->string($this->getAttribute('data')) - ->raw(";\n") - ; - } -} diff --git a/core1/lib/Twig/NodeInterface.php b/core1/lib/Twig/NodeInterface.php deleted file mode 100644 index f0ef7258..00000000 --- a/core1/lib/Twig/NodeInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_NodeInterface extends Countable, IteratorAggregate -{ - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler); - - public function getLine(); - - public function getNodeTag(); -} diff --git a/core1/lib/Twig/NodeOutputInterface.php b/core1/lib/Twig/NodeOutputInterface.php deleted file mode 100644 index 22172c09..00000000 --- a/core1/lib/Twig/NodeOutputInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -interface Twig_NodeOutputInterface -{ -} diff --git a/core1/lib/Twig/NodeTraverser.php b/core1/lib/Twig/NodeTraverser.php deleted file mode 100644 index 28cba1ad..00000000 --- a/core1/lib/Twig/NodeTraverser.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ -class Twig_NodeTraverser -{ - protected $env; - protected $visitors; - - /** - * Constructor. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param array $visitors An array of Twig_NodeVisitorInterface instances - */ - public function __construct(Twig_Environment $env, array $visitors = array()) - { - $this->env = $env; - $this->visitors = array(); - foreach ($visitors as $visitor) { - $this->addVisitor($visitor); - } - } - - /** - * Adds a visitor. - * - * @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance - */ - public function addVisitor(Twig_NodeVisitorInterface $visitor) - { - if (!isset($this->visitors[$visitor->getPriority()])) { - $this->visitors[$visitor->getPriority()] = array(); - } - - $this->visitors[$visitor->getPriority()][] = $visitor; - } - - /** - * Traverses a node and calls the registered visitors. - * - * @param Twig_NodeInterface $node A Twig_NodeInterface instance - */ - public function traverse(Twig_NodeInterface $node) - { - ksort($this->visitors); - foreach ($this->visitors as $visitors) { - foreach ($visitors as $visitor) { - $node = $this->traverseForVisitor($visitor, $node); - } - } - - return $node; - } - - protected function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node = null) - { - if (null === $node) { - return null; - } - - $node = $visitor->enterNode($node, $this->env); - - foreach ($node as $k => $n) { - if (false !== $n = $this->traverseForVisitor($visitor, $n)) { - $node->setNode($k, $n); - } else { - $node->removeNode($k); - } - } - - return $visitor->leaveNode($node, $this->env); - } -} diff --git a/core1/lib/Twig/NodeVisitor/Escaper.php b/core1/lib/Twig/NodeVisitor/Escaper.php deleted file mode 100644 index cc4b3d71..00000000 --- a/core1/lib/Twig/NodeVisitor/Escaper.php +++ /dev/null @@ -1,167 +0,0 @@ - - */ -class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface -{ - protected $statusStack = array(); - protected $blocks = array(); - protected $safeAnalysis; - protected $traverser; - protected $defaultStrategy = false; - protected $safeVars = array(); - - public function __construct() - { - $this->safeAnalysis = new Twig_NodeVisitor_SafeAnalysis(); - } - - /** - * Called before child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface The modified node - */ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - if ($env->hasExtension('escaper') && $defaultStrategy = $env->getExtension('escaper')->getDefaultStrategy($node->getAttribute('filename'))) { - $this->defaultStrategy = $defaultStrategy; - } - $this->safeVars = array(); - } elseif ($node instanceof Twig_Node_AutoEscape) { - $this->statusStack[] = $node->getAttribute('value'); - } elseif ($node instanceof Twig_Node_Block) { - $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); - } elseif ($node instanceof Twig_Node_Import) { - $this->safeVars[] = $node->getNode('var')->getAttribute('name'); - } - - return $node; - } - - /** - * Called after child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface The modified node - */ - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->defaultStrategy = false; - $this->safeVars = array(); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - return $this->preEscapeFilterNode($node, $env); - } elseif ($node instanceof Twig_Node_Print) { - return $this->escapePrintNode($node, $env, $this->needEscaping($env)); - } - - if ($node instanceof Twig_Node_AutoEscape || $node instanceof Twig_Node_Block) { - array_pop($this->statusStack); - } elseif ($node instanceof Twig_Node_BlockReference) { - $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); - } - - return $node; - } - - protected function escapePrintNode(Twig_Node_Print $node, Twig_Environment $env, $type) - { - if (false === $type) { - return $node; - } - - $expression = $node->getNode('expr'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - $class = get_class($node); - - return new $class( - $this->getEscaperFilter($type, $expression), - $node->getLine() - ); - } - - protected function preEscapeFilterNode(Twig_Node_Expression_Filter $filter, Twig_Environment $env) - { - $name = $filter->getNode('filter')->getAttribute('value'); - - $type = $env->getFilter($name)->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); - - return $filter; - } - - protected function isSafeFor($type, Twig_NodeInterface $expression, $env) - { - $safe = $this->safeAnalysis->getSafe($expression); - - if (null === $safe) { - if (null === $this->traverser) { - $this->traverser = new Twig_NodeTraverser($env, array($this->safeAnalysis)); - } - - $this->safeAnalysis->setSafeVars($this->safeVars); - - $this->traverser->traverse($expression); - $safe = $this->safeAnalysis->getSafe($expression); - } - - return in_array($type, $safe) || in_array('all', $safe); - } - - protected function needEscaping(Twig_Environment $env) - { - if (count($this->statusStack)) { - return $this->statusStack[count($this->statusStack) - 1]; - } - - return $this->defaultStrategy ? $this->defaultStrategy : false; - } - - protected function getEscaperFilter($type, Twig_NodeInterface $node) - { - $line = $node->getLine(); - $name = new Twig_Node_Expression_Constant('escape', $line); - $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line), new Twig_Node_Expression_Constant(null, $line), new Twig_Node_Expression_Constant(true, $line))); - - return new Twig_Node_Expression_Filter($node, $name, $args, $line); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 0; - } -} diff --git a/core1/lib/Twig/NodeVisitor/Optimizer.php b/core1/lib/Twig/NodeVisitor/Optimizer.php deleted file mode 100644 index a254def7..00000000 --- a/core1/lib/Twig/NodeVisitor/Optimizer.php +++ /dev/null @@ -1,246 +0,0 @@ - - */ -class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface -{ - const OPTIMIZE_ALL = -1; - const OPTIMIZE_NONE = 0; - const OPTIMIZE_FOR = 2; - const OPTIMIZE_RAW_FILTER = 4; - const OPTIMIZE_VAR_ACCESS = 8; - - protected $loops = array(); - protected $optimizers; - protected $prependedNodes = array(); - protected $inABody = false; - - /** - * Constructor. - * - * @param integer $optimizers The optimizer mode - */ - public function __construct($optimizers = -1) - { - if (!is_int($optimizers) || $optimizers > 2) { - throw new InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); - } - - $this->optimizers = $optimizers; - } - - /** - * {@inheritdoc} - */ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->enterOptimizeFor($node, $env); - } - - if (!version_compare(phpversion(), '5.4.0RC1', '>=') && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('sandbox')) { - if ($this->inABody) { - if (!$node instanceof Twig_Node_Expression) { - if (get_class($node) !== 'Twig_Node') { - array_unshift($this->prependedNodes, array()); - } - } else { - $node = $this->optimizeVariables($node, $env); - } - } elseif ($node instanceof Twig_Node_Body) { - $this->inABody = true; - } - } - - return $node; - } - - /** - * {@inheritdoc} - */ - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - $expression = $node instanceof Twig_Node_Expression; - - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->leaveOptimizeFor($node, $env); - } - - if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { - $node = $this->optimizeRawFilter($node, $env); - } - - $node = $this->optimizePrintNode($node, $env); - - if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('sandbox')) { - if ($node instanceof Twig_Node_Body) { - $this->inABody = false; - } elseif ($this->inABody) { - if (!$expression && get_class($node) !== 'Twig_Node' && $prependedNodes = array_shift($this->prependedNodes)) { - $nodes = array(); - foreach (array_unique($prependedNodes) as $name) { - $nodes[] = new Twig_Node_SetTemp($name, $node->getLine()); - } - - $nodes[] = $node; - $node = new Twig_Node($nodes); - } - } - } - - return $node; - } - - protected function optimizeVariables($node, $env) - { - if ('Twig_Node_Expression_Name' === get_class($node) && $node->isSimple()) { - $this->prependedNodes[0][] = $node->getAttribute('name'); - - return new Twig_Node_Expression_TempName($node->getAttribute('name'), $node->getLine()); - } - - return $node; - } - - /** - * Optimizes print nodes. - * - * It replaces: - * - * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" - * - * @param Twig_NodeInterface $node A Node - * @param Twig_Environment $env The current Twig environment - */ - protected function optimizePrintNode($node, $env) - { - if (!$node instanceof Twig_Node_Print) { - return $node; - } - - if ( - $node->getNode('expr') instanceof Twig_Node_Expression_BlockReference || - $node->getNode('expr') instanceof Twig_Node_Expression_Parent - ) { - $node->getNode('expr')->setAttribute('output', true); - - return $node->getNode('expr'); - } - - return $node; - } - - /** - * Removes "raw" filters. - * - * @param Twig_NodeInterface $node A Node - * @param Twig_Environment $env The current Twig environment - */ - protected function optimizeRawFilter($node, $env) - { - if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) { - return $node->getNode('node'); - } - - return $node; - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - * - * @param Twig_NodeInterface $node A Node - * @param Twig_Environment $env The current Twig environment - */ - protected function enterOptimizeFor($node, $env) - { - if ($node instanceof Twig_Node_For) { - // disable the loop variable by default - $node->setAttribute('with_loop', false); - array_unshift($this->loops, $node); - } elseif (!$this->loops) { - // we are outside a loop - return; - } - - // when do we need to add the loop variable back? - - // the loop variable is referenced for the current loop - elseif ($node instanceof Twig_Node_Expression_Name && 'loop' === $node->getAttribute('name')) { - $this->addLoopToCurrent(); - } - - // block reference - elseif ($node instanceof Twig_Node_BlockReference || $node instanceof Twig_Node_Expression_BlockReference) { - $this->addLoopToCurrent(); - } - - // include without the only attribute - elseif ($node instanceof Twig_Node_Include && !$node->getAttribute('only')) { - $this->addLoopToAll(); - } - - // the loop variable is referenced via an attribute - elseif ($node instanceof Twig_Node_Expression_GetAttr - && (!$node->getNode('attribute') instanceof Twig_Node_Expression_Constant - || 'parent' === $node->getNode('attribute')->getAttribute('value') - ) - && (true === $this->loops[0]->getAttribute('with_loop') - || ($node->getNode('node') instanceof Twig_Node_Expression_Name - && 'loop' === $node->getNode('node')->getAttribute('name') - ) - ) - ) { - $this->addLoopToAll(); - } - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - * - * @param Twig_NodeInterface $node A Node - * @param Twig_Environment $env The current Twig environment - */ - protected function leaveOptimizeFor($node, $env) - { - if ($node instanceof Twig_Node_For) { - array_shift($this->loops); - } - } - - protected function addLoopToCurrent() - { - $this->loops[0]->setAttribute('with_loop', true); - } - - protected function addLoopToAll() - { - foreach ($this->loops as $loop) { - $loop->setAttribute('with_loop', true); - } - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 255; - } -} diff --git a/core1/lib/Twig/NodeVisitor/SafeAnalysis.php b/core1/lib/Twig/NodeVisitor/SafeAnalysis.php deleted file mode 100644 index 7dc65c0e..00000000 --- a/core1/lib/Twig/NodeVisitor/SafeAnalysis.php +++ /dev/null @@ -1,133 +0,0 @@ -safeVars = $safeVars; - } - - public function getSafe(Twig_NodeInterface $node) - { - $hash = spl_object_hash($node); - if (isset($this->data[$hash])) { - foreach ($this->data[$hash] as $bucket) { - if ($bucket['key'] === $node) { - return $bucket['value']; - } - } - } - - return null; - } - - protected function setSafe(Twig_NodeInterface $node, array $safe) - { - $hash = spl_object_hash($node); - if (isset($this->data[$hash])) { - foreach ($this->data[$hash] as &$bucket) { - if ($bucket['key'] === $node) { - $bucket['value'] = $safe; - - return; - } - } - } - $this->data[$hash][] = array( - 'key' => $node, - 'value' => $safe, - ); - } - - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - return $node; - } - - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_Constant) { - // constants are marked safe for all - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_BlockReference) { - // blocks are safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Parent) { - // parent block is safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Conditional) { - // intersect safeness of both operands - $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); - $this->setSafe($node, $safe); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - // filter expression is safe when the filter is safe - $name = $node->getNode('filter')->getAttribute('value'); - $args = $node->getNode('arguments'); - if (false !== $filter = $env->getFilter($name)) { - $safe = $filter->getSafe($args); - if (null === $safe) { - $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); - } - $this->setSafe($node, $safe); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_Function) { - // function expression is safe when the function is safe - $name = $node->getAttribute('name'); - $args = $node->getNode('arguments'); - $function = $env->getFunction($name); - if (false !== $function) { - $this->setSafe($node, $function->getSafe($args)); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_MethodCall) { - if ($node->getAttribute('safe')) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name) { - $name = $node->getNode('node')->getAttribute('name'); - // attributes on template instances are safe - if ('_self' == $name || in_array($name, $this->safeVars)) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } else { - $this->setSafe($node, array()); - } - - return $node; - } - - protected function intersectSafe(array $a = null, array $b = null) - { - if (null === $a || null === $b) { - return array(); - } - - if (in_array('all', $a)) { - return $b; - } - - if (in_array('all', $b)) { - return $a; - } - - return array_intersect($a, $b); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 0; - } -} diff --git a/core1/lib/Twig/NodeVisitor/Sandbox.php b/core1/lib/Twig/NodeVisitor/Sandbox.php deleted file mode 100644 index fb27045b..00000000 --- a/core1/lib/Twig/NodeVisitor/Sandbox.php +++ /dev/null @@ -1,92 +0,0 @@ - - */ -class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface -{ - protected $inAModule = false; - protected $tags; - protected $filters; - protected $functions; - - /** - * Called before child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface The modified node - */ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = true; - $this->tags = array(); - $this->filters = array(); - $this->functions = array(); - - return $node; - } elseif ($this->inAModule) { - // look for tags - if ($node->getNodeTag()) { - $this->tags[] = $node->getNodeTag(); - } - - // look for filters - if ($node instanceof Twig_Node_Expression_Filter) { - $this->filters[] = $node->getNode('filter')->getAttribute('value'); - } - - // look for functions - if ($node instanceof Twig_Node_Expression_Function) { - $this->functions[] = $node->getAttribute('name'); - } - - // wrap print to check __toString() calls - if ($node instanceof Twig_Node_Print) { - return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getLine(), $node->getNodeTag()); - } - } - - return $node; - } - - /** - * Called after child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface The modified node - */ - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = false; - - return new Twig_Node_SandboxedModule($node, array_unique($this->filters), array_unique($this->tags), array_unique($this->functions)); - } - - return $node; - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 0; - } -} diff --git a/core1/lib/Twig/NodeVisitorInterface.php b/core1/lib/Twig/NodeVisitorInterface.php deleted file mode 100644 index f33c13fc..00000000 --- a/core1/lib/Twig/NodeVisitorInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -interface Twig_NodeVisitorInterface -{ - /** - * Called before child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface The modified node - */ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env); - - /** - * Called after child nodes are visited. - * - * @param Twig_NodeInterface $node The node to visit - * @param Twig_Environment $env The Twig environment instance - * - * @return Twig_NodeInterface|false The modified node or false if the node must be removed - */ - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env); - - /** - * Returns the priority for this visitor. - * - * Priority should be between -10 and 10 (0 is the default). - * - * @return integer The priority level - */ - public function getPriority(); -} diff --git a/core1/lib/Twig/Parser.php b/core1/lib/Twig/Parser.php deleted file mode 100644 index 958e46b3..00000000 --- a/core1/lib/Twig/Parser.php +++ /dev/null @@ -1,394 +0,0 @@ - - */ -class Twig_Parser implements Twig_ParserInterface -{ - protected $stack = array(); - protected $stream; - protected $parent; - protected $handlers; - protected $visitors; - protected $expressionParser; - protected $blocks; - protected $blockStack; - protected $macros; - protected $env; - protected $reservedMacroNames; - protected $importedSymbols; - protected $traits; - protected $embeddedTemplates = array(); - - /** - * Constructor. - * - * @param Twig_Environment $env A Twig_Environment instance - */ - public function __construct(Twig_Environment $env) - { - $this->env = $env; - } - - public function getEnvironment() - { - return $this->env; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha1', uniqid(mt_rand(), true), false)); - } - - public function getFilename() - { - return $this->stream->getFilename(); - } - - /** - * Converts a token stream to a node tree. - * - * @param Twig_TokenStream $stream A token stream instance - * - * @return Twig_Node_Module A node tree - */ - public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false) - { - // push all variables into the stack to keep the current state of the parser - $vars = get_object_vars($this); - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser']); - $this->stack[] = $vars; - - // tag handlers - if (null === $this->handlers) { - $this->handlers = $this->env->getTokenParsers(); - $this->handlers->setParser($this); - } - - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); - } - - if (null === $this->expressionParser) { - $this->expressionParser = new Twig_ExpressionParser($this, $this->env->getUnaryOperators(), $this->env->getBinaryOperators()); - } - - $this->stream = $stream; - $this->parent = null; - $this->blocks = array(); - $this->macros = array(); - $this->traits = array(); - $this->blockStack = array(); - $this->importedSymbols = array(array()); - $this->embeddedTemplates = array(); - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent) { - if (null === $body = $this->filterBodyNodes($body)) { - $body = new Twig_Node(); - } - } - } catch (Twig_Error_Syntax $e) { - if (!$e->getTemplateFile()) { - $e->setTemplateFile($this->getFilename()); - } - - if (!$e->getTemplateLine()) { - $e->setTemplateLine($this->stream->getCurrent()->getLine()); - } - - throw $e; - } - - $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $this->getFilename()); - - $traverser = new Twig_NodeTraverser($this->env, $this->visitors); - - $node = $traverser->traverse($node); - - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } - - return $node; - } - - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = array(); - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case Twig_Token::TEXT_TYPE: - $token = $this->stream->next(); - $rv[] = new Twig_Node_Text($token->getValue(), $token->getLine()); - break; - - case Twig_Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Twig_Token::VAR_END_TYPE); - $rv[] = new Twig_Node_Print($expr, $token->getLine()); - break; - - case Twig_Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if ($token->getType() !== Twig_Token::NAME_TYPE) { - throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine(), $this->getFilename()); - } - - if (null !== $test && call_user_func($test, $token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - $subparser = $this->handlers->getTokenParser($token->getValue()); - if (null === $subparser) { - if (null !== $test) { - $error = sprintf('Unexpected tag name "%s"', $token->getValue()); - if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) { - $error .= sprintf(' (expecting closing tag for the "%s" tag defined near line %s)', $test[0]->getTag(), $lineno); - } - - throw new Twig_Error_Syntax($error, $token->getLine(), $this->getFilename()); - } - - $message = sprintf('Unknown tag name "%s"', $token->getValue()); - if ($alternatives = $this->env->computeAlternatives($token->getValue(), array_keys($this->env->getTags()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } - - throw new Twig_Error_Syntax($message, $token->getLine(), $this->getFilename()); - } - - $this->stream->next(); - - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', 0, $this->getFilename()); - } - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - public function addHandler($name, $class) - { - $this->handlers[$name] = $class; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - $this->visitors[] = $visitor; - } - - public function getBlockStack() - { - return $this->blockStack; - } - - public function peekBlockStack() - { - return $this->blockStack[count($this->blockStack) - 1]; - } - - public function popBlockStack() - { - array_pop($this->blockStack); - } - - public function pushBlockStack($name) - { - $this->blockStack[] = $name; - } - - public function hasBlock($name) - { - return isset($this->blocks[$name]); - } - - public function getBlock($name) - { - return $this->blocks[$name]; - } - - public function setBlock($name, $value) - { - $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getLine()); - } - - public function hasMacro($name) - { - return isset($this->macros[$name]); - } - - public function setMacro($name, Twig_Node_Macro $node) - { - if (null === $this->reservedMacroNames) { - $this->reservedMacroNames = array(); - $r = new ReflectionClass($this->env->getBaseTemplateClass()); - foreach ($r->getMethods() as $method) { - $this->reservedMacroNames[] = $method->getName(); - } - } - - if (in_array($name, $this->reservedMacroNames)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine(), $this->getFilename()); - } - - $this->macros[$name] = $node; - } - - public function addTrait($trait) - { - $this->traits[] = $trait; - } - - public function hasTraits() - { - return count($this->traits) > 0; - } - - public function embedTemplate(Twig_Node_Module $template) - { - $template->setIndex(mt_rand()); - - $this->embeddedTemplates[] = $template; - } - - public function addImportedSymbol($type, $alias, $name = null, Twig_Node_Expression $node = null) - { - $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node); - } - - public function getImportedSymbol($type, $alias) - { - foreach ($this->importedSymbols as $functions) { - if (isset($functions[$type][$alias])) { - return $functions[$type][$alias]; - } - } - } - - public function isMainScope() - { - return 1 === count($this->importedSymbols); - } - - public function pushLocalScope() - { - array_unshift($this->importedSymbols, array()); - } - - public function popLocalScope() - { - array_shift($this->importedSymbols); - } - - /** - * Gets the expression parser. - * - * @return Twig_ExpressionParser The expression parser - */ - public function getExpressionParser() - { - return $this->expressionParser; - } - - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * Gets the token stream. - * - * @return Twig_TokenStream The token stream - */ - public function getStream() - { - return $this->stream; - } - - /** - * Gets the current token. - * - * @return Twig_Token The current token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); - } - - protected function filterBodyNodes(Twig_NodeInterface $node) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof Twig_Node_Text && !ctype_space($node->getAttribute('data'))) - || - (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface) - ) { - if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) { - throw new Twig_Error_Syntax('A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed.', $node->getLine(), $this->getFilename()); - } - - throw new Twig_Error_Syntax('A template that extends another one cannot have a body.', $node->getLine(), $this->getFilename()); - } - - // bypass "set" nodes as they "capture" the output - if ($node instanceof Twig_Node_Set) { - return $node; - } - - if ($node instanceof Twig_NodeOutputInterface) { - return; - } - - foreach ($node as $k => $n) { - if (null !== $n && null === $n = $this->filterBodyNodes($n)) { - $node->removeNode($k); - } - } - - return $node; - } -} diff --git a/core1/lib/Twig/ParserInterface.php b/core1/lib/Twig/ParserInterface.php deleted file mode 100644 index f0d79009..00000000 --- a/core1/lib/Twig/ParserInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_ParserInterface -{ - /** - * Converts a token stream to a node tree. - * - * @param Twig_TokenStream $stream A token stream instance - * - * @return Twig_Node_Module A node tree - */ - public function parse(Twig_TokenStream $stream); -} diff --git a/core1/lib/Twig/Sandbox/SecurityError.php b/core1/lib/Twig/Sandbox/SecurityError.php deleted file mode 100644 index 015bfaea..00000000 --- a/core1/lib/Twig/Sandbox/SecurityError.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -class Twig_Sandbox_SecurityError extends Twig_Error -{ -} diff --git a/core1/lib/Twig/Sandbox/SecurityPolicy.php b/core1/lib/Twig/Sandbox/SecurityPolicy.php deleted file mode 100644 index 66ee2332..00000000 --- a/core1/lib/Twig/Sandbox/SecurityPolicy.php +++ /dev/null @@ -1,119 +0,0 @@ - - */ -class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface -{ - protected $allowedTags; - protected $allowedFilters; - protected $allowedMethods; - protected $allowedProperties; - protected $allowedFunctions; - - public function __construct(array $allowedTags = array(), array $allowedFilters = array(), array $allowedMethods = array(), array $allowedProperties = array(), array $allowedFunctions = array()) - { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; - $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; - } - - public function setAllowedTags(array $tags) - { - $this->allowedTags = $tags; - } - - public function setAllowedFilters(array $filters) - { - $this->allowedFilters = $filters; - } - - public function setAllowedMethods(array $methods) - { - $this->allowedMethods = array(); - foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map('strtolower', is_array($m) ? $m : array($m)); - } - } - - public function setAllowedProperties(array $properties) - { - $this->allowedProperties = $properties; - } - - public function setAllowedFunctions(array $functions) - { - $this->allowedFunctions = $functions; - } - - public function checkSecurity($tags, $filters, $functions) - { - foreach ($tags as $tag) { - if (!in_array($tag, $this->allowedTags)) { - throw new Twig_Sandbox_SecurityError(sprintf('Tag "%s" is not allowed.', $tag)); - } - } - - foreach ($filters as $filter) { - if (!in_array($filter, $this->allowedFilters)) { - throw new Twig_Sandbox_SecurityError(sprintf('Filter "%s" is not allowed.', $filter)); - } - } - - foreach ($functions as $function) { - if (!in_array($function, $this->allowedFunctions)) { - throw new Twig_Sandbox_SecurityError(sprintf('Function "%s" is not allowed.', $function)); - } - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($obj instanceof Twig_TemplateInterface || $obj instanceof Twig_Markup) { - return true; - } - - $allowed = false; - $method = strtolower($method); - foreach ($this->allowedMethods as $class => $methods) { - if ($obj instanceof $class) { - $allowed = in_array($method, $methods); - - break; - } - } - - if (!$allowed) { - throw new Twig_Sandbox_SecurityError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, get_class($obj))); - } - } - - public function checkPropertyAllowed($obj, $property) - { - $allowed = false; - foreach ($this->allowedProperties as $class => $properties) { - if ($obj instanceof $class) { - $allowed = in_array($property, is_array($properties) ? $properties : array($properties)); - - break; - } - } - - if (!$allowed) { - throw new Twig_Sandbox_SecurityError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, get_class($obj))); - } - } -} diff --git a/core1/lib/Twig/Sandbox/SecurityPolicyInterface.php b/core1/lib/Twig/Sandbox/SecurityPolicyInterface.php deleted file mode 100644 index 6ab48e3c..00000000 --- a/core1/lib/Twig/Sandbox/SecurityPolicyInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ -interface Twig_Sandbox_SecurityPolicyInterface -{ - public function checkSecurity($tags, $filters, $functions); - - public function checkMethodAllowed($obj, $method); - - public function checkPropertyAllowed($obj, $method); -} diff --git a/core1/lib/Twig/SimpleFilter.php b/core1/lib/Twig/SimpleFilter.php deleted file mode 100644 index a6bf60f8..00000000 --- a/core1/lib/Twig/SimpleFilter.php +++ /dev/null @@ -1,96 +0,0 @@ - - */ -class Twig_SimpleFilter -{ - protected $name; - protected $callable; - protected $options; - protected $arguments = array(); - - public function __construct($name, $callable, array $options = array()) - { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'pre_escape' => null, - 'preserves_safety' => null, - 'node_class' => 'Twig_Node_Expression_Filter', - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $filterArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return call_user_func($this->options['is_safe_callback'], $filterArgs); - } - - return null; - } - - public function getPreservesSafety() - { - return $this->options['preserves_safety']; - } - - public function getPreEscape() - { - return $this->options['pre_escape']; - } -} diff --git a/core1/lib/Twig/SimpleFunction.php b/core1/lib/Twig/SimpleFunction.php deleted file mode 100644 index 8ef6aca2..00000000 --- a/core1/lib/Twig/SimpleFunction.php +++ /dev/null @@ -1,84 +0,0 @@ - - */ -class Twig_SimpleFunction -{ - protected $name; - protected $callable; - protected $options; - protected $arguments = array(); - - public function __construct($name, $callable, array $options = array()) - { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'node_class' => 'Twig_Node_Expression_Function', - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $functionArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return call_user_func($this->options['is_safe_callback'], $functionArgs); - } - - return array(); - } -} diff --git a/core1/lib/Twig/SimpleTest.php b/core1/lib/Twig/SimpleTest.php deleted file mode 100644 index 225459c9..00000000 --- a/core1/lib/Twig/SimpleTest.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ -class Twig_SimpleTest -{ - protected $name; - protected $callable; - protected $options; - - public function __construct($name, $callable, array $options = array()) - { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'node_class' => 'Twig_Node_Expression_Test', - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } -} diff --git a/core1/lib/Twig/Template.php b/core1/lib/Twig/Template.php deleted file mode 100644 index abc3400e..00000000 --- a/core1/lib/Twig/Template.php +++ /dev/null @@ -1,453 +0,0 @@ - - */ -abstract class Twig_Template implements Twig_TemplateInterface -{ - protected static $cache = array(); - - protected $parent; - protected $parents; - protected $env; - protected $blocks; - protected $traits; - - /** - * Constructor. - * - * @param Twig_Environment $env A Twig_Environment instance - */ - public function __construct(Twig_Environment $env) - { - $this->env = $env; - $this->blocks = array(); - $this->traits = array(); - } - - /** - * Returns the template name. - * - * @return string The template name - */ - abstract public function getTemplateName(); - - /** - * {@inheritdoc} - */ - public function getEnvironment() - { - return $this->env; - } - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @return Twig_TemplateInterface|false The parent template or false if there is no parent - */ - public function getParent(array $context) - { - if (null !== $this->parent) { - return $this->parent; - } - - $parent = $this->doGetParent($context); - if (false === $parent) { - return false; - } elseif ($parent instanceof Twig_Template) { - $name = $parent->getTemplateName(); - $this->parents[$name] = $parent; - $parent = $name; - } elseif (!isset($this->parents[$parent])) { - $this->parents[$parent] = $this->env->loadTemplate($parent); - } - - return $this->parents[$parent]; - } - - protected function doGetParent(array $context) - { - return false; - } - - public function isTraitable() - { - return true; - } - - /** - * Displays a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - */ - public function displayParentBlock($name, array $context, array $blocks = array()) - { - $name = (string) $name; - - if (isset($this->traits[$name])) { - $this->traits[$name][0]->displayBlock($name, $context, $blocks); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, $blocks); - } else { - throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block', $name), -1, $this->getTemplateName()); - } - } - - /** - * Displays a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display - * @param array $context The context - * @param array $blocks The current set of blocks - */ - public function displayBlock($name, array $context, array $blocks = array()) - { - $name = (string) $name; - - if (isset($blocks[$name])) { - $b = $blocks; - unset($b[$name]); - call_user_func($blocks[$name], $context, $b); - } elseif (isset($this->blocks[$name])) { - call_user_func($this->blocks[$name], $context, $blocks); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks)); - } - } - - /** - * Renders a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - */ - public function renderParentBlock($name, array $context, array $blocks = array()) - { - ob_start(); - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Renders a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - */ - public function renderBlock($name, array $context, array $blocks = array()) - { - ob_start(); - $this->displayBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Returns whether a block exists or not. - * - * This method is for internal use only and should never be called - * directly. - * - * This method does only return blocks defined in the current template - * or defined in "used" traits. - * - * It does not return blocks from parent templates as the parent - * template name can be dynamic, which is only known based on the - * current context. - * - * @param string $name The block name - * - * @return Boolean true if the block exists, false otherwise - */ - public function hasBlock($name) - { - return isset($this->blocks[(string) $name]); - } - - /** - * Returns all block names. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of block names - * - * @see hasBlock - */ - public function getBlockNames() - { - return array_keys($this->blocks); - } - - /** - * Returns all blocks. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of blocks - * - * @see hasBlock - */ - public function getBlocks() - { - return $this->blocks; - } - - /** - * {@inheritdoc} - */ - public function display(array $context, array $blocks = array()) - { - $this->displayWithErrorHandling($this->env->mergeGlobals($context), $blocks); - } - - /** - * {@inheritdoc} - */ - public function render(array $context) - { - $level = ob_get_level(); - ob_start(); - try { - $this->display($context); - } catch (Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - protected function displayWithErrorHandling(array $context, array $blocks = array()) - { - try { - $this->doDisplay($context, $blocks); - } catch (Twig_Error $e) { - if (!$e->getTemplateFile()) { - $e->setTemplateFile($this->getTemplateName()); - } - - // this is mostly useful for Twig_Error_Loader exceptions - // see Twig_Error_Loader - if (false === $e->getTemplateLine()) { - $e->setTemplateLine(-1); - $e->guess(); - } - - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e); - } - } - - /** - * Auto-generated method to display the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - abstract protected function doDisplay(array $context, array $blocks = array()); - - /** - * Returns a variable from the context. - * - * This method is for internal use only and should never be called - * directly. - * - * This method should not be overridden in a sub-class as this is an - * implementation detail that has been introduced to optimize variable - * access for versions of PHP before 5.4. This is not a way to override - * the way to get a variable value. - * - * @param array $context The context - * @param string $item The variable to return from the context - * @param Boolean $ignoreStrictCheck Whether to ignore the strict variable check or not - * - * @return The content of the context variable - * - * @throws Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode - */ - final protected function getContext($context, $item, $ignoreStrictCheck = false) - { - if (!array_key_exists($item, $context)) { - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return null; - } - - throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist', $item), -1, $this->getTemplateName()); - } - - return $context[$item]; - } - - /** - * Returns the attribute value for a given array/object. - * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see Twig_TemplateInterface) - * @param Boolean $isDefinedTest Whether this is only a defined check - * @param Boolean $ignoreStrictCheck Whether to ignore the strict attribute check or not - * - * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true - * - * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false - */ - protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) - { - $item = ctype_digit((string) $item) ? (int) $item : (string) $item; - - // array - if (Twig_TemplateInterface::METHOD_CALL !== $type) { - if ((is_array($object) && array_key_exists($item, $object)) - || ($object instanceof ArrayAccess && isset($object[$item])) - ) { - if ($isDefinedTest) { - return true; - } - - return $object[$item]; - } - - if (Twig_TemplateInterface::ARRAY_CALL === $type) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return null; - } - - if (is_object($object)) { - throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName()); - } elseif (is_array($object)) { - throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $item, implode(', ', array_keys($object))), -1, $this->getTemplateName()); - } else { - throw new Twig_Error_Runtime(sprintf('Impossible to access a key ("%s") on a "%s" variable', $item, gettype($object)), -1, $this->getTemplateName()); - } - } - } - - if (!is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return null; - } - - throw new Twig_Error_Runtime(sprintf('Item "%s" for "%s" does not exist', $item, is_array($object) ? 'Array' : $object), -1, $this->getTemplateName()); - } - - $class = get_class($object); - - // object property - if (Twig_TemplateInterface::METHOD_CALL !== $type) { - if (isset($object->$item) || array_key_exists($item, $object)) { - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('sandbox')) { - $this->env->getExtension('sandbox')->checkPropertyAllowed($object, $item); - } - - return $object->$item; - } - } - - // object method - if (!isset(self::$cache[$class]['methods'])) { - self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); - } - - $lcItem = strtolower($item); - if (isset(self::$cache[$class]['methods'][$lcItem])) { - $method = $item; - } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { - $method = 'get'.$item; - } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { - $method = 'is'.$item; - } elseif (isset(self::$cache[$class]['methods']['__call'])) { - $method = $item; - } else { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return null; - } - - throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName()); - } - - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('sandbox')) { - $this->env->getExtension('sandbox')->checkMethodAllowed($object, $method); - } - - $ret = call_user_func_array(array($object, $method), $arguments); - - // useful when calling a template method from a template - // this is not supported but unfortunately heavily used in the Symfony profiler - if ($object instanceof Twig_TemplateInterface) { - return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); - } - - return $ret; - } - - /** - * This method is only useful when testing Twig. Do not use it. - */ - public static function clearCache() - { - self::$cache = array(); - } -} diff --git a/core1/lib/Twig/TemplateInterface.php b/core1/lib/Twig/TemplateInterface.php deleted file mode 100644 index 879f503e..00000000 --- a/core1/lib/Twig/TemplateInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_TemplateInterface -{ - const ANY_CALL = 'any'; - const ARRAY_CALL = 'array'; - const METHOD_CALL = 'method'; - - /** - * Renders the template with the given context and returns it as string. - * - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - */ - public function render(array $context); - - /** - * Displays the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - public function display(array $context, array $blocks = array()); - - /** - * Returns the bound environment for this template. - * - * @return Twig_Environment The current environment - */ - public function getEnvironment(); -} diff --git a/core1/lib/Twig/Test.php b/core1/lib/Twig/Test.php deleted file mode 100644 index 3baff885..00000000 --- a/core1/lib/Twig/Test.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface -{ - protected $options; - protected $arguments = array(); - - public function __construct(array $options = array()) - { - $this->options = array_merge(array( - 'callable' => null, - ), $options); - } - - public function getCallable() - { - return $this->options['callable']; - } -} diff --git a/core1/lib/Twig/Test/Function.php b/core1/lib/Twig/Test/Function.php deleted file mode 100644 index 4be6b9b9..00000000 --- a/core1/lib/Twig/Test/Function.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Test_Function extends Twig_Test -{ - protected $function; - - public function __construct($function, array $options = array()) - { - $options['callable'] = $function; - - parent::__construct($options); - - $this->function = $function; - } - - public function compile() - { - return $this->function; - } -} diff --git a/core1/lib/Twig/Test/IntegrationTestCase.php b/core1/lib/Twig/Test/IntegrationTestCase.php deleted file mode 100644 index 724f0941..00000000 --- a/core1/lib/Twig/Test/IntegrationTestCase.php +++ /dev/null @@ -1,154 +0,0 @@ - - * @author Karma Dordrak - */ -abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase -{ - abstract protected function getExtensions(); - abstract protected function getFixturesDir(); - - /** - * @dataProvider getTests - */ - public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); - } - - public function getTests() - { - $fixturesDir = realpath($this->getFixturesDir()); - $tests = array(); - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fixturesDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!preg_match('/\.test$/', $file)) { - continue; - } - - $test = file_get_contents($file->getRealpath()); - - if (preg_match('/ - --TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = $this->parseTemplates($match[3]); - $exception = $match[5]; - $outputs = array(array(null, $match[4], null, '')); - } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = $this->parseTemplates($match[3]); - $exception = false; - preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); - } else { - throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); - } - - $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); - } - - return $tests; - } - - protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs) - { - if ($condition) { - eval('$ret = '.$condition.';'); - if (!$ret) { - $this->markTestSkipped($condition); - } - } - - $loader = new Twig_Loader_Array($templates); - - foreach ($outputs as $match) { - $config = array_merge(array( - 'cache' => false, - 'strict_variables' => true, - ), $match[2] ? eval($match[2].';') : array()); - $twig = new Twig_Environment($loader, $config); - $twig->addGlobal('global', 'global'); - foreach ($this->getExtensions() as $extension) { - $twig->addExtension($extension); - } - - try { - $template = $twig->loadTemplate('index.twig'); - } catch (Exception $e) { - if (false !== $exception) { - $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); - - return; - } - - if ($e instanceof Twig_Error_Syntax) { - $e->setTemplateFile($file); - - throw $e; - } - - throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - } - - try { - $output = trim($template->render(eval($match[1].';')), "\n "); - } catch (Exception $e) { - if (false !== $exception) { - $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); - - return; - } - - if ($e instanceof Twig_Error_Syntax) { - $e->setTemplateFile($file); - } else { - $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - } - - $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); - } - - if (false !== $exception) { - list($class, ) = explode(':', $exception); - $this->assertThat(NULL, new PHPUnit_Framework_Constraint_Exception($class)); - } - - $expected = trim($match[3], "\n "); - - if ($expected != $output) { - echo 'Compiled template that failed:'; - - foreach (array_keys($templates) as $name) { - echo "Template: $name\n"; - $source = $loader->getSource($name); - echo $twig->compile($twig->parse($twig->tokenize($source, $name))); - } - } - $this->assertEquals($expected, $output, $message.' (in '.$file.')'); - } - } - - protected static function parseTemplates($test) - { - $templates = array(); - preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; - } - - return $templates; - } -} diff --git a/core1/lib/Twig/Test/Method.php b/core1/lib/Twig/Test/Method.php deleted file mode 100644 index 17c6c041..00000000 --- a/core1/lib/Twig/Test/Method.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Test_Method extends Twig_Test -{ - protected $extension; - protected $method; - - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) - { - $options['callable'] = array($extension, $method); - - parent::__construct($options); - - $this->extension = $extension; - $this->method = $method; - } - - public function compile() - { - return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); - } -} diff --git a/core1/lib/Twig/Test/Node.php b/core1/lib/Twig/Test/Node.php deleted file mode 100644 index c832a57b..00000000 --- a/core1/lib/Twig/Test/Node.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_Test_Node extends Twig_Test -{ - protected $class; - - public function __construct($class, array $options = array()) - { - parent::__construct($options); - - $this->class = $class; - } - - public function getClass() - { - return $this->class; - } - - public function compile() - { - } -} diff --git a/core1/lib/Twig/Test/NodeTestCase.php b/core1/lib/Twig/Test/NodeTestCase.php deleted file mode 100644 index b15c85ff..00000000 --- a/core1/lib/Twig/Test/NodeTestCase.php +++ /dev/null @@ -1,58 +0,0 @@ -assertNodeCompilation($source, $node, $environment); - } - - public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) - { - $compiler = $this->getCompiler($environment); - $compiler->compile($node); - - $this->assertEquals($source, trim($compiler->getSource())); - } - - protected function getCompiler(Twig_Environment $environment = null) - { - return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); - } - - protected function getEnvironment() - { - return new Twig_Environment(); - } - - protected function getVariableGetter($name) - { - if (version_compare(phpversion(), '5.4.0RC1', '>=')) { - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } - - return sprintf('$this->getContext($context, "%s")', $name); - } - - protected function getAttributeGetter() - { - if (function_exists('twig_template_get_attributes')) { - return 'twig_template_get_attributes($this, '; - } - - return '$this->getAttribute('; - } -} diff --git a/core1/lib/Twig/TestCallableInterface.php b/core1/lib/Twig/TestCallableInterface.php deleted file mode 100644 index 0db43682..00000000 --- a/core1/lib/Twig/TestCallableInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_TestCallableInterface -{ - public function getCallable(); -} diff --git a/core1/lib/Twig/TestInterface.php b/core1/lib/Twig/TestInterface.php deleted file mode 100644 index 30d8a2c4..00000000 --- a/core1/lib/Twig/TestInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_TestInterface -{ - /** - * Compiles a test. - * - * @return string The PHP code for the test - */ - public function compile(); -} diff --git a/core1/lib/Twig/Token.php b/core1/lib/Twig/Token.php deleted file mode 100644 index bbca90db..00000000 --- a/core1/lib/Twig/Token.php +++ /dev/null @@ -1,218 +0,0 @@ - - */ -class Twig_Token -{ - protected $value; - protected $type; - protected $lineno; - - const EOF_TYPE = -1; - const TEXT_TYPE = 0; - const BLOCK_START_TYPE = 1; - const VAR_START_TYPE = 2; - const BLOCK_END_TYPE = 3; - const VAR_END_TYPE = 4; - const NAME_TYPE = 5; - const NUMBER_TYPE = 6; - const STRING_TYPE = 7; - const OPERATOR_TYPE = 8; - const PUNCTUATION_TYPE = 9; - const INTERPOLATION_START_TYPE = 10; - const INTERPOLATION_END_TYPE = 11; - - /** - * Constructor. - * - * @param integer $type The type of the token - * @param string $value The token value - * @param integer $lineno The line position in the source - */ - public function __construct($type, $value, $lineno) - { - $this->type = $type; - $this->value = $value; - $this->lineno = $lineno; - } - - /** - * Returns a string representation of the token. - * - * @return string A string representation of the token - */ - public function __toString() - { - return sprintf('%s(%s)', self::typeToString($this->type, true, $this->lineno), $this->value); - } - - /** - * Tests the current token for a type and/or a value. - * - * Parameters may be: - * * just type - * * type and value (or array of possible values) - * * just value (or array of possible values) (NAME_TYPE is used as type) - * - * @param array|integer $type The type to test - * @param array|string|null $values The token value - * - * @return Boolean - */ - public function test($type, $values = null) - { - if (null === $values && !is_int($type)) { - $values = $type; - $type = self::NAME_TYPE; - } - - return ($this->type === $type) && ( - null === $values || - (is_array($values) && in_array($this->value, $values)) || - $this->value == $values - ); - } - - /** - * Gets the line. - * - * @return integer The source line - */ - public function getLine() - { - return $this->lineno; - } - - /** - * Gets the token type. - * - * @return integer The token type - */ - public function getType() - { - return $this->type; - } - - /** - * Gets the token value. - * - * @return string The token value - */ - public function getValue() - { - return $this->value; - } - - /** - * Returns the constant representation (internal) of a given type. - * - * @param integer $type The type as an integer - * @param Boolean $short Whether to return a short representation or not - * @param integer $line The code line - * - * @return string The string representation - */ - public static function typeToString($type, $short = false, $line = -1) - { - switch ($type) { - case self::EOF_TYPE: - $name = 'EOF_TYPE'; - break; - case self::TEXT_TYPE: - $name = 'TEXT_TYPE'; - break; - case self::BLOCK_START_TYPE: - $name = 'BLOCK_START_TYPE'; - break; - case self::VAR_START_TYPE: - $name = 'VAR_START_TYPE'; - break; - case self::BLOCK_END_TYPE: - $name = 'BLOCK_END_TYPE'; - break; - case self::VAR_END_TYPE: - $name = 'VAR_END_TYPE'; - break; - case self::NAME_TYPE: - $name = 'NAME_TYPE'; - break; - case self::NUMBER_TYPE: - $name = 'NUMBER_TYPE'; - break; - case self::STRING_TYPE: - $name = 'STRING_TYPE'; - break; - case self::OPERATOR_TYPE: - $name = 'OPERATOR_TYPE'; - break; - case self::PUNCTUATION_TYPE: - $name = 'PUNCTUATION_TYPE'; - break; - case self::INTERPOLATION_START_TYPE: - $name = 'INTERPOLATION_START_TYPE'; - break; - case self::INTERPOLATION_END_TYPE: - $name = 'INTERPOLATION_END_TYPE'; - break; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - - return $short ? $name : 'Twig_Token::'.$name; - } - - /** - * Returns the english representation of a given type. - * - * @param integer $type The type as an integer - * @param integer $line The code line - * - * @return string The string representation - */ - public static function typeToEnglish($type, $line = -1) - { - switch ($type) { - case self::EOF_TYPE: - return 'end of template'; - case self::TEXT_TYPE: - return 'text'; - case self::BLOCK_START_TYPE: - return 'begin of statement block'; - case self::VAR_START_TYPE: - return 'begin of print statement'; - case self::BLOCK_END_TYPE: - return 'end of statement block'; - case self::VAR_END_TYPE: - return 'end of print statement'; - case self::NAME_TYPE: - return 'name'; - case self::NUMBER_TYPE: - return 'number'; - case self::STRING_TYPE: - return 'string'; - case self::OPERATOR_TYPE: - return 'operator'; - case self::PUNCTUATION_TYPE: - return 'punctuation'; - case self::INTERPOLATION_START_TYPE: - return 'begin of string interpolation'; - case self::INTERPOLATION_END_TYPE: - return 'end of string interpolation'; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - } -} diff --git a/core1/lib/Twig/TokenParser.php b/core1/lib/Twig/TokenParser.php deleted file mode 100644 index decebd5e..00000000 --- a/core1/lib/Twig/TokenParser.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -abstract class Twig_TokenParser implements Twig_TokenParserInterface -{ - /** - * @var Twig_Parser - */ - protected $parser; - - /** - * Sets the parser associated with this token parser - * - * @param $parser A Twig_Parser instance - */ - public function setParser(Twig_Parser $parser) - { - $this->parser = $parser; - } -} diff --git a/core1/lib/Twig/TokenParser/AutoEscape.php b/core1/lib/Twig/TokenParser/AutoEscape.php deleted file mode 100644 index 27560288..00000000 --- a/core1/lib/Twig/TokenParser/AutoEscape.php +++ /dev/null @@ -1,89 +0,0 @@ - - * {% autoescape true %} - * Everything will be automatically escaped in this block - * {% endautoescape %} - * - * {% autoescape false %} - * Everything will be outputed as is in this block - * {% endautoescape %} - * - * {% autoescape true js %} - * Everything will be automatically escaped in this block - * using the js escaping strategy - * {% endautoescape %} - * - */ -class Twig_TokenParser_AutoEscape extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - if ($stream->test(Twig_Token::BLOCK_END_TYPE)) { - $value = 'html'; - } else { - $expr = $this->parser->getExpressionParser()->parseExpression(); - if (!$expr instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('An escaping strategy must be a string or a Boolean.', $stream->getCurrent()->getLine(), $stream->getFilename()); - } - $value = $expr->getAttribute('value'); - - $compat = true === $value || false === $value; - - if (true === $value) { - $value = 'html'; - } - - if ($compat && $stream->test(Twig_Token::NAME_TYPE)) { - if (false === $value) { - throw new Twig_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getFilename()); - } - - $value = $stream->next()->getValue(); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_AutoEscape($value, $body, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endautoescape'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'autoescape'; - } -} diff --git a/core1/lib/Twig/TokenParser/Block.php b/core1/lib/Twig/TokenParser/Block.php deleted file mode 100644 index a2e017f3..00000000 --- a/core1/lib/Twig/TokenParser/Block.php +++ /dev/null @@ -1,83 +0,0 @@ - - * {% block head %} - * - * {% block title %}{% endblock %} - My Webpage - * {% endblock %} - * - */ -class Twig_TokenParser_Block extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - if ($this->parser->hasBlock($name)) { - throw new Twig_Error_Syntax(sprintf("The block '$name' has already been defined line %d", $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno)); - $this->parser->pushLocalScope(); - $this->parser->pushBlockStack($name); - - if ($stream->test(Twig_Token::BLOCK_END_TYPE)) { - $stream->next(); - - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($stream->test(Twig_Token::NAME_TYPE)) { - $value = $stream->next()->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - } else { - $body = new Twig_Node(array( - new Twig_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno), - )); - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $block->setNode('body', $body); - $this->parser->popBlockStack(); - $this->parser->popLocalScope(); - - return new Twig_Node_BlockReference($name, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endblock'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'block'; - } -} diff --git a/core1/lib/Twig/TokenParser/Do.php b/core1/lib/Twig/TokenParser/Do.php deleted file mode 100644 index 593d1c6d..00000000 --- a/core1/lib/Twig/TokenParser/Do.php +++ /dev/null @@ -1,42 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'do'; - } -} diff --git a/core1/lib/Twig/TokenParser/Embed.php b/core1/lib/Twig/TokenParser/Embed.php deleted file mode 100644 index 69cb5f35..00000000 --- a/core1/lib/Twig/TokenParser/Embed.php +++ /dev/null @@ -1,66 +0,0 @@ -parser->getStream(); - - $parent = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - // inject a fake parent to make the parent() function work - $stream->injectTokens(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()), - new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine()), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()), - )); - - $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true); - - // override the parent with the correct one - $module->setNode('parent', $parent); - - $this->parser->embedTemplate($module); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Embed($module->getAttribute('filename'), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endembed'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'embed'; - } -} diff --git a/core1/lib/Twig/TokenParser/Extends.php b/core1/lib/Twig/TokenParser/Extends.php deleted file mode 100644 index 110bc8b4..00000000 --- a/core1/lib/Twig/TokenParser/Extends.php +++ /dev/null @@ -1,54 +0,0 @@ - - * {% extends "base.html" %} - * - */ -class Twig_TokenParser_Extends extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - if (!$this->parser->isMainScope()) { - throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine(), $this->parser->getFilename()); - } - - if (null !== $this->parser->getParent()) { - throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine(), $this->parser->getFilename()); - } - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return null; - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'extends'; - } -} diff --git a/core1/lib/Twig/TokenParser/Filter.php b/core1/lib/Twig/TokenParser/Filter.php deleted file mode 100644 index 2b97475a..00000000 --- a/core1/lib/Twig/TokenParser/Filter.php +++ /dev/null @@ -1,61 +0,0 @@ - - * {% filter upper %} - * This text becomes uppercase - * {% endfilter %} - * - */ -class Twig_TokenParser_Filter extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $name = $this->parser->getVarName(); - $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), true, $token->getLine(), $this->getTag()); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $block = new Twig_Node_Block($name, $body, $token->getLine()); - $this->parser->setBlock($name, $block); - - return new Twig_Node_Print($filter, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endfilter'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'filter'; - } -} diff --git a/core1/lib/Twig/TokenParser/Flush.php b/core1/lib/Twig/TokenParser/Flush.php deleted file mode 100644 index 4e15e785..00000000 --- a/core1/lib/Twig/TokenParser/Flush.php +++ /dev/null @@ -1,42 +0,0 @@ -parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Flush($token->getLine(), $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'flush'; - } -} diff --git a/core1/lib/Twig/TokenParser/For.php b/core1/lib/Twig/TokenParser/For.php deleted file mode 100644 index 98a6d079..00000000 --- a/core1/lib/Twig/TokenParser/For.php +++ /dev/null @@ -1,136 +0,0 @@ - - *
      - * {% for user in users %} - *
    • {{ user.username|e }}
    • - * {% endfor %} - *
    - * - */ -class Twig_TokenParser_For extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'in'); - $seq = $this->parser->getExpressionParser()->parseExpression(); - - $ifexpr = null; - if ($stream->test(Twig_Token::NAME_TYPE, 'if')) { - $stream->next(); - $ifexpr = $this->parser->getExpressionParser()->parseExpression(); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideForFork')); - if ($stream->next()->getValue() == 'else') { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideForEnd'), true); - } else { - $else = null; - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($targets) > 1) { - $keyTarget = $targets->getNode(0); - $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getLine()); - $valueTarget = $targets->getNode(1); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine()); - } else { - $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno); - $valueTarget = $targets->getNode(0); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine()); - } - - if ($ifexpr) { - $this->checkLoopUsageCondition($stream, $ifexpr); - $this->checkLoopUsageBody($stream, $body); - } - - return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); - } - - public function decideForFork(Twig_Token $token) - { - return $token->test(array('else', 'endfor')); - } - - public function decideForEnd(Twig_Token $token) - { - return $token->test('endfor'); - } - - // the loop variable cannot be used in the condition - protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition', $node->getLine(), $stream->getFilename()); - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageCondition($stream, $n); - } - } - - // check usage of non-defined loop-items - // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) - protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterface $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - $attribute = $node->getNode('attribute'); - if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) { - throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition', $attribute->getAttribute('value')), $node->getLine(), $stream->getFilename()); - } - } - - // should check for parent.loop.XXX usage - if ($node instanceof Twig_Node_For) { - return; - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageBody($stream, $n); - } - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'for'; - } -} diff --git a/core1/lib/Twig/TokenParser/From.php b/core1/lib/Twig/TokenParser/From.php deleted file mode 100644 index a54054db..00000000 --- a/core1/lib/Twig/TokenParser/From.php +++ /dev/null @@ -1,74 +0,0 @@ - - * {% from 'forms.html' import forms %} - * - */ -class Twig_TokenParser_From extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect('import'); - - $targets = array(); - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->test('as')) { - $stream->next(); - - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - - $stream->next(); - } while (true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); - - foreach ($targets as $name => $alias) { - $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); - } - - return $node; - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'from'; - } -} diff --git a/core1/lib/Twig/TokenParser/If.php b/core1/lib/Twig/TokenParser/If.php deleted file mode 100644 index 3d7d1f51..00000000 --- a/core1/lib/Twig/TokenParser/If.php +++ /dev/null @@ -1,94 +0,0 @@ - - * {% if users %} - *
      - * {% for user in users %} - *
    • {{ user.username|e }}
    • - * {% endfor %} - *
    - * {% endif %} - * - */ -class Twig_TokenParser_If extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elseif': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endif': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('elseif', 'else', 'endif')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endif')); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'if'; - } -} diff --git a/core1/lib/Twig/TokenParser/Import.php b/core1/lib/Twig/TokenParser/Import.php deleted file mode 100644 index e7050c70..00000000 --- a/core1/lib/Twig/TokenParser/Import.php +++ /dev/null @@ -1,49 +0,0 @@ - - * {% import 'forms.html' as forms %} - * - */ -class Twig_TokenParser_Import extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect('as'); - $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); - - return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'import'; - } -} diff --git a/core1/lib/Twig/TokenParser/Include.php b/core1/lib/Twig/TokenParser/Include.php deleted file mode 100644 index 4a317868..00000000 --- a/core1/lib/Twig/TokenParser/Include.php +++ /dev/null @@ -1,80 +0,0 @@ - - * {% include 'header.html' %} - * Body - * {% include 'footer.html' %} - * - */ -class Twig_TokenParser_Include extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - protected function parseArguments() - { - $stream = $this->parser->getStream(); - - $ignoreMissing = false; - if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) { - $stream->next(); - $stream->expect(Twig_Token::NAME_TYPE, 'missing'); - - $ignoreMissing = true; - } - - $variables = null; - if ($stream->test(Twig_Token::NAME_TYPE, 'with')) { - $stream->next(); - - $variables = $this->parser->getExpressionParser()->parseExpression(); - } - - $only = false; - if ($stream->test(Twig_Token::NAME_TYPE, 'only')) { - $stream->next(); - - $only = true; - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return array($variables, $only, $ignoreMissing); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'include'; - } -} diff --git a/core1/lib/Twig/TokenParser/Macro.php b/core1/lib/Twig/TokenParser/Macro.php deleted file mode 100644 index c2a03360..00000000 --- a/core1/lib/Twig/TokenParser/Macro.php +++ /dev/null @@ -1,70 +0,0 @@ - - * {% macro input(name, value, type, size) %} - * - * {% endmacro %} - * - */ -class Twig_TokenParser_Macro extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $this->parser->pushLocalScope(); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($stream->test(Twig_Token::NAME_TYPE)) { - $value = $stream->next()->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - $this->parser->popLocalScope(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag())); - - return null; - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endmacro'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'macro'; - } -} diff --git a/core1/lib/Twig/TokenParser/Sandbox.php b/core1/lib/Twig/TokenParser/Sandbox.php deleted file mode 100644 index 8fbdde72..00000000 --- a/core1/lib/Twig/TokenParser/Sandbox.php +++ /dev/null @@ -1,68 +0,0 @@ - - * {% sandbox %} - * {% include 'user.html' %} - * {% endsandbox %} - * - * - * @see https://www.twig-project.org/doc/api.html#sandbox-extension for details - */ -class Twig_TokenParser_Sandbox extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - // in a sandbox tag, only include tags are allowed - if (!$body instanceof Twig_Node_Include) { - foreach ($body as $node) { - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if (!$node instanceof Twig_Node_Include) { - throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section', $node->getLine(), $this->parser->getFilename()); - } - } - } - - return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endsandbox'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'sandbox'; - } -} diff --git a/core1/lib/Twig/TokenParser/Set.php b/core1/lib/Twig/TokenParser/Set.php deleted file mode 100644 index 6dbd1db1..00000000 --- a/core1/lib/Twig/TokenParser/Set.php +++ /dev/null @@ -1,84 +0,0 @@ - - * {% set foo = 'foo' %} - * - * {% set foo = [1, 2] %} - * - * {% set foo = {'foo': 'bar'} %} - * - * {% set foo = 'foo' ~ 'bar' %} - * - * {% set foo, bar = 'foo', 'bar' %} - * - * {% set foo %}Some content{% endset %} - * - */ -class Twig_TokenParser_Set extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); - - $capture = false; - if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { - $stream->next(); - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($names) !== count($values)) { - throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignements.", $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } else { - $capture = true; - - if (count($names) > 1) { - throw new Twig_Error_Syntax("When using set with a block, you cannot have a multi-target.", $stream->getCurrent()->getLine(), $stream->getFilename()); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endset'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'set'; - } -} diff --git a/core1/lib/Twig/TokenParser/Spaceless.php b/core1/lib/Twig/TokenParser/Spaceless.php deleted file mode 100644 index 1e3fa8f3..00000000 --- a/core1/lib/Twig/TokenParser/Spaceless.php +++ /dev/null @@ -1,59 +0,0 @@ - - * {% spaceless %} - *
    - * foo - *
    - * {% endspaceless %} - * - * {# output will be
    foo
    #} - * - */ -class Twig_TokenParser_Spaceless extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); - } - - public function decideSpacelessEnd(Twig_Token $token) - { - return $token->test('endspaceless'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'spaceless'; - } -} diff --git a/core1/lib/Twig/TokenParser/Use.php b/core1/lib/Twig/TokenParser/Use.php deleted file mode 100644 index 9263a9a1..00000000 --- a/core1/lib/Twig/TokenParser/Use.php +++ /dev/null @@ -1,84 +0,0 @@ - - * {% extends "base.html" %} - * - * {% use "blocks.html" %} - * - * {% block title %}{% endblock %} - * {% block content %}{% endblock %} - * - * - * @see https://www.twig-project.org/doc/templates.html#horizontal-reuse for details. - */ -class Twig_TokenParser_Use extends Twig_TokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $template = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - - if (!$template instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getFilename()); - } - - $targets = array(); - if ($stream->test('with')) { - $stream->next(); - - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->test('as')) { - $stream->next(); - - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = new Twig_Node_Expression_Constant($alias, -1); - - if (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - - $stream->next(); - } while (true); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); - - return null; - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'use'; - } -} diff --git a/core1/lib/Twig/TokenParserBroker.php b/core1/lib/Twig/TokenParserBroker.php deleted file mode 100644 index 9518c7c8..00000000 --- a/core1/lib/Twig/TokenParserBroker.php +++ /dev/null @@ -1,138 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface -{ - protected $parser; - protected $parsers = array(); - protected $brokers = array(); - - /** - * Constructor. - * - * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances - * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances - */ - public function __construct($parsers = array(), $brokers = array()) - { - foreach ($parsers as $parser) { - if (!$parser instanceof Twig_TokenParserInterface) { - throw new LogicException('$parsers must a an array of Twig_TokenParserInterface'); - } - $this->parsers[$parser->getTag()] = $parser; - } - foreach ($brokers as $broker) { - if (!$broker instanceof Twig_TokenParserBrokerInterface) { - throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface'); - } - $this->brokers[] = $broker; - } - } - - /** - * Adds a TokenParser. - * - * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance - */ - public function addTokenParser(Twig_TokenParserInterface $parser) - { - $this->parsers[$parser->getTag()] = $parser; - } - - /** - * Removes a TokenParser. - * - * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance - */ - public function removeTokenParser(Twig_TokenParserInterface $parser) - { - $name = $parser->getTag(); - if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) { - unset($this->parsers[$name]); - } - } - - /** - * Adds a TokenParserBroker. - * - * @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance - */ - public function addTokenParserBroker(Twig_TokenParserBroker $broker) - { - $this->brokers[] = $broker; - } - - /** - * Removes a TokenParserBroker. - * - * @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance - */ - public function removeTokenParserBroker(Twig_TokenParserBroker $broker) - { - if (false !== $pos = array_search($broker, $this->brokers)) { - unset($this->brokers[$pos]); - } - } - - /** - * Gets a suitable TokenParser for a tag. - * - * First looks in parsers, then in brokers. - * - * @param string $tag A tag name - * - * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found - */ - public function getTokenParser($tag) - { - if (isset($this->parsers[$tag])) { - return $this->parsers[$tag]; - } - $broker = end($this->brokers); - while (false !== $broker) { - $parser = $broker->getTokenParser($tag); - if (null !== $parser) { - return $parser; - } - $broker = prev($this->brokers); - } - - return null; - } - - public function getParsers() - { - return $this->parsers; - } - - public function getParser() - { - return $this->parser; - } - - public function setParser(Twig_ParserInterface $parser) - { - $this->parser = $parser; - foreach ($this->parsers as $tokenParser) { - $tokenParser->setParser($parser); - } - foreach ($this->brokers as $broker) { - $broker->setParser($parser); - } - } -} diff --git a/core1/lib/Twig/TokenParserBrokerInterface.php b/core1/lib/Twig/TokenParserBrokerInterface.php deleted file mode 100644 index 3f006e33..00000000 --- a/core1/lib/Twig/TokenParserBrokerInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @deprecated since 1.12 (to be removed in 2.0) - */ -interface Twig_TokenParserBrokerInterface -{ - /** - * Gets a TokenParser suitable for a tag. - * - * @param string $tag A tag name - * - * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found - */ - public function getTokenParser($tag); - - /** - * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of. - * - * @param Twig_ParserInterface $parser A Twig_ParserInterface interface - */ - public function setParser(Twig_ParserInterface $parser); - - /** - * Gets the Twig_ParserInterface. - * - * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null - */ - public function getParser(); -} diff --git a/core1/lib/Twig/TokenParserInterface.php b/core1/lib/Twig/TokenParserInterface.php deleted file mode 100644 index bbde7714..00000000 --- a/core1/lib/Twig/TokenParserInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -interface Twig_TokenParserInterface -{ - /** - * Sets the parser associated with this token parser - * - * @param $parser A Twig_Parser instance - */ - public function setParser(Twig_Parser $parser); - - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token); - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag(); -} diff --git a/core1/lib/Twig/TokenStream.php b/core1/lib/Twig/TokenStream.php deleted file mode 100644 index a78189f6..00000000 --- a/core1/lib/Twig/TokenStream.php +++ /dev/null @@ -1,144 +0,0 @@ - - */ -class Twig_TokenStream -{ - protected $tokens; - protected $current; - protected $filename; - - /** - * Constructor. - * - * @param array $tokens An array of tokens - * @param string $filename The name of the filename which tokens are associated with - */ - public function __construct(array $tokens, $filename = null) - { - $this->tokens = $tokens; - $this->current = 0; - $this->filename = $filename; - } - - /** - * Returns a string representation of the token stream. - * - * @return string - */ - public function __toString() - { - return implode("\n", $this->tokens); - } - - public function injectTokens(array $tokens) - { - $this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current)); - } - - /** - * Sets the pointer to the next token and returns the old one. - * - * @return Twig_Token - */ - public function next() - { - if (!isset($this->tokens[++$this->current])) { - throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current - 1]->getLine(), $this->filename); - } - - return $this->tokens[$this->current - 1]; - } - - /** - * Tests a token and returns it or throws a syntax error. - * - * @return Twig_Token - */ - public function expect($type, $value = null, $message = null) - { - $token = $this->tokens[$this->current]; - if (!$token->test($type, $value)) { - $line = $token->getLine(); - throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', - $message ? $message.'. ' : '', - Twig_Token::typeToEnglish($token->getType(), $line), $token->getValue(), - Twig_Token::typeToEnglish($type, $line), $value ? sprintf(' with value "%s"', $value) : ''), - $line, - $this->filename - ); - } - $this->next(); - - return $token; - } - - /** - * Looks at the next token. - * - * @param integer $number - * - * @return Twig_Token - */ - public function look($number = 1) - { - if (!isset($this->tokens[$this->current + $number])) { - throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current + $number - 1]->getLine(), $this->filename); - } - - return $this->tokens[$this->current + $number]; - } - - /** - * Tests the current token - * - * @return bool - */ - public function test($primary, $secondary = null) - { - return $this->tokens[$this->current]->test($primary, $secondary); - } - - /** - * Checks if end of stream was reached - * - * @return bool - */ - public function isEOF() - { - return $this->tokens[$this->current]->getType() === Twig_Token::EOF_TYPE; - } - - /** - * Gets the current token - * - * @return Twig_Token - */ - public function getCurrent() - { - return $this->tokens[$this->current]; - } - - /** - * Gets the filename associated with this stream - * - * @return string - */ - public function getFilename() - { - return $this->filename; - } -} diff --git a/core1/log/error.log b/core1/log/error.log deleted file mode 100644 index 9fbb281b..00000000 --- a/core1/log/error.log +++ /dev/null @@ -1,492 +0,0 @@ -Server date & time: 14.11.2015 01:48:38 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 14.11.2015 01:48:38 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 14.11.2015 01:48:43 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 14.11.2015 01:48:43 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 14.11.2015 01:48:47 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 14.11.2015 01:48:47 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 178.137.24.87 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:55:28 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:55:28 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:55:44 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:55:44 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:56:01 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:56:01 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:57:38 -Error code: 10001 -Error message: SQLSTATE[28000] [1045] Access denied for user 'oribk'@'localhost' (using password: YES) -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 16 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '16'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '10'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 15.11.2015 21:57:38 -Error code: 10002 -Error message: [Internal Error] Could not establish DB connection -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 37.204.54.70 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/user.php', LINE: '29'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/comission.php', LINE: '18'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '32'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '26'; - -Server date & time: 13.01.2016 00:41:44 -Error code: 10002 -Error message: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'money' cannot be null -In file: /var/www/kombats/data/www/new-combats.com/core/app/core/database.php -In line: 37 -Client IP: 37.26.32.29 -GET Data: a:3:{s:8:"buy_item";s:2:"83";s:2:"kr";s:4:"1.02";s:4:"page";s:1:"1";} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/database.php', LINE: '37'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/auction.php', LINE: '128'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/logic/auction.php', LINE: '30'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/core/route.php', LINE: '33'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/app/init.php', LINE: '11'; - FILE: '/var/www/kombats/data/www/new-combats.com/core/index.php', LINE: '29'; - -Server date & time: 08.01.2018 17:21:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1045] Access denied for user 'newcom1_bk'@'s3056.avahost.net' (using password: YES) -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 178.136.56.91 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.01.2018 17:21:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1045] Access denied for user 'newcom1_bk'@'s3056.avahost.net' (using password: YES) -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 178.136.56.91 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 29.03.2018 19:03:37 -Error code: 10001 -Error message: SQLSTATE[HY000] [1045] Access denied for user 'newcom1_bk'@'s3056.avahost.net' (using password: YES) -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 149.202.78.80 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 14.05.2018 13:36:21 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 176.31.247.41 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 24.05.2018 07:42:55 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 119.28.77.20 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.07.2018 09:39:31 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.07.2018 09:39:31 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.07.2018 09:39:31 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.07.2018 09:39:31 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 08.07.2018 09:39:31 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 12.07.2018 23:46:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 12.07.2018 23:46:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 12.07.2018 23:46:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 12.07.2018 23:46:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 12.07.2018 23:46:00 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 31.07.2018 13:56:16 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 31.07.2018 13:56:16 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 31.07.2018 13:56:17 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 31.07.2018 13:56:17 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 31.07.2018 13:56:17 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host '93.170.136.50' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core/app/core/database.php -In line: 16 -Client IP: 206.189.8.249 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core/index.php', LINE: '30'; - -Server date & time: 24.10.2018 20:41:27 -Error code: 10001 -Error message: SQLSTATE[HY000] [1130] Host 'sv.new-combats.com' is not allowed to connect to this MariaDB server -In file: /home/newcom1/public_html/core1/app/core/database.php -In line: 16 -Client IP: 31.131.106.205 -GET Data: a:0:{} -POST Data: a:0:{} -Call Stack Trace: - FILE: '/home/newcom1/public_html/core1/app/core/database.php', LINE: '16'; - FILE: '/home/newcom1/public_html/core1/app/init.php', LINE: '10'; - FILE: '/home/newcom1/public_html/core1/index.php', LINE: '30'; - diff --git a/core1/static/fonts/ARDESTINE.ttf b/core1/static/fonts/ARDESTINE.ttf deleted file mode 100644 index 1fed8cf8..00000000 Binary files a/core1/static/fonts/ARDESTINE.ttf and /dev/null differ diff --git a/core1/static/fonts/ARESSENCE.ttf b/core1/static/fonts/ARESSENCE.ttf deleted file mode 100644 index eb49bd00..00000000 Binary files a/core1/static/fonts/ARESSENCE.ttf and /dev/null differ diff --git a/core1/static/fonts/Bradley Hand ITC.ttf b/core1/static/fonts/Bradley Hand ITC.ttf deleted file mode 100644 index b3ea904e..00000000 Binary files a/core1/static/fonts/Bradley Hand ITC.ttf and /dev/null differ diff --git a/core1/static/fonts/CHILLER.ttf b/core1/static/fonts/CHILLER.ttf deleted file mode 100644 index 86f6e38c..00000000 Binary files a/core1/static/fonts/CHILLER.ttf and /dev/null differ diff --git a/core1/static/fonts/Edgar_da_cool_Regular.ttf b/core1/static/fonts/Edgar_da_cool_Regular.ttf deleted file mode 100644 index 782443ed..00000000 Binary files a/core1/static/fonts/Edgar_da_cool_Regular.ttf and /dev/null differ diff --git a/core1/static/fonts/FRSCRIPT.ttf b/core1/static/fonts/FRSCRIPT.ttf deleted file mode 100644 index 63806946..00000000 Binary files a/core1/static/fonts/FRSCRIPT.ttf and /dev/null differ diff --git a/core1/static/fonts/Fh_Script_Regular.ttf b/core1/static/fonts/Fh_Script_Regular.ttf deleted file mode 100644 index a86acdd1..00000000 Binary files a/core1/static/fonts/Fh_Script_Regular.ttf and /dev/null differ diff --git a/core1/static/fonts/Gabo4_Gabo4.ttf b/core1/static/fonts/Gabo4_Gabo4.ttf deleted file mode 100644 index e88a8db6..00000000 Binary files a/core1/static/fonts/Gabo4_Gabo4.ttf and /dev/null differ diff --git a/core1/static/fonts/Hurryup_Hurryup.ttf b/core1/static/fonts/Hurryup_Hurryup.ttf deleted file mode 100644 index 5782791f..00000000 Binary files a/core1/static/fonts/Hurryup_Hurryup.ttf and /dev/null differ diff --git a/core1/static/fonts/JAMI_Regular.ttf b/core1/static/fonts/JAMI_Regular.ttf deleted file mode 100644 index 3e445b95..00000000 Binary files a/core1/static/fonts/JAMI_Regular.ttf and /dev/null differ diff --git a/core1/static/fonts/Justy1_Regular.ttf b/core1/static/fonts/Justy1_Regular.ttf deleted file mode 100644 index afae1b54..00000000 Binary files a/core1/static/fonts/Justy1_Regular.ttf and /dev/null differ diff --git a/core1/static/fonts/cour.ttf b/core1/static/fonts/cour.ttf deleted file mode 100644 index 9f6bc1aa..00000000 Binary files a/core1/static/fonts/cour.ttf and /dev/null differ diff --git a/core1/static/fonts/courbd.ttf b/core1/static/fonts/courbd.ttf deleted file mode 100644 index ddb890d5..00000000 Binary files a/core1/static/fonts/courbd.ttf and /dev/null differ diff --git a/core1/static/fonts/courbi.ttf b/core1/static/fonts/courbi.ttf deleted file mode 100644 index 68721211..00000000 Binary files a/core1/static/fonts/courbi.ttf and /dev/null differ diff --git a/core1/static/fonts/couri.ttf b/core1/static/fonts/couri.ttf deleted file mode 100644 index e230dd59..00000000 Binary files a/core1/static/fonts/couri.ttf and /dev/null differ diff --git a/core1/static/fonts/de_Manu_2_Regular.ttf b/core1/static/fonts/de_Manu_2_Regular.ttf deleted file mode 100644 index a22428e5..00000000 Binary files a/core1/static/fonts/de_Manu_2_Regular.ttf and /dev/null differ diff --git a/core1/static/image.php b/core1/static/image.php deleted file mode 100644 index fa48b675..00000000 --- a/core1/static/image.php +++ /dev/null @@ -1,57 +0,0 @@ - \ No newline at end of file diff --git a/core1/static/scripts/item.js b/core1/static/scripts/item.js deleted file mode 100644 index cbfb5ced..00000000 --- a/core1/static/scripts/item.js +++ /dev/null @@ -1,466 +0,0 @@ -// JavaScript Document -var itmjs = { - - city: { - 'capitalcity' : 'Capital City' - }, - - explode:function ( delimiter, string ) { // Split a string by string - // - // + original by: Kevin van Zonneveld (https://kevin.vanzonneveld.net) - // + improved by: kenneth - // + improved by: Kevin van Zonneveld (https://kevin.vanzonneveld.net) - - var emptyArray = { 0: '' }; - - if ( arguments.length != 2 - || typeof arguments[0] == 'undefined' - || typeof arguments[1] == 'undefined' ) - { - return null; - } - - if ( delimiter === '' - || delimiter === false - || delimiter === null ) - { - return false; - } - - if ( typeof delimiter == 'function' - || typeof delimiter == 'object' - || typeof string == 'function' - || typeof string == 'object' ) - { - return emptyArray; - } - - if ( delimiter === true ) { - delimiter = '1'; - } - - return string.toString().split ( delimiter.toString() ); - }, - - lookStats:function( data ) { - var r = { },de = []; - var di = this.explode('|',data); - var i = 0; - while( i != -1 ) { - if( di[i] != undefined ) { - de = this.explode('=',di[i]); - r[de[0]] = de[1]; - }else{ - i = -2; - } - i++; - } - return r; - }, - - st_tr:['sex','align','lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','a1','a2','a3','a4','a5','a6','a7','mg1','mg2','mg3','mg4','mg5','mg6','mg7','mall','m2all','aall','rep','align_bs'], - st_all:['exp','align_bs','nopryh','puti','align','hpAll','mpAll','enAll','sex','lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','a1','a2','a3','a4','a5','a6','a7','aall','mall','m2all','mg1','mg2','mg3','mg4','mg5','mg6','mg7','tj','lh','minAtack','maxAtack','m10','m11','m11a','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','zm','zma','za1','za2','za3','za4','zm1','zm2','zm3','zm4','zm5','zm6','zm7','magic_cast','pza','pzm','pza1','min_heal_proc','notravma','yron_min','yron_max','zaproc','zmproc','zm2proc','pza2','pza3','pza4','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','speedhp','speedmp','tya1','tya2','tya3','tya4','tym1','mg2static_points','tym2','tym3','tym4','hpProc','mpProc','tym5','tym6','tym7','min_use_mp','pog','pog2','pog2p','pog2mp','maxves','bonusexp','speeden','yza','yzm','yzma','yza1','yza2','yza3','yza4','yzm1','yzm2','yzm3','yzm4','yzm5','yzm6','yzm7','rep'], - st_add:['exp','enemy_am1','hod_minmana','yhod','noshock_voda','yza','yzm','yzma','yza1','yza2','yza3','yza4','yzm1','yzm2','yzm3','yzm4','yzm5','yzm6','yzm7','notuse_last_pr','yrn_mg_first','antishock','nopryh','speed_dungeon','naemnik','mg2static_points','yrnhealmpprocmg3','nousepriem','notactic','seeAllEff','100proboi1','pog2','pog2p','magic_cast','min_heal_proc','no_yv1','no_krit1','no_krit2','no_contr1','no_contr2','no_bl1','no_pr1','no_yv2','no_bl2','no_pr2','silver','pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','yron_min','yron_max','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','hpVinos','mpVinos','mpAll','enAll','hpProc','mpProc','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','m11a','zona','zonb','maxves','minAtack','maxAtack','bonusexp','speeden'], - st_sv:['pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','enAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','speeden'], - infoItem:function( data , i , module ) { - var r = '', itm = data[i]; - // - if( itm[6] != itm[12] && itm[12] > 1 ) { - itm[6] = itm[12]; - if( data['g'][itm['iid']] != undefined && itm[21] > 0 && data['g'][itm['iid']][itm[21]] > 0 ) { - itm[6] * data['g'][itm['iid']][itm[21]]; - } - } - var po = this.lookStats( itm[20] ); - r += '' + itm[1] + ''; - if( module == 'comission' || module == 'comission_pick' ) { - if( itm['x'] > 1 ) { - r += ' (x' + itm['x'] + ')'; - } - }else{ - if( itm[21] > 0 && data['g'][itm['iid']] != undefined && data['g'][itm['iid']][itm[21]] > 0 ) { - if( data['g'][itm['iid']][itm[21]] > 1 ) { - r += ' (x' + data['g'][itm['iid']][itm[21]] + ')'; - } - } - } - r += ''; - r += '    (Масса: ' + itm[10] + ')'; - if( po['art'] != undefined ) { - r += ' '; - } - if( itm[17] != '' ) { - r += ' '; - } - if( po['sudba'] != undefined ) { - if( po['sudba'] == 0 ) { - r += ' '; - }else if( po['sudba'] == 1 ) { - r += ' '; - }else{ - r += ' '; - } - } - r += '
    '; - if( module == 'comission' || module == 'comission_pick' ) { - r += 'Цена: ' + itm['prc'] + ' кр. '; - r += '    (Гос.Цена. ' + (itm['x'] * itm[6]) + ' кр.)'; - //r += ' (Количество: 1)'; - r += '
    ' - }else{ - if( itm[6] > 0 ) { - r += 'Цена: ' + itm[6] + ' кр.'; - r += '
    ' - } - } - if( Math.ceil(itm[16]) > 0 ) { - r += 'Долговечность: ' + Math.ceil(itm[15]) + '/' + Math.ceil(itm[16]) + '
    '; - } - // - var tr = ''; - - var i = 0; - while( i != -1 ) { - if( this.st_tr[i] != undefined ) { - if( po['tr_' + this.st_tr[i] ] != undefined && this.st_is[this.st_tr[i]][0] != undefined && this.st_is[this.st_tr[i]][0] != '' ) { - tr += '
    • ' + this.st_is[this.st_tr[i]][0] + ': ' + po['tr_' + this.st_tr[i] ] + ''; - } - }else{ - i = -2; - } - i++; - } - - - if( tr != '' ) { - r += 'Требует минимальное:' + tr + '
    '; - tr = ''; - } - // - var add = ''; - - var i = 0; - while( i != -1 ) { - if( this.st_add[i] != undefined ) { - if( po['add_' + this.st_add[i] ] != undefined && this.st_is[this.st_add[i]] != undefined && this.st_is[this.st_add[i]][0] != undefined && this.st_is[this.st_add[i]][0] != '' ) { - add += '
    • ' + this.st_is[this.st_add[i]][0] + ': '; - if( po['add_' + this.st_add[i] ] > 0 ) { - add += '+'; - } - add += '' + po['add_' + this.st_add[i] ] + ''; - } - }else{ - i = -2; - } - i++; - } - if( po['add_minAtack'] != undefined ) { - add += '
    • Минимальный урон: '; - if( po['add_minAtack'] > 0 ) { - add += '+'; - } - add += po['add_minAtack']; - } - if( po['add_maxAtack'] != undefined ) { - add += '
    • Максимальный урон: '; - if( po['add_maxAtack'] > 0 ) { - add += '+'; - } - add += po['add_minAtack']; - } - if( po['add_mib1'] != undefined ) { - add += '
    • Броня головы: ' + po['add_mib1'] + '-' + po['add_mab1'] + ''; - } - if( po['add_mib2'] != undefined ) { - add += '
    • Броня корпуса: ' + po['add_mib2'] + '-' + po['add_mab2'] + ''; - } - if( po['add_mib3'] != undefined ) { - add += '
    • Броня пояса: ' + po['add_mib3'] + '-' + po['add_mab3'] + ''; - } - if( po['add_mib4'] != undefined ) { - add += '
    • Броня ног: ' + po['add_mib4'] + '-' + po['add_mab4'] + ''; - } - - if( add != '' ) { - r += 'Действует на:' + add + '
    '; - add = ''; - } - // - var sv = ''; - - if( po['sv_yron_min'] != undefined ) { - sv += '
    • Урон: ' + po['sv_yron_min'] + '-' + po['sv_yron_max'] + ''; - } - var i = 0; - while( i != -1 ) { - if( this.st_sv[i] != undefined ) { - if( po['sv_' + this.st_sv[i] ] != undefined && this.st_is[this.st_sv[i]][0] != undefined && this.st_is[this.st_sv[i]][0] != '' ) { - sv += '
    • ' + this.st_is[this.st_sv[i]][0] + ': '; - if( po['sv_' + this.st_sv[i] ] > 0 ) { - sv += '+'; - } - sv += '' + po['sv_' + this.st_sv[i] ] + ''; - } - }else{ - i = -2; - } - i++; - } - if( itm[4] > 0 ) { - sv += '
    • Второе оружие'; - } - if( itm[3] > 0 ) { - sv += '
    • Двуручное оружие'; - } - if( po['zonb'] != undefined ) { - var pozonb = ''; - if( po['zonb'] > 0 ) { - var i = 0; - while( i < po['zonb'] ) { - pozonb += '+'; - i++; - } - }else if( po['zonb'] < 0 ) { - var i = 0; - while( i > po['zonb'] ) { - pozonb += '-'; - i--; - } - }else{ - po['zonb'] += '??'; - } - sv += '
    • Зоны блокирования: ' + pozonb + ''; - } - - if( sv != '' ) { - r += 'Свойства предмета:' + sv + '
    '; - sv = ''; - } - // - var yl = ''; - - if( yl != '' ) { - r += 'Улучшения предмета:' + yl + '
    '; - yl = ''; - } - // - var os = ''; - var i = 1; - while( i <= 11 ) { - if( i < 5 ) { - if( po['tya' + i] != undefined ) { - os += '
    • ' + this.st_is['tya' + i][0] + ': ' + this.tympar(po['tya' + i]); - } - }else{ - if( po['tym' + i] != undefined ) { - os += '
    • ' + this.st_is['tym' + i][0] + ': ' + this.tympar(po['tym' + i]); - } - } - i++; - } - if( os != '' ) { - r += 'Особенности предмета:' + os + '
    '; - os = ''; - } - // - var sd = ''; - - if( itm[9] != '' ) { - sd += 'Описание:
    ' + itm[9] + '
    '; - } - - if( itm[19] != '' ) { - sd += 'Сделано в ' + this.city[itm[19]] + '
    '; - } - // - if( po['nosale'] != undefined ) { - sd += 'Предмет нельзя продать
    '; - } - if( po['noremont'] != undefined ) { - sd += 'Предмет не подлежит ремонту
    '; - } - if( po['zazuby'] != undefined ) { - sd += 'Предмет куплен за зубы
    '; - } - if( po['frompisher'] != undefined ) { - sd += 'Предмет из подземелья
    '; - } - // - if( sd != '' ) { - r += '' + sd + ''; - sd = ''; - } - return r; - }, - - tympar:function(val) { - var r = ''; - if( val >= 100 ) { - r = 'Всегда'; - }else if( val > 89 ) { - r = 'Часты' - }else if( val > 69 ) { - r = 'Регулярны'; - }else if( val > 39 ) { - r = 'Временами'; - }else if( val > 19 ) { - r = 'Малы'; - }else if( val > 9 ) { - r = 'Редки'; - }else{ - r = 'Ничтожно редки'; - } - r += ' (' + val + '%)'; - return r; - }, - - st_is:{ - 'exp':['Получаемый опыт (%)'], - 'align_bs':['Служитель закона'], - 'nopryh':['Прямое поподание'], - 'puti':['Запрет перемещения'], - 'align':['Склонность'], - 'hpAll':['Уровень жизни (HP)'], - 'mpAll':['Уровень маны'], - 'enAll':['Уровень энергии'], - 'sex':['Пол'], - 'lvl':['Уровень'], - 's1':['Сила'], - 's2':['Ловкость'], - 's3':['Интуиция'], - 's4':['Выносливость'], - 's5':['Интеллект'], - 's6':['Мудрость'], - 's7':['Духовность'], - 's8':['Воля'], - 's9':['Свобода духа'], - 's10':['Божественность'], - 's11':['Энергия'], - 'm1':['Мф. критического удара (%)'], - 'm2':['Мф. против критического удара (%)'], - 'm3':['Мф. мощности крит. удара (%)'], - 'm4':['Мф. увертывания (%)'], - 'm5':['Мф. против увертывания (%)'], - 'm6':['Мф. контрудара (%)'], - 'm7':['Мф. парирования (%)'], - 'm8':['Мф. блока щитом (%)'], - 'm9':['Мф. удара сквозь броню (%)'], - 'm14':['Мф. абс. критического удара (%)'], - 'm15':['Мф. абс. увертывания (%)'], - 'm16':['Мф. абс. парирования (%)'], - 'm17':['Мф. абс. контрудара (%)'], - 'm18':['Мф. абс. блока щитом (%)'], - 'm19':['Мф. абс. магический промах (%)'], - 'm20':['Мф. удача (%)'], - 'a1':['Мастерство владения ножами, кинжалами'], - 'a2':['Мастерство владения топорами, секирами'], - 'a3':['Мастерство владения дубинами, молотами'], - 'a4':['Мастерство владения мечами'], - 'a5':['Мастерство владения магическими посохами'], - 'a6':['Мастерство владения луками'], - 'a7':['Мастерство владения арбалетами'], - 'aall':['Мастерство владения оружием'], - 'mall':['Мастерство владения магией стихий'], - 'm2all':['Мастерство владения магией'], - 'mg1':['Мастерство владения магией огня'], - 'mg2':['Мастерство владения магией воздуха'], - 'mg3':['Мастерство владения магией воды'], - 'mg4':['Мастерство владения магией земли'], - 'mg5':['Мастерство владения магией Света'], - 'mg6':['Мастерство владения магией Тьмы'], - 'mg7':['Мастерство владения серой магией'], - 'tj':['Тяжелая броня'], - 'lh':['Легкая броня'], - 'minAtack':['Минимальный урон'], - 'maxAtack':['Максимальный урон'], - 'm10':['Мф. мощности урона'], - 'm11':['Мф. мощности магии стихий'], - 'm11a':['Мф. мощности магии'], - 'pa1':['Мф. мощности колющего урона'], - 'pa2':['Мф. мощности рубящего урона'], - 'pa3':['Мф. мощности дробящий урона'], - 'pa4':['Мф. мощности режущий урона'], - 'pm1':['Мф. мощности магии огня'], - 'pm2':['Мф. мощности магии воздуха'], - 'pm3':['Мф. мощности магии воды'], - 'pm4':['Мф. мощности магии земли'], - 'pm5':['Мф. мощности магии Света'], - 'pm6':['Мф. мощности магии Тьмы'], - 'pm7':['Мф. мощности серой магии'], - 'za':['Защита от урона'], - 'zm':['Защита от магии стихий'], - 'zma':['Защита от магии'], - 'za1':['Защита от колющего урона'], - 'za2':['Защита от рубящего урона'], - 'za3':['Защита от дробящего урона'], - 'za4':['Защита от режущего урона'], - 'zm1':['Защита от магии огня'], - 'zm2':['Защита от магии воздуха'], - 'zm3':['Защита от магии воды'], - 'zm4':['Защита от магии земли'], - 'zm5':['Защита от магии Света'], - 'zm6':['Защита от магии Тьмы'], - 'zm7':['Защита от серой магии'], - 'magic_cast':['Дополнительный каст за ход'], - 'pza':['Понижение защиты от урона'], - 'pzm':['Понижение защиты от магии'], - 'pza1':['Понижение защиты от колющего урона'], - 'min_heal_proc':['Эффект лечения (%)'], - 'notravma':['Защита от травм'], - 'yron_min':['Минимальный урон'], - 'yron_max':['Максимальный урон'], - 'zaproc':['Защита от урона (%)'], - 'zmproc':['Защита от магии стихий (%)'], - 'zm2proc':['Защита от магии Воздуха (%)'], - 'pza2':['Понижение защиты от рубящего урона'], - 'pza3':['Понижение защиты от дробящего урона'], - 'pza4':['Понижение защиты от режущего урона'], - 'pzm1':['Понижение защиты от магии огня'], - 'pzm2':['Понижение защиты от магии воздуха'], - 'pzm3':['Понижение защиты от магии воды'], - 'pzm4':['Понижение защиты от магии земли'], - 'pzm5':['Понижение защиты от магии Света'], - 'pzm6':['Понижение защиты от магии Тьмы'], - 'pzm7':['Понижение защиты от серой магии'], - 'speedhp':['Регенерация здоровья (%)'], - 'speedmp':['Регенерация маны (%)'], - 'tya1':['Колющие атаки'], - 'tya2':['Рубящие атаки'], - 'tya3':['Дробящие атаки'], - 'tya4':['Режущие атаки'], - 'tym1':['Огненные атаки'], - 'mg2static_points':['Уровень заряда (Воздух)'], - 'tym2':['Электрические атаки'], - 'tym3':['Ледяные атаки'], - 'tym4':['Земляные атаки'], - 'hpProc':['Уровень жизни (%)'], - 'mpProc':['Уровень маны (%)'], - 'tym5':['Атаки Света'], - 'tym6':['Атаки Тьмы'], - 'tym7':['Серые атаки'], - 'min_use_mp':['Уменьшает расход маны'], - 'pog':['Поглощение урона'], - 'pog2':['Поглощение урона'], - 'pog2p':['Процент поглощение урона'], - 'pog2mp':['Цена поглощение урона'], - 'maxves':['Увеличивает рюкзак'], - 'bonusexp':['Увеличивает получаемый опыт'], - 'speeden':['Регенерация энергии (%)'], - 'yza':['Уязвимость физическому урона (%)'], - 'yzm':['Уязвимость магии стихий (%)'], - 'yzma':['Уязвимость магии (%)'], - 'yza1':['Уязвимость колющему урона (%)'], - 'yza2':['Уязвимость рубящему урона (%)'], - 'yza3':['Уязвимость дробящему урона (%)'], - 'yza4':['Уязвимость режущему урона (%)'], - 'yzm1':['Уязвимость магии огня (%)'], - 'yzm2':['Уязвимость магии воздуха (%)'], - 'yzm3':['Уязвимость магии воды (%)'], - 'yzm4':['Уязвимость магии земли (%)'], - 'yzm5':['Уязвимость магии (%)'], - 'yzm6':['Уязвимость магии (%)'], - 'yzm7':['Уязвимость магии (%)'], - 'rep':['Репутация Рыцаря'] - } - -}; \ No newline at end of file diff --git a/core1/static/scripts/location.line.js b/core1/static/scripts/location.line.js deleted file mode 100644 index b7a38840..00000000 --- a/core1/static/scripts/location.line.js +++ /dev/null @@ -1,84 +0,0 @@ -// JavaScript Document -var locline = { - - lineRefleshStart:function() { - $('#line_rel1').hide(); - $('#line_rel2').show(); - this.finish = 0; - }, - lineRefleshFinish:function() { - $('#line_rel2').hide(); - $('#line_rel1').show(); - this.finish = 1; - }, - finish:1, - line:function( a , b , c , reflesh ) { - var r = ''; - this.a = a; - this.b = b; - this.c = c; - var d1 = '', d2 = 'none'; - if( this.finish == 0 ) { - d2 = ''; - d1 = 'none'; - } - r += '' + - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
    ' + - ''+ - ''+ - '
    '; - return r; - }, - timer:null, - b:0, - a:0, - c:0, - lineTimer:function() { - if(document.getElementById('MoveLine')!=undefined) { - var prc = Math.ceil( (this.a - this.c) ); - if( prc < 0 ) { - prc = 0; - } - $('#MoveLine').animate({'width':'63px'}, prc * 1000 , "linear" ); - } - return ''; - }, - room:function( data ) { - var r = ''; - /* - - - - - -
    Центральная Площадь
    - */ - r += ''; - var i = 0; - while( i != - 1 ) { - if( data[i] != undefined ) { - r += ''; - r += ''; - }else{ - i = -2; - } - i++; - } - r += '
    ' + data[i][2] + '
    '; - return r; - } - -}; \ No newline at end of file diff --git a/core1/static/scripts/location/auction.js b/core1/static/scripts/location/auction.js deleted file mode 100644 index c02c094e..00000000 --- a/core1/static/scripts/location/auction.js +++ /dev/null @@ -1,555 +0,0 @@ -// JavaScript Document -var locjs = { - - data:{ }, - - type:0, //0 - просмотр разделов , 1 - просмотр разделов и конкретного предмета , 2 - просмотр своих вещей (сдача) , 3 - просмотр своих вещей (забрать) - - baseconnect:false, - - start:function() { - this.getMenuHtml(); - this.getTopMenu(); - this.getDataItems(1); - // - locline.lineRefleshFinish(); - }, - - reflesh:function() { - locline.lineRefleshFinish(); - }, - - option_error:{ - - }, - - page_item:1, - option_item:1, - getDataItems:function( id ) { - this.option_item = id; - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/auction/', { - 'option_item':id, - 'page':locjs.page_item, - },function(data) { - locjs.baseconnect = false; - // - locjs.data.user.massaNow = parseFloat(data.massaNow).toFixed(2); - locjs.data.user.massaMax = parseFloat(data.massaMax).toFixed(2); - locjs.data.user.money = parseFloat(data.money).toFixed(2); - // - if( data.toppages != undefined && data.toppages > 0 ) { - var tphtml = ''; - var i = 1; - while( i <= data.toppages ) { - if( data.page == i ) { - tphtml = tphtml + '' + i + ' '; - }else{ - tphtml = tphtml + '' + i + ' '; - } - i++; - } - $('#toppages_line').show(); - $('#toppages').html( tphtml ); - }else{ - $('#toppages_line').hide(); - $('#toppages').html( '--' ); - } - // - if( data.item_data != undefined && data.item_data != 0 ) { - locjs.getItemsAuction( id , data.item_data ); - }else{ - locjs.getItemsAuction( id , {'x':0} ); - } - // - $('#u_money').html( locjs.data.user.money + ' кр.' ); - $('#u_massa').html( locjs.data.user.massaNow + '/' + locjs.data.user.massaMax ); - // - locline.lineRefleshFinish(); - // - }); - } - }, - - console_sale:function(id, txt, kr) { - var s = prompt("Сделать ставку на \""+txt+"\". Укажите цену:", kr); - if ((s != null) && (s != '') && (s >= 0)) { - locjs.user_buy( id, kr ); - } - }, - - buyItemsAuctionError:{ - 0:'', - 1:'Предмет не найден, возможно торги уже закончились', - 2:'Вы уже сделали ставку на этот предмет, ожидайте пока её перебьет кто-то другой', - 3:'Минимальная ставка 101% от текущей ставки', - 4:'Максимальная ставка 200% от текущей ставки', - 5:'У вас недостаточно денег для ставки', - 6:'Вы не можете участвовать в ставках на свои предметы' - }, - user_buy:function( id, kr ) { - // - //this.option_item = id; - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/auction/', { - 'buy_item':id, - 'kr':kr, - 'page':locjs.page_item, - },function(data) { - locjs.baseconnect = false; - // - if( data.error != undefined ) { - if( locjs.buyItemsAuctionError[ data.error ] != undefined ) { - $('#error').html( locjs.buyItemsAuctionError[ data.error ] ); - }else{ - $('#error').html( 'Неизвестная ошибка. Код #'+data.error+'' ); - } - $('#error').show(); - $("body").animate({"scrollTop":0},0); - }else{ - if( data.info != undefined ) { - alert('Вы успешно сделали ставку!'); - } - $('#error').html(''); - $('#error').hide(); - } - // - locline.lineRefleshFinish(); - // - }); - } - // - }, - - getItemsAuction:function( id , data ) { - var r = ''; - if( id == 5 ) { - r += ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - //предмет - if( data.x != undefined && data.x > 0 ) { - var i = 0; - while( i < data.x ) { - if( data[i] != undefined ) { - var itm_data = itmjs.lookStats( data[i][20] ); - if( itm_data['tr_lvl'] == undefined ) { - itm_data['tr_lvl'] = 0; - } - if( data[i].buy == '' ) { - data[i].buy = 'Нет покупателя'; - } - if( data[i].user_ow == '' ) { - data[i].user_ow = 'Неизвестно'; - } - if( data[i].time == '0 сек.' ) { - data[i].time = 'Торг закрыт.'; - } - r += ''+ - ''+ - ''+ - //''+ - ''+ - //''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - // - } - i++; - } - } - r += '
    Предмет  УровеньВладелецСтавкаПокупательОсталось времени

    ' + data[i].name + '   (Масса: ' + data[i].massa + ')
    Долговечность: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '
    --' + itm_data['tr_lvl'] + '' + data[i].user_ow + '' + data[i].prc + ' кр.' + data[i].buy + '' + data[i].time + '
    '; - if( data.x == undefined || data.x < 1 ) { - r += '
    Ничего не найдено
    '; - } - }else if( id == 1 ) { - r += ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - //предмет - if( data.x != undefined && data.x > 0 ) { - var i = 0; - while( i < data.x ) { - if( data[i] != undefined ) { - var itm_data = itmjs.lookStats( data[i][20] ); - if( itm_data['tr_lvl'] == undefined ) { - itm_data['tr_lvl'] = 0; - } - if( data[i].buy == '' ) { - data[i].buy = 'Нет покупателя'; - } - if( data[i].user_ow == '' ) { - data[i].user_ow = 'Неизвестно'; - } - if( data[i].time == '0 сек.' ) { - data[i].time = 'Торг закрыт.'; - } - r += ''+ - ''+ - ''+ - //''+ - ''+ - //''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - // - } - i++; - } - } - r += '
    Предмет  УровеньВладелецСтавкаПокупательОсталось времени

    ' + data[i].name + '   (Масса: ' + data[i].massa + ')
    Долговечность: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '
    --' + itm_data['tr_lvl'] + '' + data[i].user_ow + '' + data[i].prc + ' кр.' + data[i].buy + '' + data[i].time + '
    '; - if( data.x == undefined || data.x < 1 ) { - r += '
    Ничего не найдено
    '; - } - }else if( id == 2 ) { - r += ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - //предмет - if( data.x != undefined && data.x > 0 ) { - var i = 0; - while( i < data.x ) { - if( data[i] != undefined ) { - var itm_data = itmjs.lookStats( data[i][20] ); - if( itm_data['tr_lvl'] == undefined ) { - itm_data['tr_lvl'] = 0; - } - if( data[i].buy == '' ) { - data[i].buy = 'Нет покупателя'; - } - if( data[i].user_ow == '' ) { - data[i].user_ow = 'Неизвестно'; - } - if( data[i].time == '0 сек.' ) { - data[i].time = 'Торг закрыт.'; - } - r += ''+ - ''+ - //''+ - ''+ - //''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - // - } - i++; - } - } - r += '
    Предмет УровеньВладелецСтавкаПокупательОсталось времени

    ' + data[i].name + '   (Масса: ' + data[i].massa + ')
    Долговечность: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '
    --' + itm_data['tr_lvl'] + '' + data[i].user_ow + '' + data[i].prc + ' кр.' + data[i].buy + '' + data[i].time + '
    '; - if( data.x == undefined || data.x < 1 ) { - r += '
    Ничего не найдено
    '; - } - }else if( id == 3 ) { - r += ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - //предмет - if( data.x != undefined && data.x > 0 ) { - var i = 0; - while( i < data.x ) { - if( data[i] != undefined ) { - var itm_data = itmjs.lookStats( data[i][20] ); - if( itm_data['tr_lvl'] == undefined ) { - itm_data['tr_lvl'] = 0; - } - if( data[i].buy == '' ) { - data[i].buy = 'Нет покупателя'; - } - if( data[i].user_ow == '' ) { - data[i].user_ow = 'Неизвестно'; - } - if( data[i].time == '0 сек.' ) { - data[i].time = 'Торг закрыт.'; - } - r += ''+ - ''+ - //''+ - ''+ - //''+ - ''+ - ''+ - ''+ - ''+ - ''; - // - } - i++; - } - } - r += '
    Предмет УровеньСтавкаПокупательОсталось времени

    ' + data[i].name + '   (Масса: ' + data[i].massa + ')
    Долговечность: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '
    --' + itm_data['tr_lvl'] + '' + data[i].prc + ' кр.' + data[i].buy + '' + data[i].time + '
    '; - if( data.x == undefined || data.x < 1 ) { - r += '
    Ничего не найдено
    '; - } - }else if( id == 4 ) { - if( locjs.data.user.silver >= 4 ) { - prcauc = 2.5; - }else{ - prcauc = 10; - } - r += ''+ - ''+ - ''+ - ''+ - ''+ - ''; - //предмет - if( data.x != undefined && data.x > 0 ) { - var i = 0; - while( i < data.x ) { - if( data[i] != undefined ) { - var itm_data = itmjs.lookStats( data[i][20] ); - if( itm_data['tr_lvl'] == undefined ) { - itm_data['tr_lvl'] = 0; - } - r += ''+ - ''+ - //''+ - //''+ - ''+ - ''+ - ''+ - ''; - // - } - i++; - } - } - r += '
    Предмет УровеньНачальная ставка
    (Выставляется на 24 часа. +' + prcauc + '% комиссия)

    ' + data[i].name + '   (Масса: ' + data[i].massa + ')
    Долговечность: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '
    ' + itmjs.infoItem( data , i , 'auction_inventory' ) + '' + itm_data['tr_lvl'] + ' кр.
    '; - if( data.x == undefined || data.x < 1 ) { - r += '
    Ничего не найдено
    '; - } - } - - $('#auction_content').html( r ); - }, - - addItemsAuctionError:{ - 0:'Все прошло успешно', - 1:'Подходящий предмет не найден у вас в инвентаре', - 2:'Нельзя продать предмет дешевле 1 кр.', - 3:'Нельзя продать предмет дороже 1000000 кр.', - 4:'У вас недостаточно кр. для выставления предмета. Требуется 10% от вашей ставки.' - }, - addItemsAuction:function(id) { - // - this.option_item = id; - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/auction/', { - 'add_item':id, - 'price':$('#itm_add' + id + '_price').val(), - 'page':locjs.page_item, - },function(data) { - locjs.baseconnect = false; - // - if( data.error != undefined ) { - if( locjs.addItemsAuctionError[ data.error ] != undefined ) { - $('#error').html( locjs.addItemsAuctionError[ data.error ] ); - }else{ - $('#error').html( 'Неизвестная ошибка. Код #'+data.error+'' ); - } - $('#error').show(); - $("body").animate({"scrollTop":0},0); - }else{ - if( data.info != undefined ) { - if(data.info.x > 0) { - data.info.itm_name = data.info.itm_name + ' (x' + (1+data.info.x) + ')'; - } - //$("body").animate({"scrollTop":0},0); - //$('#error').html( 'Вы успешно выставили предмет "' + data.info.itm_name + '" на продажу за ' + data.info.price + ' кр.' ); - //$('#error').show(); - $('#itm_auction' + data.info.id).hide(); - } - $('#error').html(''); - $('#error').hide(); - } - // - locline.lineRefleshFinish(); - // - }); - } - // - }, - - getTopMenu:function() { - var r = ''; - - r += ''; - // - r += ''; - r += ''; - // - r += ''; - // - r += ''; - // - r += '' - // - r += '
    Филиал Аукциона (тестовая версия)Страницы: --  
    ' - r += ''; - r += ''; - r += ''; - r += ''; - r += ''; - r += ''; - r += '
    Залы:
    Имя: '; - r += ''; - r += ', уровень - '; - r += '
    '; - // - $('#auction_title').html( r ); - - // - // - // - }, - - getMenuHtml:function() { - var r = ''; - r += '
    ' + locline.line( this.data.user.timeGo, this.data.user.timeGoL , this.data.user.timeNow , 'locjs.reflesh();' ) + - '' + locline.room( this.data.locations ) + '' - + '
    '; - // - r += '
    У вас в наличии: ' + this.data.user.money + ' кр.
    Масса: ' + parseInt(this.data.user.massaNow).toFixed(2) + '/' + parseInt(this.data.user.massaMax).toFixed(2) + '
    '; - // - $('#auction_menu').html( r ); - locline.lineTimer(); - }, - - selectMenu:function( id ) { - if( $('#stylemenu' + id).attr('id') == 'stylemenu' + id ) { - this.getDataItems( id ); - var i = 1 - while( i != - 1 ) { - if( $('#stylemenu' + i).attr('id') == 'stylemenu' + i ) { - // - $('#stylemenu' + i).removeClass('unasel'); - $('#stylemenu' + i).removeClass('asel'); - // - if( $('#stylemenu' + i).attr('id') == 'stylemenu' + id ) { - $('#stylemenu' + i).addClass('asel'); - }else{ - $('#stylemenu' + i).addClass('unasel'); - } - // - }else{ - i = -2; - } - i++; - } - }else{ - alert('Раздел не найден'); - } - }, - - error:function( text ) { - $('#error').html( text ); - if( text == '' ) { - $('#error').hide(); - }else{ - $('#error').show(); - } - }, - - replaceslashhint:function(data) { - data = this.str_replace('"','',data); - data = this.str_replace("'","",data); - return data; - }, - - str_replace:function(search, replace, subject, count) { - var i = 0, - j = 0, - temp = '', - repl = '', - sl = 0, - fl = 0, - f = [].concat(search), - r = [].concat(replace), - s = subject, - ra = Object.prototype.toString.call(r) === '[object Array]', - sa = Object.prototype.toString.call(s) === '[object Array]'; - s = [].concat(s); - if (count) { - this.window[count] = 0; - } - - for (i = 0, sl = s.length; i < sl; i++) { - if (s[i] === '') { - continue; - } - for (j = 0, fl = f.length; j < fl; j++) { - temp = s[i] + ''; - repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0]; - s[i] = (temp) - .split(f[j]) - .join(repl); - if (count && s[i] !== temp) { - this.window[count] += (temp.length - s[i].length) / f[j].length; - } - } - } - return sa ? s : s[0]; - } -}; \ No newline at end of file diff --git a/core1/static/scripts/location/comission.js b/core1/static/scripts/location/comission.js deleted file mode 100644 index a7d3fabe..00000000 --- a/core1/static/scripts/location/comission.js +++ /dev/null @@ -1,463 +0,0 @@ -// JavaScript Document -var locjs = { - - data:{ }, - - type:0, //0 - просмотр разделов , 1 - просмотр разделов и конкретного предмета , 2 - просмотр своих вещей (сдача) , 3 - просмотр своих вещей (забрать) - - start:function() { - - //this.htmlTitle(); - //this.htmlMenu(); - //this.htmlContent(); - - this.selectPoint(0,false); - //this.error('Ошибка подключения к базе.'); - }, - - reflech:function() { - if( this.lookIt == 0 ) { - this.selectPoint( this.selectPointLast , false ); - }else{ - this.getBaseContent(); - } - }, - - refleshData:function( data ) { - if( data.money != undefined ) { - this.data.user.money = data.money; - this.data.user.massaNow = data.massaNow; - this.data.user.massaMax = data.massaMax; - // - this.data.user.timeGo = data.timeGo; - this.data.user.timeGoL = data.timeGoL; - this.data.user.timeNow = data.timeNow; - this.htmlMenu(); - } - locline.lineRefleshFinish(); - }, - - htmlMenu:function() { - var r = ''; - r += '
    '; - // - r += '
    ' + locline.line( this.data.user.timeGo, this.data.user.timeGoL , this.data.user.timeNow , 'locjs.reflech();' ) + - '' + locline.room( this.data.locations ) + '' - + '
    '; - // - r += ''; - r += 'Масса: ' + this.data.user.massaNow + '/' + this.data.user.massaMax + '
    '; - r += 'У вас в наличии: ' + this.data.user.money + ' кр.

    '; - r += '
    '; - - r += '
    '; - - if( this.data.user.level >= 4 ) { - r += ''; - r += ' '; - } - - r += '
    Отделы магазина
    '; - r += '
    '; - - //Показываем меню - for (var i = 0; i < this.data.menu.length; i++) { - r += '
    '; - if( this.data.menu[i][2] == 1 ) { - r += '     '; - } - r += '' + this.data.menu[i][0] + ''; - r += '
    '; - } - - r += '

    Внимание! Правила пользования комиссионным магазином:
    '; - r += '• С персонажа взымается налог в виде 1 кр. при передачи вещи в магазин.'; - r += '
    • Налог не возвращается, если вещь не будет продана в течении двух недель (Сама вещь продается в государственный магазин за 50% с учетом износа предмета).'; - r += '
    • Если вещь продается, владельцу перечисляются деньги на почту за вычетом комиссионных 10%. Налог в 1 кр. возвращается.'; - r += '
    • Администрация не несет ответственности за утрату вещей в случаи форс маожрных ситуаций.'; - //r += '
    • Если вы нашли баг или недочет, сообщите об этом здесь Баги в комиссионном магазине.'; - r += '


    '; - - return $('#comission_menu').html( r ) + locline.lineTimer() - //document.getElementById('comission_menu').innerHTML = r; - //return 'true'; - }, - - selectPointLast:0, - selectPoint:function( p , clearError ) { - if( clearError == true ) { - this.error(''); - } - this.baseconnect = true; - this.lookIt = 0; - this.type = 0; - $('#comission_pid' + this.selectPointLast + '').removeClass('comission_unhide'); - this.selectPointLast = p; - //Выбираем раздел предметов - //$('#comission_pick').removeClass('btnnew'); - //$('#comission_give').removeClass('btnnew'); - //$('#comission_pick').removeClass('btnnew2'); - //$('#comission_give').removeClass('btnnew2'); - if( p == 'give' ) { - //Сдаем вещи - this.data.base = this.getBaseContent(); - //$('#comission_pick').addClass('btnnew'); - //$('#comission_give').addClass('btnnew2'); - this.htmlTitle(); - this.htmlContent(); - }else if( p == 'pick' ) { - //Забираем - this.data.base = this.getBaseContent(); - //$('#comission_give').addClass('btnnew'); - //$('#comission_pick').addClass('btnnew2'); - this.htmlTitle(); - this.htmlContent(); - }else{ - // - this.data.base = this.getBaseContent(); - //$('#comission_give').addClass('btnnew'); - //$('#comission_pick').addClass('btnnew'); - // - this.htmlTitle(); - //this.htmlContent(); - //this.htmlMenu(); - // - $('#comission_pid' + this.selectPointLast + '').addClass('comission_unhide'); - $("body").animate({"scrollTop":0},0); - } - }, - - htmlTitle:function() { - var r = ''; - if( this.selectPointLast == 'give' ) { - r += 'Сдача вещей в комиссионный магазин'; - }else if( this.selectPointLast == 'pick' ) { - r += 'Забрать свои вещи из комиссионного магазина'; - }else{ - r += this.data.menu[this.selectPointLast][0]; - if( r == '' ) { - r += 'Отдел магазина закрыт'; - }else{ - r = r.charAt(0).toUpperCase() + r.substr(1); - r = 'Раздел: "' + r + '"'; - } - } - return $('#comission_title').html( r ); - }, - - baseconnect:false, - getBaseContent:function() { - //if( this.baseconnect == false ) { - locline.lineRefleshStart(); - $.getJSON('/core/comission/', { - 'point':this.selectPointLast, 'type':this.type, 'lookIt':this.lookIt - },function(data) { - locjs.refleshData( data ); - locjs.baseconnect = false; - locjs.data.base = data; - locjs.htmlContent(); - }); - //} - }, - - lookIt:0, - lookItems:function( p ) { - this.lookIt = p; - this.type = 1; - this.getBaseContent(); - }, - - buy_error:[ '','Предмет не найден, возможно его кто-то уже купил','У вас недостаточно денег','Хаосникам нельзя пользоваться комиссионным магазином','Персонажам ниже 1-го уровня запрещено пользоваться комиссионным магазином' ], - buy:function( cid , item_id ) { - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/comission/', { - 'buy_item':cid, 'items_id':item_id - },function(data) { - locjs.refleshData( data ); - locjs.baseconnect = false; - if( data.buy_item != undefined && (data.buy_error == undefined || data.buy_error == 0) ) { - $("body").animate({"scrollTop":0},0); - $('#itm_com_' + data.buy_item).remove(); - locjs.data.user.money -= parseFloat(data.buy_price).toFixed(2); - $('#u_money').html( locjs.data.user.money.toFixed(2) + ' кр.' ); - locjs.data.user.massaNow += parseFloat(data.buy_massa).toFixed(2); - $('#u_massa').html( locjs.data.user.massaNow + '/' + locjs.data.user.massaMax ); - locjs.error( 'Вы успешно купили предмет "' + data.buy_name + '" за ' + data.buy_price + ' кр.' ); - if( data.buy_last < 1 ) { - locjs.selectPoint( locjs.selectPointLast , false ); - } - }else if( locjs.buy_error[data.buy_error] != undefined ) { - $("body").animate({"scrollTop":0},0); - locjs.error( '' + locjs.buy_error[data.buy_error] ); - } - }); - } - }, - - newprice_error:[ - '','Предмет не найден в магазине','Цена не может быть ниже 1 кр.','Для данного предмета это слишком большая стоимость...','Для данного предмета это слишком маленькая стоимость, выгоднее отремонтировать предмет и сдать его в государственный магазин...' - ], - newprice:function( id , price ) { - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/comission/', { - 'newprice_item':id , 'newprice_price':price - },function(data) { - locjs.refleshData( data ); - locjs.baseconnect = false; - if( data.newprice_item != undefined && (data.newprice_error == undefined || data.newprice_error == 0) ) { - $("body").animate({"scrollTop":0},0); - locjs.data.user.money -= parseFloat(data.newprice_price_comission).toFixed(2); - $('#u_money').html( locjs.data.user.money.toFixed(2) + ' кр.' ); - locjs.error( 'Вы обновили цену "' + data.newprice_name + '" x' + data.newprice_x + ' шт. на ' + data.newprice_price + ' кр. за ' + data.newprice_price_comission + ' кр.' ); - }else if( locjs.newprice_error[data.newprice_error] != undefined ) { - $("body").animate({"scrollTop":0},0); - if( data.newprice_error_min != undefined && data.newprice_error_min != '' ) { - locjs.error( '' + locjs.newprice_error[data.newprice_error] + ' (Минимальная цена: ' + data.newprice_error_min + ' кр.)' ); - }else{ - locjs.error( '' + locjs.newprice_error[data.newprice_error] ); - } - } - }); - } - }, - - give_error:['','Предмет не найден в инвентаре','Недостаточно денег для уплаты комиссии','Хаосникам нельзя пользоваться комиссионным магазином','Персонажам ниже 4-го уровня запрещено выставлять вещи в комиссионном магазине', - 'Цена не может быть больше 1 000 000 кр.','Цена не может быть ниже 1 кр.','Для данного предмета это слишком большая стоимость...','Для данного предмета это слишком маленькая стоимость, выгоднее отремонтировать предмет и сдать его в государственный магазин...' - ,'Комиссионный магазин не принял ваши вещи' - ], - give:function( id , price ) { - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/comission/', { - 'give_item':id , 'give_price':price - },function(data) { - locjs.refleshData( data ); - locjs.baseconnect = false; - if( data.give_item != undefined && (data.give_error == undefined || data.give_error == 0) ) { - $("body").animate({"scrollTop":0},0); - $('#itm_usr_' + data.give_item).remove(); - locjs.data.user.money -= parseFloat(data.give_price_comission).toFixed(2); - $('#u_money').html( locjs.data.user.money.toFixed(2) + ' кр.' ); - locjs.data.user.massaNow -= parseFloat(data.give_massa).toFixed(2); - $('#u_massa').html( locjs.data.user.massaNow + '/' + locjs.data.user.massaMax ); - locjs.error( 'Вы сдали в магазин "' + data.give_name + '" x' + data.give_x + ' шт. на сумму ' + data.give_price + ' кр. за ' + data.give_price_comission + ' кр.' ); - if( data.give_last < 1 ) { - alert('Предметы в инвентаре закончились :)'); - } - }else if( locjs.give_error[data.give_error] != undefined ) { - $("body").animate({"scrollTop":0},0); - if( data.give_error_min != undefined && data.give_error_min != '' ) { - locjs.error( '' + locjs.give_error[data.give_error] + ' (Минимальная цена: ' + data.give_error_min + ' кр.)' ); - }else{ - locjs.error( '' + locjs.give_error[data.give_error] ); - } - } - }); - } - }, - pick_error:[ '', - 'Предмет не найден в магазине' - ], - pick:function( id ) { - if( this.baseconnect == false ) { - locline.lineRefleshStart(); - this.baseconnect = true; - $.getJSON('/core/comission/', { - 'pick_item':id - },function(data) { - locjs.refleshData( data ); - locjs.baseconnect = false; - if( data.pick_item != undefined && (data.pick_error == undefined || data.pick_error == 0) ) { - $("body").animate({"scrollTop":0},0); - $('#itm_usr_' + data.pick_uiid).remove(); - locjs.data.user.massaNow += parseFloat(data.pick_massa).toFixed(2); - $('#u_massa').html( locjs.data.user.massaNow + '/' + locjs.data.user.massaMax ); - locjs.error( 'Вы забрали из магазина "' + data.pick_name + '" x' + data.pick_x + ' шт.' ); - if( data.pick_last < 1 ) { - alert('Предметы в магазине закончились :)'); - } - }else if( locjs.pick_error[data.pick_error] != undefined ) { - $("body").animate({"scrollTop":0},0); - locjs.error( '' + locjs.pick_error[data.pick_error] ); - } - }); - } - }, - - - console_sale:function(name, txt, kr) { - var s = prompt("Сдать в магазин \""+txt+"\" (налог 1.00 кр.). Укажите цену:", kr); - if ((s != null) && (s != '') && (s >= 0)) { - locjs.give( name , s ); - } - }, - - console_change:function(name, txt, id, category, kr) { - var s = prompt("Сменить цену для предмета \""+txt+"\". Укажите новую цену:", kr); - if ((s != null) && (s != '') && (s>=1)) { - locjs.newprice( name , s ); - } - }, - - htmlContent:function() { - var r = ''; - - if( this.data.base != undefined ) { - // - //this.error( '
    type: ' + this.type + ' , option: ' + this.selectPointLast + '
    ' ); - // - if( this.selectPointLast == 'give' ) { - - var i = 0, color = 'c8c8c8', left = '', right = ''; - r += ''; - while( i < this.data.base.it.i ) { - left = ''; right = ''; if( color == 'c8c8c8' ) { color = 'd4d4d4'; }else{ color = 'c8c8c8'; } - left += '
    '; - if( this.data.base.it[i][22] > 0 ) { - //left += '(id' + this.data.base.it[i][22] + ')

    '; - } - // - if( this.data.base.it[i][6] != this.data.base.it[i][12] && this.data.base.it[i][12] > 1 ) { - this.data.base.it[i][6] = this.data.base.it[i][12]; - } - if( this.data.base.it[i][21] > 0 && this.data.base.it['g'][this.data.base.it[i]['iid']][this.data.base.it[i][21]] > 0 ) { - this.data.base.it[i][6] = this.data.base.it[i][6] * parseFloat(this.data.base.it['g'][this.data.base.it[i]['iid']][this.data.base.it[i][21]]).toFixed(2); - this.data.base.it[i][6] = this.data.base.it[i][6].toFixed(2); - } - // - left += 'Сдать в магазин'; - // - right += itmjs.infoItem( this.data.base.it , i , 'comission_give' ); - // - r += ''; - r += ''; - i++; - } - r += '
    ' + left + '' + right + '
    '; - - }else if( this.selectPointLast == 'pick' ) { - - var i = 0, color = 'c8c8c8', left = '', right = ''; - r += ''; - while( i < this.data.base.it.i ) { - left = ''; right = ''; if( color == 'c8c8c8' ) { color = 'd4d4d4'; }else{ color = 'c8c8c8'; } - left += '
    '; - if( this.data.base.it[i][22] > 0 ) { - //left += '(id' + this.data.base.it[i][22] + ')

    '; - } - // - left += 'Забрать предмет
    '; - left += 'Сменить цену за 0.10 кр.'; - left += '

    До ' + this.data.base.it[i]['timeend'] + '
    '; - // - right += itmjs.infoItem( this.data.base.it , i , 'comission_pick' ); - // - r += ''; - r += ''; - i++; - } - r += '
    ' + left + '' + right + '
    '; - - }else{ - - if( this.data.base.type == 1 ) { - - var i = 0, color = 'c8c8c8', left = '', right = ''; - r += ''; - while( i < this.data.base.it.i ) { - left = ''; right = ''; if( color == 'c8c8c8' ) { color = 'd4d4d4'; }else{ color = 'c8c8c8'; } - left += '
    '; - left += 'купить'; - // - right += itmjs.infoItem( this.data.base.it , i , 'comission' ); - // - r += ''; - r += ''; - i++; - } - r += '
    ' + left + '' + right + '
    '; - - }else if( this.data.base.type == 0 ) { - - var i = 0, color = 'c8c8c8', left = '', right = ''; - r += ''; - while( i < this.data.base.it.i ) { - left = ''; right = ''; if( color == 'c8c8c8' ) { color = 'd4d4d4'; }else{ color = 'c8c8c8'; } - left += '
    подробнее'; - // - right += '' + this.data.base.it[i][4] + ''; - right += '    (Масса: ' + this.data.base.it[i][6] + ')
    '; - right += 'Цена: ' + this.data.base.it[i][7][0] + ' - ' + this.data.base.it[i][7][1] + ' кр.'; - right += '   (Количество: ' + this.data.base.it[i][8] + ')
    '; - right += 'Долговечность: ' + this.data.base.it[i][2][0] + '-' + this.data.base.it[i][3][0] + ' / ' + this.data.base.it[i][2][1] + '-' + this.data.base.it[i][3][1] + ''; - right += '
    Требуется минимальное:
    • Уровень: ' + this.data.base.it[i][9] + ''; - // - r += ''; - r += ''; - i++; - } - r += '
    ' + left + '' + right + '
    '; - } - } - // - }else{ - r += '
    Загрузка списка вещей
    '; - } - - - - if( this.selectPointLast == 'give' ) { - if( this.data.user.level < 4 ) { - r += '
    Сдача вещей в комиссионный магазин разрешена с 4-го уровня
    '; - }else if( r == '' ) { - r += '
    У вас нет предметов которые можно сдать в комиссионный магазин
    '; - }else{ - - } - }else if( this.selectPointLast == 'pick' ) { - if( r == '' ) { - r += '
    У вас нет предметов сданных в комиссионный магазин
    '; - }else{ - - } - }else{ - if( this.data.base == undefined || this.data.base.it.i == 0 ) { - r = ''; - } - if( r == '' && this.baseconnect == false ) { - r += '
    Прилавок магазина пуст
    '; - }else{ - - } - } - if( r != '' ) { - $('#comission_content').html( r ); - } - }, - - error:function( text ) { - $('#error').html( text ); - if( text == '' ) { - $('#error').hide(); - }else{ - $('#error').show(); - } - } -}; \ No newline at end of file diff --git a/core1/static/scripts/location/debuger.js b/core1/static/scripts/location/debuger.js deleted file mode 100644 index 6c62a0f7..00000000 --- a/core1/static/scripts/location/debuger.js +++ /dev/null @@ -1,33 +0,0 @@ -var bug = { - - menu:[ - [1,'Приемы',0] - ], - - skills:{}, - - start:function() { - var html = ''; - // - var i = 0; - while( i != -1 ) { - if( this.menu[i] != undefined ) { - html += this.menuAdd( this.menu[i] ); - }else{ - i = -2; - } - i++; - } - // - $('#mainblock').html( html ); - }, - - menuAdd:function( m ) { - var r = ''; - // - r += 'test'; - // - return r; - } - -}; \ No newline at end of file diff --git a/core1/static/styles/location/auction.css b/core1/static/styles/location/auction.css deleted file mode 100644 index 01084096..00000000 --- a/core1/static/styles/location/auction.css +++ /dev/null @@ -1,132 +0,0 @@ -@charset "windows-1251"; -/* CSS Document */ - -.wrapper { - width: 100%; - min-width: 800px; - position: relative; -} - -.maroontext { - font-weight: bolder; - color: #8f0000; - font-size:12pt; -} - -.asel { - background-color:#e5e1e2; - padding:5px 10px 5px 10px; - color:#000; -} - -.cp { cursor:pointer; } - -.asel a { - color:#000; -} - -.unasel { - padding:5px 10px 5px 10px; -} - - -/* Middle ------------------------------------------------------------------------------*/ -.middle { - width: 100%; - position: relative; -} -.middle:after { - display: table; - clear: both; - content: ''; -} -.container { - width: 100%; - float: left; - overflow: hidden; -} -.content { - padding: 0 170px 0 0; - display:block; -} -.borderandpadding5px { - padding:5px; - /*border:solid 1px #a5a5a5;*/ -} -.borderitem { - border-right:solid 1px #a5a5a5; -} -.borderandpadding0px { - padding:0px; - border:solid 1px #a5a5a5; -} -.px3px { - padding:3px; -} -.brd1top { - border-top:solid 1px #a5a5a5; -} - - -/* Right Sidebar ------------------------------------------------------------------------------*/ -.right-sidebar { - float: left; - width: 150px; - margin-left: -150px; - position: relative; -} - -/* All Styles ------------------------------------------------------------------------------*/ - -#error { - color:red; - padding:5px; - display:none; -} - -#auction_title { - background-color:#d2d2d2; - text-align:center; - padding:5px 5px 0 5px; - display:block; -} - -#auction_content { - /*background-color:#c8c8c8;*/ - display:block; -} - -.auction_menu_point { - padding:1px 10px 1px 0; - border-bottom:1px solid #E2E0E0; -} - -.auction_menu_point:hover { - cursor:pointer; - background-color:#c7c7c7; -} - -.auction_unhide { - background-color:#c7c7c7; -} - - - - - - - - - - - - - - - - - - diff --git a/core1/static/styles/location/auction_ie_fix.css b/core1/static/styles/location/auction_ie_fix.css deleted file mode 100644 index 22d8635f..00000000 --- a/core1/static/styles/location/auction_ie_fix.css +++ /dev/null @@ -1,18 +0,0 @@ -#comission_title { - margin-right:280px; -} - -#comission_content { - margin-right:280px; -} - - - - - - - - - - - diff --git a/core1/static/styles/location/comission.css b/core1/static/styles/location/comission.css deleted file mode 100644 index 9f3a1c8a..00000000 --- a/core1/static/styles/location/comission.css +++ /dev/null @@ -1,114 +0,0 @@ -@charset "windows-1251"; -/* CSS Document */ - -.wrapper { - width: 100%; - min-width: 800px; - position: relative; -} - - -/* Middle ------------------------------------------------------------------------------*/ -.middle { - width: 100%; - position: relative; -} -.middle:after { - display: table; - clear: both; - content: ''; -} -.container { - width: 100%; - float: left; - overflow: hidden; -} -.content { - padding: 0 290px 0 0; - display:block; -} -.borderandpadding5px { - padding:5px; - /*border:solid 1px #a5a5a5;*/ -} -.borderitem { - border-right:solid 1px #a5a5a5; -} -.borderandpadding0px { - padding:0px; - border:solid 1px #a5a5a5; -} -.px3px { - padding:3px; -} -.brd1top { - border-top:solid 1px #a5a5a5; -} - - -/* Right Sidebar ------------------------------------------------------------------------------*/ -.right-sidebar { - float: left; - width: 270px; - margin-left: -270px; - position: relative; -} - -/* All Styles ------------------------------------------------------------------------------*/ - -#error { - color:red; - padding:5px; - display:none; -} - -#comission_title { - background-color:#a5a5a5; - font-weight:bold; - text-align:center; - padding:5px; - display:block; -} - -#comission_content { - background-color:#c8c8c8; - display:block; -} - -.comission_menu_point { - padding:1px 10px 1px 0; - border-bottom:1px solid #E2E0E0; -} - -.comission_menu_point:hover { - cursor:pointer; - background-color:#c7c7c7; -} - -.comission_unhide { - background-color:#c7c7c7; -} - - - - - - - - - - - - - - - - - - - - - diff --git a/cron/auction.php b/cron/auction.php index 6ae0e1fc..84e9f854 100644 --- a/cron/auction.php +++ b/cron/auction.php @@ -1,51 +1,53 @@ + */ -/* +use Insallah\Db; - CRON Комиссионного магазина - Действия: - 1. Если предмет висит уже 2 и более недель, продавать предмет за 50% от его стоимости с учетом износа - деньги отсылаются на почту. +const GAME = true; +const TIME_LAST = 86400; // 1 day +const AUC = 'Филиал Аукциона'; +const AUC_WIN = 'Вы выиграли торги. Предмет "%s" за %s кр. был добавлен к вам в инвентарь.'; +const AUC_SELL = 'Предмет "%s" был продан на торгах, %s кр. за товар отправлены вам по почте.'; +const AUC_SELL_LOG = 'Филиал Аукциона: Предмет "%s" был продан за %s кр.'; +const AUC_NOT_SELL = 'Предмет "%s" не был продан, он возвращен вам в инвентарь.'; +require_once '_incl_data/class/Insallah/Core/Db.php'; -*/ +$query = [ //all queries + 'insert into chat (new, login, `to`, text, time, type) values (1, ?, ?, ?, unix_timestamp(), 6)', + 'select * from items_auc where time_end = 0 and time < unix_timestamp() - ? order by user_buy', + 'select login from users where id = ?', + 'select count(*) from users where id = ?', + 'update items_users set uid = ?, lastUPD = unix_timestamp() where (id = ? or inGroup = ?) and uid = 0', + 'insert into items_users (`delete`, item_id, 1price, uid, lastUPD, `data`) values (0, 1220, ?, ?, unix_timestamp(), ?)', + 'insert into post (uid, sender_id, time, money, text) values (?, 0, unix_timestamp(), ?, ?)', + 'update items_auc set time_end = unix_timestamp() where id = ?', +]; -$time_last = 86400; //1 день - -$sp = mysql_query('SELECT * FROM `items_auc` WHERE `time_end` = 0 AND `time` < "'.(time()-$time_last).'" ORDER BY `user_buy` ASC'); -while( $pl = mysql_fetch_array($sp) ) { - // - if( $pl['x'] > 0 ) { - $pl['name'] .= ' (x'.$pl['x'].')'; - } - // - $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1')); - if( $pl['user_buy'] > 0 ) { - //Предмет купили - $buyer = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['user_buy'].'" LIMIT 1')); - if(isset($buyer['id'])) { - mysql_query('UPDATE `items_users` SET `uid` = "'.$buyer['id'].'",`lastUPD` = "'.time().'" WHERE (`id` = "'.$pl['item_id'].'" OR `inGroup` = "'.$pl['item_id'].'") AND `uid` = 0'); - $u->send('','','','Филиал Аукциона',$buyer['login'],'Вы выиграли торги. Предмет "'.$pl['name'].'" за '.$pl['price'].' кр. был добавлен к вам в инвентарь.',time(),6,0,0,0,1,0); - } - if(isset($user['id'])) { - $u->send('','','','Филиал Аукциона',$user['login'],'Предмет "'.$pl['name'].'" был продан на торгах, '.$pl['price'].' кр. за товар отправлены вам по почте.',time(),6,0,0,0,1,0); - // - mysql_query('INSERT INTO `items_users` (`delete`,`item_id`,`1price`,`uid`,`lastUPD`) VALUES ("0","1220","'.$pl['price'].'","-51'.$user['id'].'","'.time().'")'); - mysql_query('INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES ( - "'.$user['id'].'","0","'.time().'","'.$pl['price'].'","Филиал Аукциона: Предмет "'.$pl['name'].'" был продан за '.$pl['price'].' кр." - )'); - } - }else{ - //Предмет не купили, возвращаем его обратно - if(isset($user['id'])) { - mysql_query('UPDATE `items_users` SET `uid` = "'.$user['id'].'",`lastUPD` = "'.time().'" WHERE (`id` = "'.$pl['item_id'].'" OR `inGroup` = "'.$pl['item_id'].'") AND `uid` = 0'); - $u->send('','','','Филиал Аукциона',$user['login'],'Предмет "'.$pl['name'].'" не был продан, он возвращен вам в инвентарь.',time(),6,0,0,0,1,0); - } - } - mysql_query('UPDATE `items_auc` SET `time_end` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); +$sp = Db::getRow($query[1], [TIME_LAST]); +foreach ($sp as $pl) { + if ($pl['x'] > 0) { + $pl['name'] .= ' (x' . $pl['x'] . ')'; + } + $userLogin = Db::getValue($query[2], [$pl['uid']]); + if ($pl['user_buy'] && Db::getValue($query[3], [$pl['user_buy']])) { + Db::sql($query[4], [$pl['user_buy'], $pl['item_id'], $pl['item_id']]); + Db::sql($query[0], [AUC, $pl['user_buy'], sprintf(AUC_WIN, $pl['name'], $pl['price'])]); + if ($userLogin) { + Db::sql($query[0], [AUC, $userLogin, sprintf(AUC_SELL, $pl['name'], $pl['price'])]); + Db::sql($query[5], [$pl['price'], '-51' . $pl['uid'], '']); + Db::sql($query[6], [$pl['uid'], $pl['price'], sprintf(AUC_SELL_LOG, $pl['name'], $pl['price'])]); + } + } elseif ($userLogin) { + Db::sql($query[4], [$pl['uid'], $pl['item_id'], $pl['item_id']]); + Db::sql($query[0], [AUC, $userLogin, sprintf(AUC_NOT_SELL, $pl['name'])]); + } + Db::sql($query[7], [$pl['id']]); } -?> \ No newline at end of file diff --git a/cron/battle_dell.php b/cron/battle_dell.php index 1c9147f3..f9ef95a6 100644 --- a/cron/battle_dell.php +++ b/cron/battle_dell.php @@ -1,62 +1,32 @@ "; - if (isset($tbtl['id'])) - { - sleep (2); - } - else - { - mysql_query('UPDATE `users` SET `battle` = 0 WHERE `battle` > 0'); - mysql_query('LOCK TABLES `battle_act` WRITE,`battle_end` WRITE,`battle_last` WRITE,`battle_out` WRITE,`battle_stat` WRITE,`battle_users` WRITE,`battle` WRITE,`battle_logs` WRITE,`battle_logs_save` WRITE,`zayvki` WRITE'); - - mysql_query('TRUNCATE TABLE `battle_act`'); - //mysql_query('OPTIMIZE TABLE `battle_act`'); - - mysql_query('TRUNCATE TABLE `battle_end`'); - //mysql_query('OPTIMIZE TABLE `battle_end`'); - - mysql_query('TRUNCATE TABLE `battle_last`'); - //mysql_query('OPTIMIZE TABLE `battle_last`'); - - mysql_query('TRUNCATE TABLE `battle_out`'); - //mysql_query('OPTIMIZE TABLE `battle_out`'); - - mysql_query('TRUNCATE TABLE `battle_stat`'); - //mysql_query('OPTIMIZE TABLE `battle_stat`'); - - mysql_query('TRUNCATE TABLE `battle_users`'); - //mysql_query('OPTIMIZE TABLE `battle_users`'); - - mysql_query('TRUNCATE TABLE `battle`'); - //mysql_query('OPTIMIZE TABLE `battle`'); +$test = 0; +while ($test == 0) { - - mysql_query('TRUNCATE TABLE `battle_logs`'); - //mysql_query('OPTIMIZE TABLE `battle_logs`'); - - mysql_query('TRUNCATE TABLE `battle_logs_save`'); - //mysql_query('OPTIMIZE TABLE `battle_logs_save`'); - - mysql_query('TRUNCATE TABLE `zayvki`'); - //mysql_query('OPTIMIZE TABLE `zayvki`'); - - mysql_query('UNLOCK TABLES'); - - $test=1; - } + $tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win`=-1 ORDER BY `id` LIMIT 1')); + echo "Ѓой: "; + echo $tbtl['id'] . "
    "; + if (isset($tbtl['id'])) { + sleep(2); + } else { + mysql_query('UPDATE `users` SET `battle` = 0 WHERE `battle` > 0'); + mysql_query( + 'LOCK TABLES `battle_act` WRITE,`battle_end` WRITE,`battle_last` WRITE,`battle_out` WRITE,`battle_stat` WRITE,`battle_users` WRITE,`battle` WRITE,`battle_logs` WRITE,`battle_logs_save` WRITE,`zayvki` WRITE' + ); + mysql_query('TRUNCATE TABLE `battle_act`'); + mysql_query('TRUNCATE TABLE `battle_end`'); + mysql_query('TRUNCATE TABLE `battle_last`'); + mysql_query('TRUNCATE TABLE `battle_out`'); + mysql_query('TRUNCATE TABLE `battle_stat`'); + mysql_query('TRUNCATE TABLE `battle_users`'); + mysql_query('TRUNCATE TABLE `battle`'); + mysql_query('TRUNCATE TABLE `battle_logs`'); + mysql_query('TRUNCATE TABLE `battle_logs_save`'); + mysql_query('TRUNCATE TABLE `zayvki`'); + mysql_query('UNLOCK TABLES'); - } - -?> + $test = 1; + } +} diff --git a/cron/battle_finish.php b/cron/battle_finish.php index 7f1a5f89..cca13afd 100644 --- a/cron/battle_finish.php +++ b/cron/battle_finish.php @@ -1,10 +1,7 @@ = 8 && $test['count'] < 12) + elseif ($test['count'] < 12) { mysql_query('UPDATE `battle` SET `timeout` = "120" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - elseif ($test['count'] >= 12) - { - mysql_query('UPDATE `battle` SET `timeout` = "180" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); + } else { + mysql_query('UPDATE `battle` SET `timeout` = "180" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); } @@ -47,7 +42,6 @@ while( $pl = mysql_fetch_array($sp) ) { // batle cache mysql_query('DELETE FROM `battle_cache` WHERE `time` < "'.(time()-3600).'"'); -//mysql_query('OPTIMIZE TABLE `battle_cache`'); //вытаскиваем персов из приз хаота если застрЯли (1-5 минут окончание) $sp = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 33 AND `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0 ORDER BY `battle`.`time_over` DESC LIMIT 1')); @@ -83,5 +77,4 @@ while( $pl = mysql_fetch_array($sps)) } //чистим памЯть unset($sp,$sps,$pl,$test); - -?> + diff --git a/cron/battle_optimize.php b/cron/battle_optimize.php index b2eaf1ba..c86f4019 100644 --- a/cron/battle_optimize.php +++ b/cron/battle_optimize.php @@ -1,45 +1,21 @@ +$tables = ['battle_end', 'battle_last', 'battle_out', 'battle_stat', 'battle_logs', 'battle_logs_save']; +$q = [ + 'delete from battle_users where time_enter < unix_timestamp() - ? and time_enter != 0', + 'delete from battle where time_over < unix_timestamp() - ? and time_over != 0', +]; +foreach ($tables as $table) { + $pdo->prepare("delete from $table where time < unix_timestamp() - ?")->execute(DAY); +} +$pdo->prepare($q[0])->execute(DAY); +$pdo->prepare($q[1])->execute(DAY); diff --git a/cron/battle_save.php b/cron/battle_save.php index 39fbd8c4..681c6d42 100644 --- a/cron/battle_save.php +++ b/cron/battle_save.php @@ -1,9 +1,6 @@ 0'); -?> diff --git a/cron/clear.php b/cron/clear.php index 482e230f..759aed38 100644 --- a/cron/clear.php +++ b/cron/clear.php @@ -1,9 +1,6 @@ Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="%s"/ Название : "%s"/ Цена : "%s"/ Груперованно : "$s"].'; +const RETURN_ONE = '"Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="%s"/ Название : "%s"/ Цена : "%s"].'; +const SHOP_TYPE = 'Shop.comission'; +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('/home/newcom1/public_html/_incl_data/__config.php'); include('/home/newcom1/public_html/_incl_data/class/__db_connect.php'); -include('/home/newcom1/public_html/_incl_data/class/__user.php'); +$u = User::start(); -/* - - CRON Комиссионного магазина - Действия: - 1. Если предмет висит уже 2 и более недель, продавать предмет за 50% от его стоимости с учетом износа - деньги отсылаются на почту. -*/ - - -$time_last = 86400 * 6; //2 недели - -$sp = mysql_query('SELECT * FROM `items_users` WHERE `inShop` = 30'); -while( $pl = mysql_fetch_array($sp) ) -{ - - $i = mysql_fetch_array(mysql_query('SELECT `im`.`price1`,`im`.`name`,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "'.$pl['id'].'" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1')); - - if( isset($i['inGroup']) AND $i['inGroup'] > 0 ) - { - $col = $u->itemsX($i['id']); - if($col > 1) - { - mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `item_id`="'.$i['item_id'].'" AND `inShop` = "30" AND `uid`="'.$i['uid'].'" AND `inGroup` = "'.$i['inGroup'].'" LIMIT '.$col.''); - $ld = $u->addDelo(1,$i['uid'],'"Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="'.$i['item_id'].'"/ Название : "'.$i['name'].'"/ Цена : "'.$i['price1'].'"/ Груперованно : "'.$i['inGroup'].'+1"].',time(),$u->info['city'],'Shop.comission',0,0); - } - else - { - mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `uid` = "'.$pl['uid'].'" AND `id` = "'.$pl['id'].'" AND `inOdet` = "0" AND `delete` = "0" '); - $ld = $u->addDelo(1,$i['uid'],'"Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="'.$i['item_id'].'"/ Название : "'.$i['name'].'"/ Цена : "'.$i['price1'].'"].',time(),$u->info['city'],'Shop.comission',0,0); - } - } - else - { - mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `id` = "'.$pl['id'].'" and `inShop` = "30" LIMIT 1'); - $ld = $u->addDelo(1,$i['uid'],'"Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="'.$i['item_id'].'"/ Название : "'.$i['name'].'"/ Цена : "'.$i['price1'].'"].',time(),$u->info['city'],'Shop.comission',0,0); - } +$q = 'select items_main.id, uid, inGroup, item_id, price1, name from items_users left join items_main on items_main.id = item_id where inShop = 30 and `delete` = 0'; +foreach ($pdo->query($q) as $row) { + if ($row['inGroup']) { + $col = $u->itemsX($row['id']); + if ($col > 1) { + $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where item_id = ? and inShop = 30 and uid = ? and inGroup = ? limit ' . $col); + if ($stmt->execute([$row['price1'], $row['item_id'], $row['uid'], $row['inGroup']])) { + $ld = $u->addDelo(1, $row['uid'], + sprintf(RETURN_GROUP, $row['item_id'], $row['name'], $row['price1'], $row['inGroup'] . '+1'), + time(), $u->info['city'], SHOP_TYPE, 0, 0); + } + } else { + $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where uid = ? and id = ? and inOdet = 0 and `delete` = 0 and inShop = 30'); + if ($stmt->execute([$row['price1'], $row['uid'], $row['id']])) { + $ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']), + time(), $u->info['city'], SHOP_TYPE, 0, 0); + } + } + } else { + $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30'); + if ($stmt->execute([$row['price1'], $row['id']])) { + $ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']), + time(), $u->info['city'], SHOP_TYPE, 0, 0); + } + } } - -?> \ No newline at end of file diff --git a/cron/comission.php.bac b/cron/comission.php.bac deleted file mode 100644 index 22a83f33..00000000 --- a/cron/comission.php.bac +++ /dev/null @@ -1,70 +0,0 @@ -0){ - $prc1 = $itm_user['iznosNOW']/$plmx*100; - }else{ - $prc1 = 0; - } - $shpCena = $u->shopSaleM( $shpCena , $itm_user ); - $shpCena = $shpCena/100*(100-$prc1); - if( $itm_user['iznosMAXi'] < 999999999 ) { - if($itm_user['iznosMAX']>0 && $itm_main['iznosMAXi']>0 && $itm_main['iznosMAXi']>$itm_user['iznosMAX']){ - $shpCena = $shpCena/100*($itm_user['iznosMAX']/$itm_main['iznosMAXi']*100); - } - } - $shpCena = $shpCena/2 * $pl['group']; - $shpCena = $u->round2($shpCena/100*(100-$shopProcent)); - if($shpCena<0){ - $shpCena = 0; - } - // - $itm_user['1price'] = $shpCena; - // - if( $itm_user['1price'] < 0.01 ) { - $itm_user['1price'] = 0.01; - } - // - mysql_query('UPDATE `items_com` SET `delete` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `items_users` (`delete`,`item_id`,`1price`,`uid`,`lastUPD`) VALUES ("0","1220","'.$itm_user['1price'].'","-51'.$user['id'].'","'.time().'")'); - mysql_query('INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES ( - "'.$user['id'].'","0","'.time().'","'.$itm_user['1price'].'","Комиссионный магазин: Предмет "'.$itm_main['name'].''.$grp.'" (Износ: '.ceil($itm_user['iznosNOW']).'/'.ceil($itm_user['iznosMAX']).') был продан за '.$itm_user['1price'].' кр." - )'); - // - $grp = ''; - if( $pl['group'] > 1 ) { - $grp = ' (x'.$pl['group'].')'; - } - $u->send('','','','Комиссионный магазин',$user['login'],'Предмет "'.$itm_main['name'].''.$grp.'" (Износ: '.ceil($itm_user['iznosNOW']).'/'.ceil($itm_user['iznosMAX']).') был продан в государственный магазин за '.$itm_user['1price'].' кр.. Деньги доставлены к вам на почту.',time(),6,0,0,0,1,0); -} - -?> \ No newline at end of file diff --git a/cron/cron_clear.php b/cron/cron_clear.php index 942c23ce..efe1505c 100644 --- a/cron/cron_clear.php +++ b/cron/cron_clear.php @@ -3,7 +3,6 @@ define('GAME',true); setlocale(LC_CTYPE ,"ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); if( isset($_GET['actions']) ) { // @@ -141,7 +140,7 @@ while( $pl = mysql_fetch_array($sp) ) { //5. Очистка монстров $i = 0; -$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` ASC LIMIT 100000'); +$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` LIMIT 100000'); while( $pl = mysql_fetch_array($sp) ) { $btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1')); $clon = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$pl['id'].'" LIMIT 1')); @@ -159,9 +158,3 @@ mysql_query('DELETE FROM `items_users` WHERE `delete` > `time_create` AND `delet //6. Очистка личного дела mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*30).'" LIMIT 10000'); - -//echo '
    Очищено ботов\монстров: '.$i.'/'.$x.'
    '; -/*if( $i > 0 ) { - die(''); -}*/ -?> \ No newline at end of file diff --git a/cron/rupor.php b/cron/rupor.php index 4e61ed74..b8a5410a 100644 --- a/cron/rupor.php +++ b/cron/rupor.php @@ -1,39 +1,24 @@ \ No newline at end of file +shuffle($rupor); +$q = 'insert into chat (new, text, time, type, da, color) values (1, ?, unix_timestamp(), 6, 1, ?)'; +$pdo->prepare($q)->execute(['Администрация: ' . $rupor[0], '#F00']); diff --git a/cron/stats_correct.php b/cron/stats_correct.php index 80606708..59f80cfa 100644 --- a/cron/stats_correct.php +++ b/cron/stats_correct.php @@ -1,27 +1,31 @@ 1999 ORDER BY `add_stats` DESC'); -//$sp = mysql_query('SELECT * FROM `rep` WHERE `id` =3'); - while($pl = mysql_fetch_array($sp)) - { - - echo 'id:'.$pl['id'].'
    '; - // mysql_query('UPDATE `stats` SET `priemslot` = `priemslot` - '.$pl['add_slot'].', `priems` ="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|" WHERE `id` ="'.$pl['id'].'"'); - mysql_query('UPDATE `rep` SET `nu_capitalcity`=0, `nu_demonscity`=0,`nu_angelscity`=0,`nu_suncity`=0,`nu_dreamscity`=0,`nu_abandonedplain`=0,`nu_sandcity`=0,`nu_emeraldscity`=0, `add_stats`=0,`add_skills`=0,`add_slot`=0 WHERE `id` ="'.$pl['id'].'"'); - - } +$q = [ + 'select id from rep where repemeraldscity > 1999 order by add_stats desc', + 'update rep set + nu_capitalcity = 0, + nu_demonscity = 0, + nu_angelscity = 0, + nu_suncity = 0, + nu_dreamscity = 0, + nu_abandonedplain = 0, + nu_sandcity = 0, + nu_emeraldscity = 0, + add_stats = 0, + add_skills = 0, + add_slot = 0 + where id = ?', +]; -// SELECT * FROM `rep` WHERE `repemeraldscity` > 1999 ORDER BY `add_stats` DESC -// rep (`add_stats`,`add_skills`,`add_slot`) `add_stats`,`add_skills`,`add_slot` ===== 0 -// stats (`ability`,`skills`,`priemslot`) ability=0 skills?? priemslot- -// (`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`) - - - - -?> \ No newline at end of file +$correct = $pdo->prepare($q[1]); +foreach ($pdo->query($q[0]) as $row) { + echo 'id: ' . $row['id'] . '
    '; + $correct->execute($row['id']); +} diff --git a/cron/tom_check.php b/cron/tom_check.php index 9f085b90..befdaa7e 100644 --- a/cron/tom_check.php +++ b/cron/tom_check.php @@ -1,52 +1,30 @@ 10'); while( $pl = mysql_fetch_array($sp) ) { $test = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "'.$pl['id'].'" LIMIT 1')); $userst = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1')); - if($test['add_slot']>0) - { - - // echo "ник:".$userst['login']." количество слотов:".$pl['priemslot']." количество добавленных с подземки слотов:".$test['add_slot']."
    "; - - } - $kolvo = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `actions` WHERE `uid` ="'.$pl['id'].'" AND `vars` ="read"')); - + $kolvo = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `actions` WHERE `uid` ="'.$pl['id'].'" AND `vars` ="read"')); $overtop=$pl['priemslot']-10-$test['add_slot']-($kolvo['COUNT(*)']+1); - $overtopkorrect=$pl['priemslot']-10-$test['add_slot']; - - if($overtop>8) - { - $prevish = $overtop -8; - } else {$prevish =0;} - - if ($overtopkorrect>8){$overtopkorrect=8;} - + $prevish = $overtop > 8 ? $overtop - 8 : 0; + if ($overtopkorrect>8){$overtopkorrect=8;} $resultslot= 10 + $test['add_slot'] + $overtopkorrect; if($overtop>0) - { - + { + echo "начало!!! ник:".$userst['login']." количество слотов:".$pl['priemslot']." должно быть:".$resultslot." количество добавленных с подземки слотов:".$test['add_slot']." количество прочитаных книг:".$kolvo['COUNT(*)']." результат:".$overtop." превышение:".$prevish." нужно прочитать:".$overtopkorrect."
    "; - + mysql_query('UPDATE `stats` SET `priemslot` = "'.$resultslot.'" WHERE `id` = "'.$pl['id'].'"'); - // mysql_query('UPDATE `stats` SET `priemslot` = "'.$resultslot.'" WHERE `id` = "'.$pl['id'].'"'); mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND `vars` = "read" '); - + if($overtopkorrect==5){$overtopkorrect=6;} - - if ($overtopkorrect==1) + + if ($overtopkorrect==1) { mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")'); } @@ -74,43 +52,39 @@ while( $pl = mysql_fetch_array($sp) ) { mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")'); - - - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")'); + + + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")'); } elseif ($overtopkorrect==7) { - + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")'); - - + + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4812")'); - + } elseif ($overtopkorrect==8) { - + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")'); - - + + mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4812")'); mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4813")'); } - - - + + + echo "результат!!! ник:".$userst['login']." количество слотов:".$resultslot." количество добавленных с подземки слотов:".$test['add_slot']." количество прочитаных книг:".$overtopkorrect."
    "; } } - - - -?> \ No newline at end of file diff --git a/cron_GoBattle.php b/cron_GoBattle.php index fcdabaef..7cc86a2b 100644 --- a/cron_GoBattle.php +++ b/cron_GoBattle.php @@ -1,61 +1,67 @@ '.$_SERVER['SERVER_ADDR']); +if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock( + ) != '31.131.97.206') { + die(getIPblock() . '
    ' . $_SERVER['SERVER_ADDR']); } -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); +$u = User::start(); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +$sp = mysql_query( + 'SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"' +); +while ($pl = mysql_fetch_array($sp)) { + if ($pl['inUser'] > 0 && $pl['inTurnir'] > 0) { + $txt = 'Внимание!Все подземелья закрыты, начинается мясорубка!'; + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $txt . "','" . time( + ) . "','6','0','1')" + ); + } + if ($pl['dnow'] > 0) { + //сохраняем координаты и пещеру в которой был до мясорубки + mysql_query( + 'INSERT INTO `save_dungeon` (`x`,`y`,`dnow`,`time`,`uid`) VALUES ("' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['dnow'] . '","' . time( + ) . '","' . $pl['id'] . '")' + ); + // + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $pl['id'] . '"'); + mysql_query('UPDATE `users` SET `room` = "9",`battle` = "0" WHERE `id` = "' . $pl['id'] . '"'); + //удаляем эффекты и поединки + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" AND `v1` = "priem" AND `delete` = "0"'); + mysql_query('DELETE FROM `battle` WHERE `id` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_act` WHERE `battle` = "' . $pl['battle'] . '"'); + mysql_query( + 'DELETE FROM `battle_actions` WHERE `btl` = "' . $pl['battle'] . '" AND `uid` = "' . $pl['id'] . '"' + ); + mysql_query('DELETE FROM `battle_end` WHERE `battle_id` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_last` WHERE `battle_id` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_out` WHERE `battle` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_stat` WHERE `battle` = "' . $pl['battle'] . '"'); + mysql_query('DELETE FROM `battle_users` WHERE `battle` = "' . $pl['battle'] . '"'); + } else { + $txt = 'Внимание! Все подземелья закрыты с 22:00 до 00:00! Получаемый опыт на Центральной площади +100%, в Хаотичных поединках, победителей ждет хорошая награда!'; + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $pl['city'] . "','','','','" . $txt . "','" . time( + ) . "','6','0','1')" + ); + } } - -$sp = mysql_query('SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"'); - while($pl = mysql_fetch_array($sp)) { - if($pl['inUser'] > 0 && $pl['inTurnir'] > 0 ) { - $txt = 'Внимание!Все подземелья закрыты, начинается мясорубка!'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$txt."','".time()."','6','0','1')"); - } - if($pl['dnow'] > 0 ) { - //сохраняем координаты и пещеру в которой был до мясорубки - mysql_query('INSERT INTO `save_dungeon` (`x`,`y`,`dnow`,`time`,`uid`) VALUES ("'.$pl['x'].'","'.$pl['y'].'","'.$pl['dnow'].'","'.time().'","'.$pl['id'].'")'); - // - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "'.$pl['id'].'"'); - mysql_query('UPDATE `users` SET `room` = "9",`battle` = "0" WHERE `id` = "'.$pl['id'].'"'); - //удаляем эффекты и поединки - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'" AND `v1` = "priem" AND `delete` = "0"'); - mysql_query('DELETE FROM `battle` WHERE `id` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_act` WHERE `battle` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_actions` WHERE `btl` = "'.$pl['battle'].'" AND `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `battle_end` WHERE `battle_id` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_last` WHERE `battle_id` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_out` WHERE `battle` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_stat` WHERE `battle` = "'.$pl['battle'].'"'); - mysql_query('DELETE FROM `battle_users` WHERE `battle` = "'.$pl['battle'].'"'); - }else{ - $txt = 'Внимание! Все подземелья закрыты с 22:00 до 00:00! Получаемый опыт на Центральной площади +100%, в Хаотичных поединках, победителей ждет хорошая награда!'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$pl['city']."','','','','".$txt."','".time()."','6','0','1')"); - } -} -?> \ No newline at end of file diff --git a/cron_autozv.php b/cron_autozv.php deleted file mode 100644 index 5a41bfcc..00000000 --- a/cron_autozv.php +++ /dev/null @@ -1,40 +0,0 @@ -'.$_SERVER['SERVER_ADDR']); - } -} - -define('GAME',true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); -include('_incl_data/__config.php'); -include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__magic.php'); - -//Подаем турнир для 2-3 уровней -$inc = mysql_query('INSERT INTO `zayvki` ( - `comment`,`noatack`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`noinc`,`razdel`,`time`,`fastfight`,`maxplayers` -) VALUES - -( "Автозаявка! (Без ЕКР)","1","capitalcity","0","51","300","120","8","8","8","8","1","5","'.time().'","0","30" ), -( "Автозаявка! (Без ЕКР)","1","capitalcity","0","51","300","120","8","8","21","21","1","5","'.time().'","0","30" ) - - -'); - -if($inc) { - echo 'true'; -}else{ - echo 'false'; -} -?> \ No newline at end of file diff --git a/cron_bot_core.php b/cron_bot_core.php index fd499856..534bb1b8 100644 --- a/cron_bot_core.php +++ b/cron_bot_core.php @@ -1,160 +1,139 @@

    Так не пойдет;)

    '); } -/* -if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '31.131.97.206' && !isset($_GET['robot'])) { - die(getIP().'
    '.$_SERVER['SERVER_ADDR']); -} -*/ + error_reporting(0); ini_set('display_errors', 'Off'); -define('GAME',true); +const GAME = true; -setlocale(LC_CTYPE ,"ru_RU.CP1251"); +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/bot.priem.php'); -include('_incl_data/class/bot.logic.php'); - - -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","Арбидол","6","1","-1")'); -} - -function inuser_go_btl($id) { - if(isset($id['id'])) { - echo '[go]'; - echo file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass']); - } -} - -/*$sp = mysql_query('SELECT `id` FROM `users` WHERE `host_reg` = "real_bot_user" AND `login` != "delete" AND `banned` = "0" ORDER BY `online` DESC LIMIT 300'); -while($pl = mysql_fetch_array($sp)) { - botLogic::start( $pl['id'] ); -}*/ -//$sp = mysql_query('SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE ( /*( `s`.`bot` > 0 AND `u`.`battle` > 0 ) OR*/ `u`.`pass` = "saintlucia" ) ORDER BY `s`.`nextAct` ASC LIMIT 20'); -$ii=0; -while ($ii<6) +function inuser_go_btl($id) { -$count = array( - 0, - 0, - 0, - 0, - 0, - 0 -); -$sp = mysql_query('SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "saintlucia" OR `u`.`no_ip` = "trupojor" ORDER BY `s`.`nextAct` ASC LIMIT 100'); -$btltest = array(); $btl_ref = array(); -while($pl = mysql_fetch_array($sp)) { - $i++; - if( $pl['zv'] > 0 ) { - $zv = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`razdel` FROM `zayvki` WHERE `id` = "'.$pl['zv'].'" AND `btl_id` = 0 LIMIT 1')); - if(!isset($zv['id']) || $zv['razdel'] != 5 ) { - $pl['zv'] = 0; - mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - } - if( $pl['battle'] == -1 ) { - mysql_query('UPDATE `users` SET `battle` = 0,`ipreg` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - $pl['battle'] = 0; - $pl['ipreg'] = 0; - } - if( date('i') == 5 || date('i') == 6 || date('i') == 15 || date('i') == 16 || date('i') == 25 || date('i') == 26 || date('i') == 35 || date('i') == 36 || date('i') == 45 ) { - if( $pl['zv'] == 0 ) { - mysql_query('UPDATE `users` SET `ipreg` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - } - - if( (!isset($btltest2[$pl['battle']]) || $btltest2[$pl['battle']] == 0) && $pl['battle'] > 0) { - $btltest2[$pl['battle']]++; - echo '|'.$pl['battle'].'|'.$pl['id'].'|inBATTLE | '; - inuser_go_btl($pl); - echo '{!}'; - } - - if( $pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 1)) { - - $btltest[$pl['battle']]++; - - if( $pl['timereg'] == 0 ) { - mysql_query('UPDATE `users` SET `timereg` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['exp'] > 400000 && $pl['level'] == 8 ) { - $pl['exp'] = 400000; - mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 3500000 && $pl['level'] == 9 ) { - $pl['exp'] = 3500000; - mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 48000000 && $pl['level'] == 10 ) { - $pl['exp'] = 48000000; - mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 148000000 && $pl['level'] == 11 ) { - $pl['exp'] = 148000000; - mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 400000000 && $pl['level'] == 12 ) { - $pl['exp'] = 400000000; - mysql_query('UPDATE `stats` SET `exp` = "400000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['bot'] == 0 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - mysql_query('UPDATE `stats` SET `nextAct` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `online` = "'.time().'",`afk` = "" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - - botLogic::start( $pl['id'] ); - - //botLogic::e( $pl['battle'] .' -> '.$btltest[$pl['battle']] ); - }else{ - if( $pl['timereg'] == 0 ) { - mysql_query('UPDATE `users` SET `timereg` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['exp'] > 400000 && $pl['level'] == 8 ) { - $pl['exp'] = 400000; - mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 3500000 && $pl['level'] == 9 ) { - $pl['exp'] = 3500000; - mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 48000000 && $pl['level'] == 10 ) { - $pl['exp'] = 48000000; - mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 148000000 && $pl['level'] == 11 ) { - $pl['exp'] = 148000000; - mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }elseif( $pl['exp'] > 400000000 && $pl['level'] == 12 ) { - $pl['exp'] = 400000000; - mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - - if( $pl['bot'] == 0 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `nextAct` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } + if (isset($id['id'])) { + echo '[go]'; + echo file_get_contents( + 'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5( + $id['id'] . '_brfCOreW@!_' . $id['pass'] + ) . '&pass=' . $id['pass'] + ); + } } -$ii++; -echo 'TEST:'.$ii; -unset($btltest, $btl_ref, $btltest2); -sleep(4); +$ii = 0; +while ($ii < 6) { + $count = [0, 0, 0, 0, 0, 0]; + $sp = mysql_query( + 'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "saintlucia" OR `u`.`no_ip` = "trupojor" ORDER BY `s`.`nextAct` ASC LIMIT 100' + ); + $btltest = []; + $btl_ref = []; + while ($pl = mysql_fetch_array($sp)) { + $i++; + if ($pl['zv'] > 0) { + $zv = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`time`,`razdel` FROM `zayvki` WHERE `id` = "' . $pl['zv'] . '" AND `btl_id` = 0 LIMIT 1' + ) + ); + if (!isset($zv['id']) || $zv['razdel'] != 5) { + $pl['zv'] = 0; + mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + } + if ($pl['battle'] == -1) { + mysql_query('UPDATE `users` SET `battle` = 0,`ipreg` = 0 WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $pl['battle'] = 0; + $pl['ipreg'] = 0; + } + if ((date('i') == 5 || date('i') == 6 || date('i') == 15 || date('i') == 16 || date('i') == 25 || date( + 'i' + ) == 26 || date('i') == 35 || date('i') == 36 || date('i') == 45) && $pl['zv'] == 0) { + mysql_query('UPDATE `users` SET `ipreg` = 0 WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ((!isset($btltest2[$pl['battle']]) || $btltest2[$pl['battle']] == 0) && $pl['battle'] > 0) { + $btltest2[$pl['battle']]++; + echo '|' . $pl['battle'] . '|' . $pl['id'] . '|inBATTLE | '; + inuser_go_btl($pl); + echo '{!}'; + } + + if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 1)) { + + $btltest[$pl['battle']]++; + + if ($pl['timereg'] == 0) { + mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['exp'] > 400000 && $pl['level'] == 8) { + $pl['exp'] = 400000; + mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 3500000 && $pl['level'] == 9) { + $pl['exp'] = 3500000; + mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 48000000 && $pl['level'] == 10) { + $pl['exp'] = 48000000; + mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 148000000 && $pl['level'] == 11) { + $pl['exp'] = 148000000; + mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 400000000 && $pl['level'] == 12) { + $pl['exp'] = 400000000; + mysql_query('UPDATE `stats` SET `exp` = "400000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['bot'] == 0) { + mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `online` = "' . time() . '",`afk` = "" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + + BotLogic::start($pl['id']); + + } else { + if ($pl['timereg'] == 0) { + mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['exp'] > 400000 && $pl['level'] == 8) { + $pl['exp'] = 400000; + mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 3500000 && $pl['level'] == 9) { + $pl['exp'] = 3500000; + mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 48000000 && $pl['level'] == 10) { + $pl['exp'] = 48000000; + mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 148000000 && $pl['level'] == 11) { + $pl['exp'] = 148000000; + mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } elseif ($pl['exp'] > 400000000 && $pl['level'] == 12) { + $pl['exp'] = 400000000; + mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + + if ($pl['bot'] == 0) { + mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + } + + $ii++; + echo 'TEST:' . $ii; + unset($btltest, $btl_ref, $btltest2); + sleep(4); } -?> diff --git a/cron_bs.php b/cron_bs.php index 71f48971..2d440a51 100644 --- a/cron_bs.php +++ b/cron_bs.php @@ -29,7 +29,6 @@ define('GAME',true); setlocale(LC_CTYPE ,"ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -//include('_incl_data/class/__user.php'); function send($text) { return mysql_query('INSERT INTO `chat` (`new`,`type`,`to`,`text`,`time`) VALUES (1,6,"Игромир","'.$text.'",'.time().')'); diff --git a/cron_dungeon_getOut.php b/cron_dungeon_getOut.php index f16af60c..a464fc9c 100644 --- a/cron_dungeon_getOut.php +++ b/cron_dungeon_getOut.php @@ -24,9 +24,7 @@ setlocale(LC_CTYPE ,"ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -//include('_incl_data/class/__user.php'); -//include('_incl_data/class/__dungeon.php'); - + # запуск скрипта. function start() { # Страница создана 0.0000 diff --git a/cron_dungeon_goBots.php b/cron_dungeon_goBots.php index 78e4e4a8..c244d9e0 100644 --- a/cron_dungeon_goBots.php +++ b/cron_dungeon_goBots.php @@ -3,158 +3,169 @@ # перемещения ботов по пещере # а так-же напедения, когда игрок рядом -# Получаем IP -function getIP() { - if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; -} - -# Выполняем проверку безопасности. -/*if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); } -if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '5.187.7.71') { - die(getIP().'
    '.$_SERVER['SERVER_ADDR']); -}*/ - -define('GAME', true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); +const GAME = true; +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -//include('_incl_data/class/__dungeon.php'); - -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); -} # Совершаем действие -> Нападение на игрока. -function botAttack ( $bot, $user ){ - if( $user['userBattle'] > 0 ) { - $battleID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['userBattle'].'" AND `team_win` = "-1" LIMIT 1')); - } - if( !isset($battleID['id']) ) { //Создаем поединок - $btl_id = 0; - $expB = 0; - $btl = array('players'=>'', 'timeout'=>180, 'type'=>0, 'invis'=>0, 'noinc'=>0, 'travmChance'=>0, 'typeBattle'=>0, 'addExp'=>$expB, 'money'=>0 ); - - $ins = mysql_query( - 'INSERT INTO `battle` +function botAttack($bot, $user) +{ + if ($user['userBattle'] > 0) { + $battleID = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `battle` WHERE `id` = "' . $user['userBattle'] . '" AND `team_win` = "-1" LIMIT 1' + ) + ); + } + if (!isset($battleID['id'])) { //Создаем поединок + $btl_id = 0; + $expB = 0; + $btl = ['players' => '', 'timeout' => 180, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; + + $ins = mysql_query( + 'INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( - "'.$bot['dn_id'].'", - "'.$bot['this_dn'].'", - "'.$bot['x'].'", - "'.$bot['y'].'", - "'.$bot['userCity'].'", - "'.time().'", - "'.$btl['players'].'", - "'.$btl['timeout'].'", - "'.$btl['type'].'", - "'.$btl['invis'].'", - "'.$btl['noinc'].'", - "'.$btl['travmChance'].'", - "'.$btl['typeBattle'].'", - "'.$btl['addExp'].'", - "'.$btl['money'].'" + "' . $bot['dn_id'] . '", + "' . $bot['this_dn'] . '", + "' . $bot['x'] . '", + "' . $bot['y'] . '", + "' . $bot['userCity'] . '", + "' . time() . '", + "' . $btl['players'] . '", + "' . $btl['timeout'] . '", + "' . $btl['type'] . '", + "' . $btl['invis'] . '", + "' . $btl['noinc'] . '", + "' . $btl['travmChance'] . '", + "' . $btl['typeBattle'] . '", + "' . $btl['addExp'] . '", + "' . $btl['money'] . '" )' - ); - $btl_id = mysql_insert_id(); + ); + $btl_id = mysql_insert_id(); - if( $btl_id > 0 ) { //Добавляем ботов - $j = 0; - $logins_bot = array(); - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$btl_id.'" WHERE `id2` = "'.$bot['id2'].'" LIMIT 1'); - $jui = 1; - while( $jui <= $bot['colvo'] ) { - $k = botAddBattle( $bot, $logins_bot ); - $logins_bot = $k['logins_bot']; - if( $k != false ) { - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if( $upd ) { - $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if( $upd ) { - $j++; - } - } - } - $jui++; - } - unset( $logins_bot ); - if( $j > 0 ) { - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$user['userId'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$user['userId'].'" LIMIT 1'); - } - } - } else { # Вмешиваемся в поединок. - $j = 0; - $logins_bot = array(); - $logins_bot_text =array(); - $logins_bot_vars =array('time1='.time().''); - $logins_bot_inBattle = mysql_query('SELECT SUBSTRING_INDEX(`login`, " (", 1) as login2, count(`login`) as count, `login` FROM `battle_users` WHERE `battle` = "'.$battleID['id'].'" AND `team`=2 GROUP BY `login2`'); - while($row = mysql_fetch_array($logins_bot_inBattle) ) { - $logins_bot[$row['login2']] = (int)$row['count']; - } - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$battleID['id'].'" WHERE `id2` = "'.$bot['id2'].'" LIMIT 1'); - $jui = 1; - while( $jui <= $bot['colvo'] ) { - $k = botAddBattle( $bot, $logins_bot ); - $logins_bot = $k['logins_bot']; - - $logins_bot_text[] = ' '.$k['login'].''; - if( $k != false ) { - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$battleID['id'].'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if( $upd ) { - $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if( $upd ) { - $j++; - } - } - } - $jui++; - } - if( $j > 0 ) { - $logins_bot_text = '{tm1} В поединок вмешались: '.implode(', ',$logins_bot_text).'.'; - $logins_bot_vars = implode('||',$logins_bot_vars); - $battle_log = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle`='.$battleID['id'].' ORDER BY `id_hod` DESC LIMIT 1')); - 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().'","'.$battleID['id'].'","'.($battle_log['id_hod']+1).'","'.$logins_bot_text.'","'.$logins_bot_vars.'","","","","",1)'); - } - } - unset($logins_bot); - if( $j > 0 ) { - mysql_query('UPDATE `users` SET `battle` = "'.$battleID['id'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - } - unset($logins_bot_inBattle); - } + if ($btl_id > 0) { //Добавляем ботов + $j = 0; + $logins_bot = []; + mysql_query( + 'UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1' + ); + $jui = 1; + while ($jui <= $bot['colvo']) { + $k = botAddBattle($bot, $logins_bot); + $logins_bot = $k['logins_bot']; + if ($k != false) { + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1' + ); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + unset($logins_bot); + if ($j > 0) { + mysql_query( + 'UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $user['userId'] . '" LIMIT 1' + ); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['userId'] . '" LIMIT 1'); + } + } + } else { # Вмешиваемся в поединок. + $j = 0; + $logins_bot = []; + $logins_bot_text = []; + $logins_bot_vars = ['time1=' . time() . '']; + $logins_bot_inBattle = mysql_query( + 'SELECT SUBSTRING_INDEX(`login`, " (", 1) as login2, count(`login`) as count, `login` FROM `battle_users` WHERE `battle` = "' . $battleID['id'] . '" AND `team`=2 GROUP BY `login2`' + ); + while ($row = mysql_fetch_array($logins_bot_inBattle)) { + $logins_bot[$row['login2']] = (int)$row['count']; + } + mysql_query( + 'UPDATE `dungeon_bots` SET `inBattle` = "' . $battleID['id'] . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1' + ); + $jui = 1; + while ($jui <= $bot['colvo']) { + $k = botAddBattle($bot, $logins_bot); + $logins_bot = $k['logins_bot']; + + $logins_bot_text[] = ' ' . $k['login'] . ''; + if ($k != false) { + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "' . $battleID['id'] . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1' + ); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + $jui++; + } + if ($j > 0) { + $logins_bot_text = '{tm1} В поединок вмешались: ' . implode(', ', $logins_bot_text) . '.'; + $logins_bot_vars = implode('||', $logins_bot_vars); + $battle_log = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `battle_logs` WHERE `battle`=' . $battleID['id'] . ' ORDER BY `id_hod` DESC LIMIT 1' + ) + ); + 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( + ) . '","' . $battleID['id'] . '","' . ($battle_log['id_hod'] + 1) . '","' . $logins_bot_text . '","' . $logins_bot_vars . '","","","","",1)' + ); + } + } + unset($logins_bot); + if ($j > 0) { + mysql_query( + 'UPDATE `users` SET `battle` = "' . $battleID['id'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1' + ); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + } + unset($logins_bot_inBattle); + } } # Совершаем нападение -> Добавляем Ботов в поединок -function botAddBattle( $bot, $logins_bot ) { - $add_bot = mysql_fetch_array( - mysql_query('SELECT +function botAddBattle($bot, $logins_bot) +{ + $add_bot = mysql_fetch_array( + mysql_query( + 'SELECT `id`, `login`, `stats`, `obraz`, `level`, `sex`, `name`, `deviz`, `hobby`, `type`, `itemsUse`, `priemUse`, `align`, `clan`, `align_zvanie`, `bonus`, `clan_zvanie`, `time_reg`, `city_reg`, `upLevel`, `active`, `expB`, `p_items`, `agressor`, `priems`, `priems_z`, `award` FROM `test_bot` - WHERE `id` = "'.$bot['id_bot'].'" + WHERE `id` = "' . $bot['id_bot'] . '" LIMIT 1' - ) - ); - - if( isset($add_bot['id']) ) { - if( isset($logins_bot[$add_bot['login']]) ) { - $logins_bot[$add_bot['login']]++; - $add_bot['login'] = $add_bot['login'].' ('.$logins_bot[$add_bot['login']].')'; - } else { - $logins_bot[$add_bot['login']] = 1; - } - $ret = true; - if( $add_bot['time_reg'] == 100 ) { - $add_bot['time_reg'] = time(); - } - if( $add_bot['city_reg'] == '{thiscity}' ) { - $add_bot['city_reg'] = $bot['userCity']; - } - $ins1 = mysql_query('INSERT INTO `users` ( + ) + ); + + if (isset($add_bot['id'])) { + if (isset($logins_bot[$add_bot['login']])) { + $logins_bot[$add_bot['login']]++; + $add_bot['login'] = $add_bot['login'] . ' (' . $logins_bot[$add_bot['login']] . ')'; + } else { + $logins_bot[$add_bot['login']] = 1; + } + $ret = true; + if ($add_bot['time_reg'] == 100) { + $add_bot['time_reg'] = time(); + } + if ($add_bot['city_reg'] == '{thiscity}') { + $add_bot['city_reg'] = $bot['userCity']; + } + $ins1 = mysql_query( + 'INSERT INTO `users` ( `align`, `login`, `level`, @@ -169,179 +180,214 @@ function botAddBattle( $bot, $logins_bot ) { `obraz`, `bot_id` ) VALUES ( - "'.$add_bot['align'].'", - "'.$add_bot['login'].'", - "'.$add_bot['level'].'", - "'.md5('bot_pass_'.$add_bot['login'].'_').'", - "'.$bot['userCity'].'", - "'.$add_bot['city_reg'].'", - "'.$add_bot['name'].'", - "'.$add_bot['sex'].'", - "'.$add_bot['deviz'].'", - "'.$add_bot['hobby'].'", - "'.$add_bot['time_reg'].'", - "'.$add_bot['obraz'].'", - "'.$bot['id_bot'].'" - )'); - - # Если бот успешно создан. - if( $ins1 ) { - $uid = mysql_insert_id(); - $ins2 = mysql_query('INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("'.$uid.'","'.$add_bot['stats'].'","1000000","'.$add_bot['upLevel'].'","1")'); - if( $ins2 ) { - $add_bot['id'] = $uid; - $add_bot['logins_bot'] = $logins_bot; - $ret = $add_bot; - - //Выдаем предметы - //$this->addItem($item_id,$uid); - $iu = explode(',',$add_bot['itemsUse']); - $i = 0; - $w3b = 0; - while($i0) { - $idiu = botAddItem($iu[$i],$add_bot['id'], $bot['userCity']); - $islot = mysql_fetch_array(mysql_query('SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "'.$iu[$i].'" LIMIT 1')); - if( isset($islot['id']) ) { - if( $islot['inslot'] == 3 ) { - if( $w3b == 1 ) { - $islot = 14; - } else { - $islot = 3; - $w3b = 1; - } - } else { - $islot = $islot['inslot']; - } - } else { - $islot = 2000; - } - if( isset($idiu, $islot) ) mysql_query('UPDATE `items_users` SET `inOdet` = "'.$islot.'" WHERE `id` = "'.$idiu.'" LIMIT 1'); - } - $i++; - } - - }else{ - $ret = false; - } - }else{ - $ret = false; - } - return $ret; - } + "' . $add_bot['align'] . '", + "' . $add_bot['login'] . '", + "' . $add_bot['level'] . '", + "' . md5('bot_pass_' . $add_bot['login'] . '_') . '", + "' . $bot['userCity'] . '", + "' . $add_bot['city_reg'] . '", + "' . $add_bot['name'] . '", + "' . $add_bot['sex'] . '", + "' . $add_bot['deviz'] . '", + "' . $add_bot['hobby'] . '", + "' . $add_bot['time_reg'] . '", + "' . $add_bot['obraz'] . '", + "' . $bot['id_bot'] . '" + )' + ); + + # Если бот успешно создан. + if ($ins1) { + $uid = mysql_insert_id(); + $ins2 = mysql_query( + 'INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $add_bot['stats'] . '","1000000","' . $add_bot['upLevel'] . '","1")' + ); + if ($ins2) { + $add_bot['id'] = $uid; + $add_bot['logins_bot'] = $logins_bot; + $ret = $add_bot; + + //Выдаем предметы + //$this->addItem($item_id,$uid); + $iu = explode(',', $add_bot['itemsUse']); + $i = 0; + $w3b = 0; + while ($i < count($iu)) { + if ($iu[$i] > 0) { + $idiu = botAddItem($iu[$i], $add_bot['id'], $bot['userCity']); + $islot = mysql_fetch_array( + mysql_query('SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "' . $iu[$i] . '" LIMIT 1') + ); + if (isset($islot['id'])) { + if ($islot['inslot'] == 3) { + if ($w3b == 1) { + $islot = 14; + } else { + $islot = 3; + $w3b = 1; + } + } else { + $islot = $islot['inslot']; + } + } else { + $islot = 2000; + } + if (isset($idiu, $islot)) { + mysql_query( + 'UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1' + ); + } + } + $i++; + } + + } else { + $ret = false; + } + } else { + $ret = false; + } + return $ret; + } } #Выдаем предметы Боту. -function botAddItem($item_id, $bot_uid, $city) { - $i = mysql_fetch_array(mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "'.mysql_real_escape_string($item_id).'" LIMIT 1')); - if(isset($i['id'])){ - $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "'.$i['id'].'" LIMIT 1')); - //новая дата - $data = $d['data']; - $ins = mysql_query(' +function botAddItem($item_id, $bot_uid, $city) +{ + $i = mysql_fetch_array( + mysql_query( + 'SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "' . mysql_real_escape_string( + $item_id + ) . '" LIMIT 1' + ) + ); + if (isset($i['id'])) { + $d = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1' + ) + ); + //новая дата + $data = $d['data']; + $ins = mysql_query( + ' INSERT INTO `items_users` ( `overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`,`dn_delete` ) VALUES ( - "'.$i['overTypei'].'", - "'.$i['id'].'", - "'.$bot_uid.'", - "'.$data.'", - "'.$i['iznosMAXi'].'", - "'.$i['geni'].'", - "'.$i['magic_inci'].'", - "'.$city.'", - "'.time().'", - "'.time().'", - "'.$i['dn_delete'].'" - )'); + "' . $i['overTypei'] . '", + "' . $i['id'] . '", + "' . $bot_uid . '", + "' . $data . '", + "' . $i['iznosMAXi'] . '", + "' . $i['geni'] . '", + "' . $i['magic_inci'] . '", + "' . $city . '", + "' . time() . '", + "' . time() . '", + "' . $i['dn_delete'] . '" + )' + ); - # Если предмет успешно добавлен в базу данных. - if( $ins ){ - $rt = mysql_insert_id(); - # отключена запись получения предмета в Дело. - } else { - $rt = 0; - } - } - return $rt; + # Если предмет успешно добавлен в базу данных. + if ($ins) { + $rt = mysql_insert_id(); + # отключена запись получения предмета в Дело. + } else { + $rt = 0; + } + } + return $rt; } -function moveBots($direction, $b){ - $toGoX = 0; - $toGoY = 0; - - if( isset($b['noBot']) && $b['noBot'] != '0000' ) { - if( $b['noBot'][0] != '0' ) $b['goTop'] = 0; - if( $b['noBot'][1] != '0' ) $b['goLeft'] = 0; - if( $b['noBot'][2] != '0' ) $b['goBottom'] = 0; - if( $b['noBot'][3] != '0' ) $b['goRight'] = 0; - } - $go = array( - 1 => array ('d'=>(int)$b['goTop'], 'go1'=>(int)$b['goLeft'], 'go2'=>(int)$b['goRight'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']), - 2 => array ('d'=>(int)$b['goLeft'], 'go1'=>(int)$b['goBottom'], 'go2'=>(int)$b['goTop'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']), - 3 => array ('d'=>(int)$b['goBottom'], 'go1'=>(int)$b['goRight'], 'go2'=>(int)$b['goLeft'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']), - 4 => array ('d'=>(int)$b['goRight'], 'go1'=>(int)$b['goTop'], 'go2'=>(int)$b['goBottom'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']) - ); - $dir = array( - 1 => array('moveForward' => array( 'x' => '0', 'y' => '1' ), 'moveBack' => array( 'x' => '0', 'y' => '-1' ),'moveGo1' => array( 'x' => '-1', 'y' => '0' ),'moveGo2' => array( 'x' => '1', 'y' => '0' )), - 2 => array('moveForward' => array( 'x' => '-1', 'y' => '0' ),'moveBack' => array( 'x' => '1', 'y' => '0' ),'moveGo1' => array( 'x' => '0', 'y' => '-1' ),'moveGo2' => array( 'x' => '0', 'y' => '1' )), - 3 => array('moveForward' => array( 'x' => '0', 'y' => '-1' ),'moveBack' => array( 'x' => '0', 'y' => '1' ),'moveGo1' => array( 'x' => '1', 'y' => '0' ),'moveGo2' => array( 'x' => '-1', 'y' => '0' )), - 4 => array('moveForward' => array( 'x' => '1', 'y' => '0' ),'moveBack' => array( 'x' => '-1', 'y' => '0' ),'moveGo1' => array( 'x' => '0', 'y' => '1' ),'moveGo2' => array( 'x' => '0', 'y' => '-1' )) - ); - $go = $go[$direction]; - $dir = $dir[$direction]; - if($go['d'] == 1 ) { - $toGoY = $dir['moveForward']['y']; - $toGoX = $dir['moveForward']['x']; - if(rand(1,100)>66){ - if( $go['go1'] ==1 && $go['go2'] == 0) { - $toGoY = $dir['moveGo1']['y']; - $toGoX = $dir['moveGo1']['x']; - } elseif( $go['go1'] ==0 && $go['go2'] == 1) { - $toGoY = $dir['moveGo2']['y']; - $toGoX = $dir['moveGo2']['x']; - } elseif( $go['go1'] ==1 && $go['go2'] == 1) { - $a = rand(1,2); - $toGoY = $dir['moveGo'.$a]['y']; - $toGoX = $dir['moveGo'.$a]['x']; - } - } elseif(rand(1,100)>96){ - $toGoY = $dir['moveBack']['y']; - $toGoX = $dir['moveBack']['x']; - } - } elseif( $go['d'] == 0 ) { - if( $go['go1'] ==1 && $go['go2'] == 1 ){ - if(rand(0,1) == 1) { - $toGoY = $dir['moveGo1']['y']; - $toGoX = $dir['moveGo1']['x']; - } else { - $toGoY = $dir['moveGo2']['y']; - $toGoX = $dir['moveGo2']['x']; - } - } elseif( $go['go1'] ==1 && $go['go2'] == 0 ) { - $toGoY = $dir['moveGo1']['y']; - $toGoX = $dir['moveGo1']['x']; - } elseif( $go['go1'] ==0 && $go['go2'] == 1 ) { - $toGoY = $dir['moveGo2']['y']; - $toGoX = $dir['moveGo2']['x']; - } elseif( $go['go1'] == 0 && $go['go2'] == 0 ){ - $toGoY = $dir['moveBack']['y']; - $toGoX = $dir['moveBack']['x']; - } - } - unset($dir, $go, $direction, $a); - return array( 'x'=>(int)$toGoX, 'y'=>(int)$toGoY ); + +function moveBots($direction, $b) +{ + $toGoX = 0; + $toGoY = 0; + + if (isset($b['noBot']) && $b['noBot'] != '0000') { + if ($b['noBot'][0] != '0') { + $b['goTop'] = 0; + } + if ($b['noBot'][1] != '0') { + $b['goLeft'] = 0; + } + if ($b['noBot'][2] != '0') { + $b['goBottom'] = 0; + } + if ($b['noBot'][3] != '0') { + $b['goRight'] = 0; + } + } + $go = [ + 1 => ['d' => (int)$b['goTop'], 'go1' => (int)$b['goLeft'], 'go2' => (int)$b['goRight'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']], + 2 => ['d' => (int)$b['goLeft'], 'go1' => (int)$b['goBottom'], 'go2' => (int)$b['goTop'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']], + 3 => ['d' => (int)$b['goBottom'], 'go1' => (int)$b['goRight'], 'go2' => (int)$b['goLeft'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']], + 4 => ['d' => (int)$b['goRight'], 'go1' => (int)$b['goTop'], 'go2' => (int)$b['goBottom'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']], + ]; + $dir = [ + 1 => ['moveForward' => ['x' => '0', 'y' => '1'], 'moveBack' => ['x' => '0', 'y' => '-1'], 'moveGo1' => ['x' => '-1', 'y' => '0'], 'moveGo2' => ['x' => '1', 'y' => '0']], + 2 => ['moveForward' => ['x' => '-1', 'y' => '0'], 'moveBack' => ['x' => '1', 'y' => '0'], 'moveGo1' => ['x' => '0', 'y' => '-1'], 'moveGo2' => ['x' => '0', 'y' => '1']], + 3 => ['moveForward' => ['x' => '0', 'y' => '-1'], 'moveBack' => ['x' => '0', 'y' => '1'], 'moveGo1' => ['x' => '1', 'y' => '0'], 'moveGo2' => ['x' => '-1', 'y' => '0']], + 4 => ['moveForward' => ['x' => '1', 'y' => '0'], 'moveBack' => ['x' => '-1', 'y' => '0'], 'moveGo1' => ['x' => '0', 'y' => '1'], 'moveGo2' => ['x' => '0', 'y' => '-1']], + ]; + $go = $go[$direction]; + $dir = $dir[$direction]; + if ($go['d'] == 1) { + $toGoY = $dir['moveForward']['y']; + $toGoX = $dir['moveForward']['x']; + if (rand(1, 100) > 66) { + if ($go['go1'] == 1 && $go['go2'] == 0) { + $toGoY = $dir['moveGo1']['y']; + $toGoX = $dir['moveGo1']['x']; + } elseif ($go['go1'] == 0 && $go['go2'] == 1) { + $toGoY = $dir['moveGo2']['y']; + $toGoX = $dir['moveGo2']['x']; + } elseif ($go['go1'] == 1 && $go['go2'] == 1) { + $a = rand(1, 2); + $toGoY = $dir['moveGo' . $a]['y']; + $toGoX = $dir['moveGo' . $a]['x']; + } + } elseif (rand(1, 100) > 96) { + $toGoY = $dir['moveBack']['y']; + $toGoX = $dir['moveBack']['x']; + } + } elseif ($go['d'] == 0) { + if ($go['go1'] == 1 && $go['go2'] == 1) { + if (rand(0, 1) == 1) { + $toGoY = $dir['moveGo1']['y']; + $toGoX = $dir['moveGo1']['x']; + } else { + $toGoY = $dir['moveGo2']['y']; + $toGoX = $dir['moveGo2']['x']; + } + } elseif ($go['go1'] == 1 && $go['go2'] == 0) { + $toGoY = $dir['moveGo1']['y']; + $toGoX = $dir['moveGo1']['x']; + } elseif ($go['go1'] == 0 && $go['go2'] == 1) { + $toGoY = $dir['moveGo2']['y']; + $toGoX = $dir['moveGo2']['x']; + } elseif ($go['go1'] == 0 && $go['go2'] == 0) { + $toGoY = $dir['moveBack']['y']; + $toGoX = $dir['moveBack']['x']; + } + } + unset($dir, $go, $direction, $a); + return ['x' => (int)$toGoX, 'y' => (int)$toGoY]; } # запуск скрипта. -function start(){ - # Страница создана 0.0000 - $mtime = microtime();$mtime = explode(" ",$mtime);$tstart = $mtime[1] + $mtime[0]; +function start() +{ + # Страница создана 0.0000 + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $tstart = $mtime[1] + $mtime[0]; - # Выбираем всех ботов. - # В выборку включено: Позиция бота, Направление куда он может идти, Существует ли рядом Игрок, его координаты и в поединке ли он. - $query = mysql_query( - "SELECT + # Выбираем всех ботов. + # В выборку включено: Позиция бота, Направление куда он может идти, Существует ли рядом Игрок, его координаты и в поединке ли он. + $query = mysql_query( + "SELECT `dn`.`id` as `this_dn`, `dn`.`id2` as `dn_id`, `db`.`id2`, `db`.`id_bot`, `tb`.`login` as login, `db`.`colvo`, `db`.`go_bot`, `db`.`x`, `db`.`y`, `db`.`s`, `db`.`atack`, `tb`.`agressor`, `dm`.`go_1` as `goRight`, `dm`.`go_2` as `goLeft`, `dm`.`go_3` as `goTop`, `dm`.`go_4` as `goBottom`, `dm`.`no_bot` as `noBot`, `user_info`.`id` as `userId`, @@ -362,66 +408,73 @@ function start(){ `db`.`atack` = '0' AND `db`.`delete` = '0' AND `db`.`for_dn` = '0' AND - ( ( `db`.`go_bot` > '".(time()-32400)."' AND `db`.`go_bot` < '".(time())."') OR `db`.`go_bot`='1') AND + ( ( `db`.`go_bot` > '" . (time() - 32400) . "' AND `db`.`go_bot` < '" . (time()) . "') OR `db`.`go_bot`='1') AND `db`.`inBattle`='0' GROUP BY `db`.`id2` ORDER BY `db`.`go_bot` ASC" - ); - - while( $bot = mysql_fetch_array( $query ) ) { - if( $bot['go_bot'] > 0 && $bot['go_bot'] <= time() ) { - $sNext = true; - $sTo=$bot['s']; - $xFrom = $bot['x']; # текущие координаты X - $yFrom = $bot['y']; # текущие координаты Y + ); - $return = moveBots($bot['s'],$bot); - $xTo = $bot['x']+$return['x']; - $yTo = $bot['y']+$return['y']; - # Проверяем, имеется ли переход по клетке. - $inSight = 0; - if( isset($bot['id2']) ) { - if($xFrom==$xTo && $yFrom==$yTo) { # Если остаемся на месте. - $inSight = 1; - } elseif( isset($bot['goRight']) && $xFrom == $xTo-1 && $bot['goRight'] == 1 ) { //право - $sTo=4; - $inSight = 1; - } elseif( isset($bot['goLeft']) && $xFrom == $xTo+1 && $bot['goLeft'] == 1 ) { //лево - $sTo=2; - $inSight = 1; - } elseif( isset($bot['goTop']) && $yFrom == $yTo-1 && $bot['goTop'] == 1 ) { //верх - $sTo=1; - $inSight = 1; - } elseif( isset($bot['goBottom']) && $yFrom == $yTo+1 && $bot['goBottom'] == 1 ) { //низ - $sTo=3; - $inSight = 1; - } - } - - if( isset($bot['userId'],$bot['userPosY'],$bot['userPosX']) && $bot['userId'] != '' && $bot['agressor']==1 && ( - ($bot['userPosY']==$bot['y']+1 && $bot['userPosX']==$bot['x']) OR - ($bot['userPosY']==$bot['y']-1 && $bot['userPosX']==$bot['x']) OR - ($bot['userPosY']==$bot['y'] && $bot['userPosX']==$bot['x']-1) OR - ($bot['userPosY']==$bot['y'] && $bot['userPosX']==$bot['x']+1) - ) ) { - bot['userPosY']=$yFrom; $bot['userPosX']=$xFrom; - mysql_query('UPDATE `stats` SET `x` = "'.$xFrom.'" , `y` = "'.$yFrom.'" WHERE `id` = "'.$bot['userId'].'" LIMIT 1'); - botAttack($bot,$bot); - } elseif( isset($bot['userId'],$bot['userPosY'],$bot['userPosX']) && $bot['userId'] != '' && $inSight == 1 && $yTo == $bot['userPosY'] && $xTo == $bot['userPosX'] && $bot['atack']==1) { - botAttack($bot,$bot); - } elseif( $inSight == 1 ) { // Передвижение ботов. - $bot['go_bot'] = time()+rand(7,15); - mysql_query('UPDATE `dungeon_bots` SET `x` = "'.$xTo.'",`y` = "'.$yTo.'", `s` = "'.$sTo.'", `go_bot` = "'.$bot['go_bot'].'" WHERE `id2` = "'.$bot['id2'].'" LIMIT 1 '); - } - unset($xFrom,$yFrom,$xTo,$yTo,$inSight,$sNext,$sTo); - } - unset($bot); - } - unset($query,$bot); - - $mtime = microtime(); - $mtime = explode(" ",$mtime);$mtime = $mtime[1] + $mtime[0];$totaltime = ($mtime - $tstart); - printf ("Страница сгенерирована за %f секунд !", $totaltime); + while ($bot = mysql_fetch_array($query)) { + if ($bot['go_bot'] > 0 && $bot['go_bot'] <= time()) { + $sNext = true; + $sTo = $bot['s']; + $xFrom = $bot['x']; # текущие координаты X + $yFrom = $bot['y']; # текущие координаты Y + + $return = moveBots($bot['s'], $bot); + $xTo = $bot['x'] + $return['x']; + $yTo = $bot['y'] + $return['y']; + # Проверяем, имеется ли переход по клетке. + $inSight = 0; + if (isset($bot['id2'])) { + if ($xFrom == $xTo && $yFrom == $yTo) { # Если остаемся на месте. + $inSight = 1; + } elseif (isset($bot['goRight']) && $xFrom == $xTo - 1 && $bot['goRight'] == 1) { //право + $sTo = 4; + $inSight = 1; + } elseif (isset($bot['goLeft']) && $xFrom == $xTo + 1 && $bot['goLeft'] == 1) { //лево + $sTo = 2; + $inSight = 1; + } elseif (isset($bot['goTop']) && $yFrom == $yTo - 1 && $bot['goTop'] == 1) { //верх + $sTo = 1; + $inSight = 1; + } elseif (isset($bot['goBottom']) && $yFrom == $yTo + 1 && $bot['goBottom'] == 1) { //низ + $sTo = 3; + $inSight = 1; + } + } + + if (isset($bot['userId'], $bot['userPosY'], $bot['userPosX']) && $bot['userId'] != '' && $bot['agressor'] == 1 && ( + ($bot['userPosY'] == $bot['y'] + 1 && $bot['userPosX'] == $bot['x']) or + ($bot['userPosY'] == $bot['y'] - 1 && $bot['userPosX'] == $bot['x']) or + ($bot['userPosY'] == $bot['y'] && $bot['userPosX'] == $bot['x'] - 1) or + ($bot['userPosY'] == $bot['y'] && $bot['userPosX'] == $bot['x'] + 1) + )) { + bot['userPosY'] = $yFrom; + $bot['userPosX'] = $xFrom; + mysql_query( + 'UPDATE `stats` SET `x` = "' . $xFrom . '" , `y` = "' . $yFrom . '" WHERE `id` = "' . $bot['userId'] . '" LIMIT 1' + ); + botAttack($bot, $bot); + } elseif (isset($bot['userId'], $bot['userPosY'], $bot['userPosX']) && $bot['userId'] != '' && $inSight == 1 && $yTo == $bot['userPosY'] && $xTo == $bot['userPosX'] && $bot['atack'] == 1) { + botAttack($bot, $bot); + } elseif ($inSight == 1) { // Передвижение ботов. + $bot['go_bot'] = time() + rand(7, 15); + mysql_query( + 'UPDATE `dungeon_bots` SET `x` = "' . $xTo . '",`y` = "' . $yTo . '", `s` = "' . $sTo . '", `go_bot` = "' . $bot['go_bot'] . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1 ' + ); + } + unset($xFrom, $yFrom, $xTo, $yTo, $inSight, $sNext, $sTo); + } + unset($bot); + } + unset($query, $bot); + + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $mtime = $mtime[1] + $mtime[0]; + $totaltime = ($mtime - $tstart); + printf("Страница сгенерирована за %f секунд !", $totaltime); } # Запускаем выполнение процесса. diff --git a/cron_dungeon_save.php b/cron_dungeon_save.php index a4d99af3..1d7ae9a7 100644 --- a/cron_dungeon_save.php +++ b/cron_dungeon_save.php @@ -1,42 +1,19 @@ '.$_SERVER['SERVER_ADDR']); -}*/ - - -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +$sp = mysql_query( + 'SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"' +); +while ($pl = mysql_fetch_array($sp)) { + $last_dnow = mysql_fetch_array(mysql_query('SELECT * FROM `save_dungeon` WHERE `uid` = "' . $pl['id'] . '"')); + if (isset($last_dnow['id'])) { + mysql_query('UPDATE `users` SET `room` = "405" WHERE `id` = "' . $last_dnow['uid'] . '"'); + mysql_query( + 'UPDATE `stats` SET `dnow` = "' . $last_dnow['dnow'] . '",`x` = "' . $last_dnow['x'] . '",`y` = "' . $last_dnow['y'] . '" WHERE `id` = "' . $last_dnow['uid'] . '"' + ); + } } - -$sp = mysql_query('SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"'); - while($pl = mysql_fetch_array($sp)) { - $last_dnow = mysql_fetch_array(mysql_query('SELECT * FROM `save_dungeon` WHERE `uid` = "'.$pl['id'].'"')); - if(isset($last_dnow['id'])) { - mysql_query('UPDATE `users` SET `room` = "405" WHERE `id` = "'.$last_dnow['uid'].'"'); - mysql_query('UPDATE `stats` SET `dnow` = "'.$last_dnow['dnow'].'",`x` = "'.$last_dnow['x'].'",`y` = "'.$last_dnow['y'].'" WHERE `id` = "'.$last_dnow['uid'].'"'); - } -} -?> \ No newline at end of file diff --git a/cron_killusers.php b/cron_killusers.php index 21708c1d..4aef3587 100644 --- a/cron_killusers.php +++ b/cron_killusers.php @@ -2,196 +2,222 @@ die('Что-то тут не так...'); -function getIP() { - if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; +function getIP() +{ + return getIPblock(); } # Получаем IP -function getIPblock() { - if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; +function getIPblock() +{ + return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR']; } # Выполняем проверку безопасности. -if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); } -if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') { - die(getIPblock().'
    '.$_SERVER['SERVER_ADDR']); +if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') { + die('Hello pussy!'); +} +if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock( + ) != '5.187.7.71') { + die(getIPblock() . '
    ' . $_SERVER['SERVER_ADDR']); } -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +function e($t) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity","LEL","6","1","-1")' + ); } -function send_chat($type,$from,$text,$time) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")'); +function send_chat($type, $from, $text, $time) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("' . mysql_real_escape_string( + $text + ) . '","capitalcity","' . mysql_real_escape_string( + $from + ) . '","","' . $type . '","1","' . mysql_real_escape_string($time) . '","3")' + ); } -$kp = array( - 0 => 1, - 1 => 1, - 2 => 3, - 3 => 3, - 4 => 3, - 5 => 7, - 6 => 7, - 7 => 7, - 8 => 90, - 9 => 90, - 10 => 90, - 11 => 90, - 12 => 90, - 13 => 90, - 14 => 90, - 15 => 90, - 16 => 90, - 17 => 90, - 18 => 90, - 19 => 90, - 20 => 90, - 21 => 90 -); +$kp = [ + 0 => 1, + 1 => 1, + 2 => 3, + 3 => 3, + 4 => 3, + 5 => 7, + 6 => 7, + 7 => 7, + 8 => 90, + 9 => 90, + 10 => 90, + 11 => 90, + 12 => 90, + 13 => 90, + 14 => 90, + 15 => 90, + 16 => 90, + 17 => 90, + 18 => 90, + 19 => 90, + 20 => 90, + 21 => 90, +]; -function addUser($userData) { - $query = "INSERT INTO `users_kill` ( ". - mysql_real_escape_string(implode(' , ', array_keys($userData))). - " ) VALUES ( '". - (implode("' , '", $userData)). - "' )"; +function addUser($userData) +{ + $query = "INSERT INTO `users_kill` ( " . + mysql_real_escape_string(implode(' , ', array_keys($userData))) . + " ) VALUES ( '" . + (implode("' , '", $userData)) . + "' )"; - return $query; + return $query; } //Удаляем эффекты и предметы (не нужные) -mysql_query('DELETE FROM `eff_users` WHERE `delete` > "1392211522" AND `delete` < "'.time().'"'); -mysql_query('DELETE FROM `items_users` WHERE `delete` > "1392211522" AND `delete` < "'.time().'"'); +mysql_query('DELETE FROM `eff_users` WHERE `delete` > "1392211522" AND `delete` < "' . time() . '"'); +mysql_query('DELETE FROM `items_users` WHERE `delete` > "1392211522" AND `delete` < "' . time() . '"'); $lvl = 0; -while( $lvl <= 21 ) { - $last_time = round( time() - ( 2 * $kp[$lvl] * 86400 ) ); - $sp = mysql_query('SELECT `u`.*,`s`.*,`u`.`id` AS `id1`,`s`.`id` AS `id2` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `u`.`admin` = 0 AND `u`.`pass` != "" AND `u`.`no_ip` = "" AND `u`.`level` = "'.$lvl.'" AND `align` != 50 AND `u`.`online` < '.$last_time.' LIMIT 1000'); - while($pl = mysql_fetch_array($sp)) { - - if( $pl['id'] < 1 ) { - if( $pl['id1'] > 0 ) { - $pl['id'] = $pl['id1']; - }elseif( $pl['id2'] > 0 ) { - $pl['id'] = $pl['id2']; - } - } - - //Собираем данные сколько ценностей было на персонаже - $pl['bank'] = mysql_fetch_array(mysql_query('SELECT SUM(`money1`),SUM(`money2`) FROM `bank` WHERE `uid` = "'.$pl['id'].'" LIMIT 1')); - $pl['money'] += $pl['bank'][0]; - $pl['money2'] += $pl['bank'][1]; - $sitm = mysql_query('SELECT `id`,`item_id`,`1price`,`2price` FROM `items_users` WHERE (`delete` = 1000 OR `delete` = 0) AND `delete` = "0" AND `data` NOT LIKE "%|frompisher=%" AND `uid` = "'.$pl['id'].'"'); - while($pitm = mysql_fetch_array($sitm)) { - if( $pitm['1price'] != 0 ) { - $pl['money'] += $pitm['1price']; - }elseif( $pitm['2price'] != 0 ) { - $pl['money'] += $pitm['2price']; - }else{ - $pitems = mysql_fetch_array(mysql_query('SELECT `price1`,`price2` FROM `items_main` WHERE `id` = "'.$sitm['item_id'].'" LIMIT 1')); - if( $pitems['price2'] > 0 ) { - $pl['money'] += $pitems['price2']; - }else{ - $pl['money2'] += $pitems['price1']; - } - } - } - if($pl['id'] > 0) { - //Удаляем все данные о персонаже на проекте - mysql_query('DELETE FROM `aaa_znahar` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `add_smiles` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `a_com_act` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `a_noob` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `a_system` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `a_vaucher` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `a_vaucher_active` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `bank` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `bank_alh` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `battle_actions` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `bid` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `bs_actions` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `bs_zv` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `complects_priem` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `dump` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `dungeon_actions` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `dungeon_now` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `dungeon_zv` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `feerverks` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `fontan` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `fontan_hp` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `friends` WHERE `user` = "'.$pl['id'].'" OR `friend` = "'.$pl['id'].'" OR `enemy` = "'.$pl['id'].'" OR `notinlist` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `house` WHERE `owner` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `items_img` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `izlom_rating` WHERE `uid` = "'.$pl['id'].'"'); - //mysql_query('DELETE FROM `obraz` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `online` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `post` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `reimage` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `rep` WHERE `id` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `repass` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `ruletka_coin` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `save_com` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `telegram` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `transfers` WHERE `uid1` = "'.$pl['id'].'" OR `uid2` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `users` WHERE `id` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `users_animal` WHERE `uid` = "'.$pl['id'].'"'); - //mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `zayvki` WHERE `uid` = "'.$pl['id'].'"'); - mysql_query('DELETE FROM `_clan` WHERE `uid` = "'.$pl['id'].'"'); - echo '•'.$pl['login'].'
    '; - } - - //Заносим данные в базу - $usrData = array( - '`uid`' => $pl['id'], - '`money1`' => $pl['money'], - '`money2`' => $pl['money2'], - '`money4`' => $pl['money4'], - '`ip`' => $pl['ip'], - '`timereg`' => $pl['timereg'], - '`ipreg`' => $pl['ipreg'], - '`sex`' => $pl['sex'], - '`login`' => $pl['login'], - '`pass`' => $pl['pass'], - '`mail`' => $pl['mail'], - '`level`' => $pl['level'], - '`exp`' => $pl['exp'], - '`online`' => $pl['online'], - '`time_kill`' => time(), - '`align`' => $pl['align'], - '`clan`' => $pl['clan'], - '`banned`' => $pl['banned'], - '`win`' => $pl['win'], - '`lose`' => $pl['lose'], - '`nich`' => $pl['nich'], - '`marry`' => $pl['marry'], - '`send`' => $pl['send'], - '`activ`' => $pl['activ'], - '`name`' => $pl['name'], - '`obraz`' => $pl['obraz'], - '`bithday`' => $pl['bithday'], - '`host_reg`' => $pl['host_reg'] - ); - mysql_query(addUser($usrData)); - } - $lvl++; +while ($lvl <= 21) { + $last_time = round(time() - (2 * $kp[$lvl] * 86400)); + $sp = mysql_query( + 'SELECT `u`.*,`s`.*,`u`.`id` AS `id1`,`s`.`id` AS `id2` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `u`.`admin` = 0 AND `u`.`pass` != "" AND `u`.`no_ip` = "" AND `u`.`level` = "' . $lvl . '" AND `align` != 50 AND `u`.`online` < ' . $last_time . ' LIMIT 1000' + ); + while ($pl = mysql_fetch_array($sp)) { + + if ($pl['id'] < 1) { + if ($pl['id1'] > 0) { + $pl['id'] = $pl['id1']; + } elseif ($pl['id2'] > 0) { + $pl['id'] = $pl['id2']; + } + } + + //Собираем данные сколько ценностей было на персонаже + $pl['bank'] = mysql_fetch_array( + mysql_query('SELECT SUM(`money1`),SUM(`money2`) FROM `bank` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1') + ); + $pl['money'] += $pl['bank'][0]; + $pl['money2'] += $pl['bank'][1]; + $sitm = mysql_query( + 'SELECT `id`,`item_id`,`1price`,`2price` FROM `items_users` WHERE (`delete` = 1000 OR `delete` = 0) AND `delete` = "0" AND `data` NOT LIKE "%|frompisher=%" AND `uid` = "' . $pl['id'] . '"' + ); + while ($pitm = mysql_fetch_array($sitm)) { + if ($pitm['1price'] != 0) { + $pl['money'] += $pitm['1price']; + } elseif ($pitm['2price'] != 0) { + $pl['money'] += $pitm['2price']; + } else { + $pitems = mysql_fetch_array( + mysql_query( + 'SELECT `price1`,`price2` FROM `items_main` WHERE `id` = "' . $sitm['item_id'] . '" LIMIT 1' + ) + ); + if ($pitems['price2'] > 0) { + $pl['money'] += $pitems['price2']; + } else { + $pl['money2'] += $pitems['price1']; + } + } + } + if ($pl['id'] > 0) { + //Удаляем все данные о персонаже на проекте + mysql_query('DELETE FROM `aaa_znahar` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `add_smiles` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `a_com_act` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `a_noob` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `a_system` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `a_vaucher` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `a_vaucher_active` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `bank` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `bank_alh` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `battle_actions` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `bid` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `bs_actions` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `bs_zv` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `complects_priem` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `dump` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `dungeon_actions` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `dungeon_now` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `dungeon_zv` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `feerverks` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `fontan` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `fontan_hp` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query( + 'DELETE FROM `friends` WHERE `user` = "' . $pl['id'] . '" OR `friend` = "' . $pl['id'] . '" OR `enemy` = "' . $pl['id'] . '" OR `notinlist` = "' . $pl['id'] . '"' + ); + mysql_query('DELETE FROM `house` WHERE `owner` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `items_img` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `izlom_rating` WHERE `uid` = "' . $pl['id'] . '"'); + //mysql_query('DELETE FROM `obraz` WHERE `uid` = "'.$pl['id'].'"'); + mysql_query('DELETE FROM `online` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `post` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `reimage` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `rep` WHERE `id` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `repass` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `ruletka_coin` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `save_com` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `telegram` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `transfers` WHERE `uid1` = "' . $pl['id'] . '" OR `uid2` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `users_animal` WHERE `uid` = "' . $pl['id'] . '"'); + //mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$pl['id'].'"'); + mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `zayvki` WHERE `uid` = "' . $pl['id'] . '"'); + mysql_query('DELETE FROM `_clan` WHERE `uid` = "' . $pl['id'] . '"'); + echo '•' . $pl['login'] . '
    '; + } + + //Заносим данные в базу + $usrData = [ + '`uid`' => $pl['id'], + '`money1`' => $pl['money'], + '`money2`' => $pl['money2'], + '`money4`' => $pl['money4'], + '`ip`' => $pl['ip'], + '`timereg`' => $pl['timereg'], + '`ipreg`' => $pl['ipreg'], + '`sex`' => $pl['sex'], + '`login`' => $pl['login'], + '`pass`' => $pl['pass'], + '`mail`' => $pl['mail'], + '`level`' => $pl['level'], + '`exp`' => $pl['exp'], + '`online`' => $pl['online'], + '`time_kill`' => time(), + '`align`' => $pl['align'], + '`clan`' => $pl['clan'], + '`banned`' => $pl['banned'], + '`win`' => $pl['win'], + '`lose`' => $pl['lose'], + '`nich`' => $pl['nich'], + '`marry`' => $pl['marry'], + '`send`' => $pl['send'], + '`activ`' => $pl['activ'], + '`name`' => $pl['name'], + '`obraz`' => $pl['obraz'], + '`bithday`' => $pl['bithday'], + '`host_reg`' => $pl['host_reg'], + ]; + mysql_query(addUser($usrData)); + } + $lvl++; } -?> \ No newline at end of file diff --git a/cron_prizhaot.php b/cron_prizhaot.php index cdc4133b..1403ae40 100644 --- a/cron_prizhaot.php +++ b/cron_prizhaot.php @@ -1,39 +1,31 @@ '.$_SERVER['SERVER_ADDR']); - } +if (!isset($_GET['tests']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP( + ) != '51.89.6.100') { + exit(getIP() . '
    ' . $_SERVER['SERVER_ADDR']); } -define('GAME',true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); -include('_incl_data/__config.php'); +const GAME = true; +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__magic.php'); - //Подаем турнир (хаот) для 8-11 уровней -$inc = mysql_query('INSERT INTO `zayvki` (`comment`,`arand`,`noatack`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`noinc`,`razdel`,`time`,`fastfight`,`priz`,`cancel`,`maxplayers`,`tm1max`,`tm2max`) -VALUES ("Автозаявка!
    Тест прошу не заходить","1","1","capitalcity","0","33","300","180","8","8","12","12","1","5","'.time().'","1","1","0","40","0","0")'); +$inc = $pdo->prepare( + 'insert into zayvki (`comment`,`arand`,`noatack`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`noinc`,`razdel`,`time`,`fastfight`,`priz`,`maxplayers`,`tm1max`,`tm2max`) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,unix_timestamp(),?,?,?,?,?)' +)->execute( + [ + "Автозаявка! Тест прошу не заходить", + 1, 1, 'capitalcity', 0, 33, 300, 180, 8, 8, 12, 12, 1, 5, 1, 1, 40, 0, 0, + ] +); -$t='Внимание!!! Героическое Сражение началось.'; -mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("'.$t.'","capitalcity","","6","1","'.time().'")'); +$pdo->prepare('insert into chat (`text`,`type`,`new`,`time`) values (?,?,?,unix_timestamp())') + ->execute( + ["Внимание!!! Героическое Сражение началось.", 6, 1,] + ); - - -if($inc) { - echo 'true'; -}else{ - echo 'false'; -} - -?> \ No newline at end of file +echo $inc ? 'true' : 'false'; diff --git a/cron_psh.php b/cron_psh.php index fe3c2e42..a348dc71 100644 --- a/cron_psh.php +++ b/cron_psh.php @@ -1,80 +1,111 @@ '.$_SERVER['SERVER_ADDR']); +if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') { + die('Hello pussy!'); +} +if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock( + ) != '5.187.7.71') { + die(getIPblock() . '
    ' . $_SERVER['SERVER_ADDR']); } -define('GAME',true); +const GAME = true; -include('_incl_data/__config.php'); -include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__dungeon.php'); +require_once('_incl_data/__config.php'); +require_once('_incl_data/class/__db_connect.php'); +$d = new Dungeon; +$d->start(); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); -} - -function send_chat($type,$from,$text,$time) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")'); +function send_chat($type, $from, $text, $time) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("' . mysql_real_escape_string( + $text + ) . '","capitalcity","' . mysql_real_escape_string( + $from + ) . '","","' . $type . '","1","' . mysql_real_escape_string($time) . '","3")' + ); } //Розыгрыш предметов $sp = mysql_query('SELECT * FROM `dungeon_items` WHERE `user` = 0 AND `take` = 0'); -while( $pl = mysql_fetch_array($sp) ) { - $fxv = array( - 'itm' => mysql_fetch_array(mysql_query('SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`id` = "'.mysql_real_escape_string($pl['id']).'" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" LIMIT 1')), - 'luck_count' => mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "'.$pl['dn'].'" AND `vars` = "luck_itm'.mysql_real_escape_string($pl['id']).'" LIMIT 1')), - 'user_count' => mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "'.$pl['dn'].'" LIMIT 1')) - ); - $fxv['luck_count'] = $fxv['luck_count'][0]; - $fxv['user_count'] = $fxv['user_count'][0]; - - if( $fxv['itm']['user'] > 0 || $fxv['luck_count'] < 1 ) { - - }elseif( $fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time']+300 < time() ) { - $fxv['sp'] = mysql_query('SELECT * FROM `dungeon_actions` WHERE `dn` = "'.$pl['dn'].'" AND `vars` = "luck_itm'.mysql_real_escape_string($pl['id']).'" ORDER BY `vals` DESC LIMIT '.$fxv['luck_count']); - $fxv['winner'] = array(); - $fxv['win_val'] = 0; - while( $fxv['pl'] = mysql_fetch_array($fxv['sp']) ) { - if( $fxv['pl']['vals'] > $fxv['win_val'] ) { - //Победитель - unset($fxv['winner']); - $fxv['winner'][] = $fxv['pl']['uid']; - $fxv['win_val'] = $fxv['pl']['vals']; - }elseif( $fxv['pl']['vals'] > 0 && $fxv['pl']['vals'] == $fxv['win_val'] ) { - //ничья - $fxv['winner'][] = $fxv['pl']['uid']; - } - } - unset($fxv['pl'],$fxv['sp']); - if( count($fxv['winner']) > 1 ) { - //Розыгрыш еще раз между победителями - $fxv['text'] = 'test2'; - }elseif(count($fxv['winner']) == 1) { - $fxv['user_win'] = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`sex`,`city`,`room` FROM `users` WHERE `id` = "'.$fxv['winner'][0].'" LIMIT 1')); - $fxv['text'] = ''.$fxv['user_win']['login'].' выигрывает в споре за предмет "'.$fxv['itm']['name'].'"'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$pl['dn']."','".$fxv['user_win']['city']."','".$fxv['user_win']['room']."','','','".$fxv['text']."','".time()."','6','0','1','1')"); - mysql_query('UPDATE `dungeon_items` SET `time` = "'.time().'",`user` = "'.$fxv['user_win']['id'].'" WHERE `id` = "'.$fxv['itm']['id'].'" LIMIT 1'); - }else{ - //Любой может подобрать предмет - mysql_query('UPDATE `dungeon_items` SET `user` = "1" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - } - unset($fxv); +while ($pl = mysql_fetch_array($sp)) { + $fxv = ['itm' => mysql_fetch_array( + mysql_query( + 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`id` = "' . mysql_real_escape_string( + $pl['id'] + ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" LIMIT 1' + ) + ), 'luck_count' => mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $pl['dn'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $pl['id'] + ) . '" LIMIT 1' + ) + ), 'user_count' => mysql_fetch_array( + mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $pl['dn'] . '" LIMIT 1') + )]; + $fxv['luck_count'] = $fxv['luck_count'][0]; + $fxv['user_count'] = $fxv['user_count'][0]; + + if ($fxv['itm']['user'] <= 0 && $fxv['luck_count'] >= 1 && ($fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time'] + 300 < time( + ))) { + $fxv['sp'] = mysql_query( + 'SELECT * FROM `dungeon_actions` WHERE `dn` = "' . $pl['dn'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $pl['id'] + ) . '" ORDER BY `vals` DESC LIMIT ' . $fxv['luck_count'] + ); + $fxv['winner'] = []; + $fxv['win_val'] = 0; + while ($fxv['pl'] = mysql_fetch_array($fxv['sp'])) { + if ($fxv['pl']['vals'] > $fxv['win_val']) { + //Победитель + unset($fxv['winner']); + $fxv['winner'][] = $fxv['pl']['uid']; + $fxv['win_val'] = $fxv['pl']['vals']; + } elseif ($fxv['pl']['vals'] > 0 && $fxv['pl']['vals'] == $fxv['win_val']) { + //ничья + $fxv['winner'][] = $fxv['pl']['uid']; + } + } + unset($fxv['pl'], $fxv['sp']); + if (count($fxv['winner']) > 1) { + //Розыгрыш еще раз между победителями + $fxv['text'] = 'test2'; + } elseif (count($fxv['winner']) == 1) { + $fxv['user_win'] = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`sex`,`city`,`room` FROM `users` WHERE `id` = "' . $fxv['winner'][0] . '" LIMIT 1' + ) + ); + $fxv['text'] = '' . $fxv['user_win']['login'] . ' выигрывает в споре за предмет "' . $fxv['itm']['name'] . '"'; + mysql_query( + "INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $pl['dn'] . "','" . $fxv['user_win']['city'] . "','" . $fxv['user_win']['room'] . "','','','" . $fxv['text'] . "','" . time( + ) . "','6','0','1','1')" + ); + mysql_query( + 'UPDATE `dungeon_items` SET `time` = "' . time( + ) . '",`user` = "' . $fxv['user_win']['id'] . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' + ); + } else { + //Любой может подобрать предмет + mysql_query('UPDATE `dungeon_items` SET `user` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + } + unset($fxv); } -?> \ No newline at end of file diff --git a/cron_tower.php b/cron_tower.php index d5279675..7703a15e 100644 --- a/cron_tower.php +++ b/cron_tower.php @@ -1,885 +1,1081 @@ -----'.$_SERVER['SERVER_ADDR']); - } -} +if (!isset($_GET['test']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP( + ) != '31.131.106.205') { + exit(getIP() . '
    ' . $_SERVER['SERVER_ADDR']); + } -function changeSleep($uid,$sleep_action){ - global $u; - if( $sleep_action == 1 ){ - // - mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("'.$uid.'","'.time().'","1")'); - // - mysql_query("UPDATE `eff_users` SET `sleeptime`=".time().",`deactiveLast` = ( `deactiveTime` - ".time()." ) WHERE `uid`='".mysql_real_escape_string($uid)."' AND `no_Ace` = 0 AND `delete` = 0"); - mysql_query('UPDATE `items_users` SET `time_sleep` = "'.time().'" WHERE `uid` = "'.$uid.'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - $u->addAction(time(),'sleep',$u->info['city']); - // - } elseif( $sleep_action == 2 ){ - // - mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("'.$uid.'","'.time().'","2")'); - // - $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "'.$uid.'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - while( $pl = mysql_fetch_array($sp) ) { - $tm_add = time() - $pl['time_sleep']; - mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "'.($pl['time_create'] + $tm_add).'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - $sp = mysql_query('SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "'.$uid.'" ORDER BY `timeUse` DESC'); - while($pl = mysql_fetch_array($sp)) { - mysql_query("UPDATE `eff_users` SET `deactiveTime` = ".(time()+$pl['deactiveLast'])." WHERE `id`='".$pl['id']."' "); - } - $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="'.mysql_real_escape_string($uid).'" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); - while($pl = mysql_fetch_array($sp)) { - $timeUsen = time()-($pl['sleeptime']-$pl['timeUse']); - mysql_query("UPDATE `eff_users` SET `timeUse`='".$timeUsen."',`sleeptime`='0' WHERE `id`='".$pl['id']."' "); - } - mysql_query('UPDATE `actions` SET `vars` = "unsleep",`val` = "'.time().'" WHERE `id` = "'.$sleep['id'].'" LIMIT 1'); - } - //$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$uid.'" LIMIT 1', 1); +function changeSleep($uid, $sleep_action) +{ + $u = User::start(); + if ($sleep_action == 1) { + // + mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time() . '","1")'); + // + mysql_query( + "UPDATE `eff_users` SET `sleeptime`=" . time() . ",`deactiveLast` = ( `deactiveTime` - " . time( + ) . " ) WHERE `uid`='" . mysql_real_escape_string($uid) . "' AND `no_Ace` = 0 AND `delete` = 0" + ); + mysql_query( + 'UPDATE `items_users` SET `time_sleep` = "' . time( + ) . '" WHERE `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"' + ); + $u->addAction(time(), 'sleep', $u->info['city']); + // + } elseif ($sleep_action == 2) { + // + mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time() . '","2")'); + // + $sp = mysql_query( + 'SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"' + ); + while ($pl = mysql_fetch_array($sp)) { + $tm_add = time() - $pl['time_sleep']; + mysql_query( + 'UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "' . ($pl['time_create'] + $tm_add) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } + $sp = mysql_query( + 'SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "' . $uid . '" ORDER BY `timeUse` DESC' + ); + while ($pl = mysql_fetch_array($sp)) { + mysql_query( + "UPDATE `eff_users` SET `deactiveTime` = " . (time( + ) + $pl['deactiveLast']) . " WHERE `id`='" . $pl['id'] . "' " + ); + } + $sp = mysql_query( + 'SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="' . mysql_real_escape_string( + $uid + ) . '" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0' + ); + while ($pl = mysql_fetch_array($sp)) { + $timeUsen = time() - ($pl['sleeptime'] - $pl['timeUse']); + mysql_query( + "UPDATE `eff_users` SET `timeUse`='" . $timeUsen . "',`sleeptime`='0' WHERE `id`='" . $pl['id'] . "' " + ); + } + mysql_query( + 'UPDATE `actions` SET `vars` = "unsleep",`val` = "' . time( + ) . '" WHERE `id` = "' . $sleep['id'] . '" LIMIT 1' + ); + } } //Время рестарта -$cnfg = array( - 'time_restart' => 1, - 'time_puti' => 240 -); +$cnfg = [ + 'time_restart' => 1, + 'time_puti' => 240, +]; echo '#start#'; -define('GAME',true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); +define('GAME', true); +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__magic.php'); +$magic = new Magic(); -$itbs = array( - 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 => 297, - 50 => 485, - 51 => 484, - 52 => 686 - ); -function microLogin2($bus) { - $bus['login_BIG'] = ''; - if( $bus['align'] > 0 ) { - $bus['login_BIG'] .= ''; - } - if( $bus['clan'] > 0 ) { - $bus['login_BIG'] .= ''; - } - $bus['login_BIG'] .= ''.$bus['login'].'['.$bus['level'].']'; - return $bus['login_BIG']; +$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 => 297, + 50 => 485, + 51 => 484, + 52 => 686, +]; +function microLogin2($bus) +{ + $bus['login_BIG'] = ''; + if ($bus['align'] > 0) { + $bus['login_BIG'] .= ''; + } + if ($bus['clan'] > 0) { + $bus['login_BIG'] .= ''; + } + $bus['login_BIG'] .= '' . $bus['login'] . '[' . $bus['level'] . ']'; + return $bus['login_BIG']; } -function addItem($id,$uid,$md = NULL,$dn = NULL,$mxiznos = NULL) { - $rt = -1; - $i = mysql_fetch_array(mysql_query('SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(isset($i['id'])) - { - $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "'.$i['id'].'" LIMIT 1')); - //новая дата - $data = $d['data']; - if($i['ts']>0) - { - $ui = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "'.mysql_real_escape_string($uid).'" LIMIT 1')); - $data .= '|sudba='.$ui['login']; - } - if($md!=NULL) - { - $data .= $md; - } - - - if($dn!=NULL) - { - //предмет с настройками из подземелья - if($dn['del']>0) - { - $i['dn_delete'] = 1; - } - } - if($mxiznos > 0) { - $i['iznosMAXi'] = $mxiznos; - } - $ins = mysql_query('INSERT INTO `items_users` (`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`,`dn_delete`) VALUES ( - "'.$i['overTypei'].'", - "'.$i['id'].'", - "'.$uid.'", - "'.$data.'", - "'.$i['iznosMAXi'].'", - "'.$i['geni'].'", - "'.$i['magic_inci'].'", +function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null) +{ + $rt = -1; + $i = mysql_fetch_array( + mysql_query( + 'SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) + ); + if (isset($i['id'])) { + $d = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1' + ) + ); + //новая дата + $data = $d['data']; + if ($i['ts'] > 0) { + $ui = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login` FROM `users` WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1' + ) + ); + $data .= '|sudba=' . $ui['login']; + } + if ($md != null) { + $data .= $md; + } + + + //предмет с настройками из подземелья + if ($dn != null && $dn['del'] > 0) { + $i['dn_delete'] = 1; + } + if ($mxiznos > 0) { + $i['iznosMAXi'] = $mxiznos; + } + $ins = mysql_query( + 'INSERT INTO `items_users` (`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`,`dn_delete`) VALUES ( + "' . $i['overTypei'] . '", + "' . $i['id'] . '", + "' . $uid . '", + "' . $data . '", + "' . $i['iznosMAXi'] . '", + "' . $i['geni'] . '", + "' . $i['magic_inci'] . '", "capitalcity", - "'.time().'", - "'.time().'", - "'.$i['dn_delete'].'")'); - if($ins) - { - $rt = mysql_insert_id(); - }else{ - $rt = 0; - } - } - return $rt; + "' . time() . '", + "' . time() . '", + "' . $i['dn_delete'] . '")' + ); + if ($ins) { + $rt = mysql_insert_id(); + } else { + $rt = 0; + } + } + return $rt; } -function timeOut($ttm) { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - /* - $tmp = floor($time_still/604800); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - */ - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - return $out; +function timeOut($ttm) +{ + $out = ''; + $time_still = $ttm; + $tmp = floor($time_still / 2592000); + $id = 0; + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мес. "; + } + $time_still = $time_still - $tmp * 2592000; + } + $tmp = floor($time_still / 86400); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " дн. "; + } + $time_still = $time_still - $tmp * 86400; + } + $tmp = floor($time_still / 3600); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " ч. "; + } + $time_still = $time_still - $tmp * 3600; + } + $tmp = floor($time_still / 60); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мин. "; + } + } + if ($out == '') { + if ($time_still < 0) { + $time_still = 0; + } + $out = $time_still . ' сек.'; + } + return $out; } -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("'.mysql_real_escape_string($t).'","capitalcity","","6","1","'.time().'")'); +function e($t) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("' . mysql_real_escape_string( + $t + ) . '","capitalcity","","6","1","' . time() . '")' + ); } -function e2($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("'.mysql_real_escape_string($t).'","capitalcity","Мусорщик","6","1","-1")'); +function e2($t) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("' . mysql_real_escape_string( + $t + ) . '","capitalcity","Мусорщик","6","1","-1")' + ); } //Персонаж 1 нападает на 2 -function bs_atack($bs,$u1,$u2) { - global $magic; - if( isset($u1['id'],$u2['id']) ) { - $btl_id = $magic->atackUser($u1['id'],$u2['id'],$u2['team'],$u2['battle']); - if( $btl_id > 0 ) { - mysql_query('UPDATE `battle` SET `inTurnir` = "'.$bs['id'].'" WHERE `id` = "'.$btl_id.'" LIMIT 1'); - } - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`sex`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "'.$u2['login'].'" AND `inUser` = "'.$u2['id'].'" LIMIT 1')); - if( !isset($usr_real['id']) ) { - $usr_real = $u2; - } - $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`sex`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u1['id'].'" AND `login` = "'.$u1['login'].'" LIMIT 1')); - if( !isset($me_real['id']) ) { - $me_real = $u1; - } - /*if( $u2['battle'] > 0 ) { - $u2['battle'] = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$u2['battle'].'" AND `team_win` = "-1" LIMIT 1')); - if( isset($u2['battle']['id']) ) { - $u2['battle'] = $u2['battle']['id']; - }else{ - $u2['battle'] = 0; - } - }*/ - if( $u2['battle'] > 0 ) { - //Заносим в лог БС - if( $u1['sex'] == 0 ) { - $text = '{u1} вмешался в поединок против {u2} »»'; - }else{ - $text = '{u1} вмешалась в поединок против {u2} »»'; - } - }else{ - //Заносим в лог БС - if( $u1['sex'] == 0 ) { - $text = '{u1} напал на {u2} завязался бой »»'; - }else{ - $text = '{u1} напала на {u2} завязался бой »»'; - } - } - if( isset($usr_real['id'])) { - $usrreal = ''; - if( $usr_real['align'] > 0 ) { - $usrreal .= ''; - } - if( $usr_real['clan'] > 0 ) { - $usrreal .= ''; - } - $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - if( isset($me_real['id']) ) { - $mereal = ''; - if( $me_real['align'] > 0 ) { - $mereal .= ''; - } - if( $me_real['clan'] > 0 ) { - $mereal .= ''; - } - $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; - }else{ - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}',$mereal,$text); - $text = str_replace('{u2}',$usrreal,$text); - //Добавляем в лог БС - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$bs['id'].'", "'.$bs['count'].'", "'.$bs['city'].'", - "'.round($bs['money']*0.85,2).'","'.$i.'" - )'); - } +function bs_atack($bs, $u1, $u2) +{ + global $magic; + if (isset($u1['id'], $u2['id'])) { + $btl_id = $magic->atackUser($u1['id'], $u2['id'], $u2['team'], $u2['battle']); + if ($btl_id > 0) { + mysql_query('UPDATE `battle` SET `inTurnir` = "' . $bs['id'] . '" WHERE `id` = "' . $btl_id . '" LIMIT 1'); + } + $usr_real = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`sex`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $u2['login'] . '" AND `inUser` = "' . $u2['id'] . '" LIMIT 1' + ) + ); + if (!isset($usr_real['id'])) { + $usr_real = $u2; + } + $me_real = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`sex`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $u1['id'] . '" AND `login` = "' . $u1['login'] . '" LIMIT 1' + ) + ); + if (!isset($me_real['id'])) { + $me_real = $u1; + } + if ($u2['battle'] > 0) { + //Заносим в лог БС + if ($u1['sex'] == 0) { + $text = '{u1} вмешался в поединок против {u2} »»'; + } else { + $text = '{u1} вмешалась в поединок против {u2} »»'; + } + } else { + //Заносим в лог БС + if ($u1['sex'] == 0) { + $text = '{u1} напал на {u2} завязался бой »»'; + } else { + $text = '{u1} напала на {u2} завязался бой »»'; + } + } + if (isset($usr_real['id'])) { + $usrreal = ''; + if ($usr_real['align'] > 0) { + $usrreal .= ''; + } + if ($usr_real['clan'] > 0) { + $usrreal .= ''; + } + $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + if (isset($me_real['id'])) { + $mereal = ''; + if ($me_real['align'] > 0) { + $mereal .= ''; + } + if ($me_real['clan'] > 0) { + $mereal .= ''; + } + $mereal .= '' . $me_real['login'] . '[' . $me_real['level'] . ']'; + } else { + $mereal = 'Невидимка[??]'; + } + $text = str_replace('{u1}', $mereal, $text); + $text = str_replace('{u2}', $usrreal, $text); + //Добавляем в лог БС + mysql_query( + 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time( + ) . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", + "' . round($bs['money'] * 0.85, 2) . '","' . $i . '" + )' + ); + } } //Турнир не состоялся -function nostart($pl) { - global $cnfg; - $r = false; - if( $pl['users'] < 4 ) { - //Недостаточно игроков - $r = true; - $pl['time_start'] = time() + $cnfg['time_restart'] * (60*60); - if( $pl['users'] > 0 ) { - e('Турнир Башни Смерти, для '.$pl['to_lvl'].' уровней в Башне Смерти не начался по причине: Недостаточно участников '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).')'); - }else{ - //if( timeOut($pl['time_start']-time()) != '44 мин.' ) { - e('Начало турнира Башни Смерти, для '.$pl['to_lvl'].' уровней в Башне Смерти через '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).'), текущий призовой фонд: 0.00 кр., 1.00 Екр., заявок: 0'); - //} - } - //Возврат вкладов игроков - $sp = mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "'.$pl['id'].'" AND `finish` = "0"'); - while( $pu = mysql_fetch_array($sp) ) { - mysql_query('UPDATE `users` SET `money` = `money` + "'.$pu['money'].'" WHERE `id` = "'.$pu['uid'].'" LIMIT 1'); - mysql_query('UPDATE `bs_zv` SET `finish` = "'.time().'" WHERE `id` = "'.$pu['id'].'" LIMIT 1'); - } - //Обновление турнира - mysql_query('UPDATE `bs_turnirs` SET `ch1` = "0",`ch2` = "0", `status` = "0", `money` = "0", `time_start` = "'.$pl['time_start'].'",`users` = "0",`users_finish` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - return $r; +function nostart($pl) +{ + global $cnfg; + $r = false; + if ($pl['users'] < 4) { + //Недостаточно игроков + $r = true; + $pl['time_start'] = time() + $cnfg['time_restart'] * (60 * 60); + if ($pl['users'] > 0) { + e( + 'Турнир Башни Смерти, для ' . $pl['to_lvl'] . ' уровней в Башне Смерти не начался по причине: Недостаточно участников ' . timeOut( + $pl['time_start'] - time() + ) . ' (' . date('d.m.Y H:i', $pl['time_start']) . ')' + ); + } else { + e( + 'Начало турнира Башни Смерти, для ' . $pl['to_lvl'] . ' уровней в Башне Смерти через ' . timeOut( + $pl['time_start'] - time() + ) . ' (' . date( + 'd.m.Y H:i', $pl['time_start'] + ) . '), текущий призовой фонд: 0.00 кр., 1.00 Екр., заявок: 0' + ); + } + //Возврат вкладов игроков + $sp = mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "' . $pl['id'] . '" AND `finish` = "0"'); + while ($pu = mysql_fetch_array($sp)) { + mysql_query( + 'UPDATE `users` SET `money` = `money` + "' . $pu['money'] . '" WHERE `id` = "' . $pu['uid'] . '" LIMIT 1' + ); + mysql_query('UPDATE `bs_zv` SET `finish` = "' . time() . '" WHERE `id` = "' . $pu['id'] . '" LIMIT 1'); + } + //Обновление турнира + mysql_query( + 'UPDATE `bs_turnirs` SET `ch1` = "0",`ch2` = "0", `status` = "0", `money` = "0", `time_start` = "' . $pl['time_start'] . '",`users` = "0",`users_finish` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } + return $r; } //Добавление "архивариуса" -function add_arhiv($pl,$user) { - $return = 0; - mysql_query('INSERT INTO `users` (`login`,`pass`,`level`,`inTurnir`,`sex`,`obraz`,`name`,`online`,`city`,`room`,`align`,`clan`,`cityreg`,`bithday`,`activ`) VALUES ( - "'.$user['login'].'","bstowerbot","'.$user['level'].'","'.$pl['id'].'","'.$user['sex'].'","'.$user['obraz'].'","'.$user['login'].'","'.(time()+60*60*24).'","'.$user['city'].'","'.$user['room'].'","'.$user['align'].'","'.$user['clan'].'","capitalcity","01.02.2003","0" - )'); - $return = mysql_insert_id(); - if( $return > 0 ) { - $ins = mysql_query('INSERT INTO `stats` (`id`,`stats`,`bot`,`x`,`y`,`upLevel`) VALUES ( - "'.$return.'","s1=30|s2=31|s3=33|s4=30|s5=30|s6=1|s7=25|rinv=40|m9=5|m6=10","2","'.$user['x'].'","'.$user['y'].'","98" - )'); - if(!$ins) { - mysql_query('DELETE FROM `users` WHERE `id` = "'.$return.'" LIMIT 1'); - $return = 0; - } - } - return $return; +function add_arhiv($pl, $user) +{ + $return = 0; + mysql_query( + 'INSERT INTO `users` (`login`,`pass`,`level`,`inTurnir`,`sex`,`obraz`,`name`,`online`,`city`,`room`,`align`,`clan`,`cityreg`,`bithday`,`activ`) VALUES ( + "' . $user['login'] . '","bstowerbot","' . $user['level'] . '","' . $pl['id'] . '","' . $user['sex'] . '","' . $user['obraz'] . '","' . $user['login'] . '","' . (time( + ) + 60 * 60 * 24) . '","' . $user['city'] . '","' . $user['room'] . '","' . $user['align'] . '","' . $user['clan'] . '","capitalcity","01.02.2003","0" + )' + ); + $return = mysql_insert_id(); + if ($return > 0) { + $ins = mysql_query( + 'INSERT INTO `stats` (`id`,`stats`,`bot`,`x`,`y`,`upLevel`) VALUES ( + "' . $return . '","s1=30|s2=31|s3=33|s4=30|s5=30|s6=1|s7=25|rinv=40|m9=5|m6=10","2","' . $user['x'] . '","' . $user['y'] . '","98" + )' + ); + if (!$ins) { + mysql_query('DELETE FROM `users` WHERE `id` = "' . $return . '" LIMIT 1'); + $return = 0; + } + } + return $return; } //Завершаем текущий турнир -function backusers($pl) { - $sp = mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "'.$pl['id'].'" AND `off` = "0" AND `inBot` > 0'); - while( $pu = mysql_fetch_array($sp) ) { - //Удаление клона - mysql_query('DELETE FROM `users` WHERE `id` = "'.$pu['inBot'].'" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pu['inBot'].'" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pu['inBot'].'"'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pu['inBot'].'"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pu['inBot'].'"'); - mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$pu['inBot'].'"'); - //Обновление персонажа - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "'.$pu['uid'].'" LIMIT 1'); - //Обновляем заявку - mysql_query('UPDATE `bs_zv` SET `off` = "'.time().'" WHERE `id` = "'.$pu['id'].'" LIMIT 1'); - } - //Архивариусы - $sp = mysql_query('SELECT * FROM `users` WHERE `pass` = "bstowerbot" AND `inTurnir` = "'.$pl['id'].'" AND `room` = "362"'); - while( $pu = mysql_fetch_array($sp) ) { - mysql_query('DELETE FROM `users` WHERE `id` = "'.$pu['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pu['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pu['id'].'"'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pu['id'].'"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pu['id'].'"'); - mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$pu['id'].'"'); - } - //Удаляем предметы раскиданные по БС - mysql_query('DELETE FROM `bs_items` WHERE `bid` = "'.$pl['id'].'" AND `count` = "'.$pl['count'].'"'); - //Удаляем события в БС - mysql_query('DELETE FROM `bs_actions` WHERE `bid` = "'.$pl['id'].'" AND `count` = "'.$pl['count'].'"'); - //Удаляем ловушки в БС - mysql_query('DELETE FROM `bs_trap` WHERE `bid` = "'.$pl['id'].'" AND `count` = "'.$pl['count'].'"'); +function backusers($pl) +{ + $sp = mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "' . $pl['id'] . '" AND `off` = "0" AND `inBot` > 0'); + while ($pu = mysql_fetch_array($sp)) { + //Удаление клона + mysql_query('DELETE FROM `users` WHERE `id` = "' . $pu['inBot'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pu['inBot'] . '" LIMIT 1'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $pu['inBot'] . '"'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pu['inBot'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pu['inBot'] . '"'); + mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $pu['inBot'] . '"'); + //Обновление персонажа + mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pu['uid'] . '" LIMIT 1'); + //Обновляем заявку + mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `id` = "' . $pu['id'] . '" LIMIT 1'); + } + //Архивариусы + $sp = mysql_query( + 'SELECT * FROM `users` WHERE `pass` = "bstowerbot" AND `inTurnir` = "' . $pl['id'] . '" AND `room` = "362"' + ); + while ($pu = mysql_fetch_array($sp)) { + mysql_query('DELETE FROM `users` WHERE `id` = "' . $pu['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pu['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $pu['id'] . '"'); + mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pu['id'] . '"'); + mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pu['id'] . '"'); + mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $pu['id'] . '"'); + } + //Удаляем предметы раскиданные по БС + mysql_query('DELETE FROM `bs_items` WHERE `bid` = "' . $pl['id'] . '" AND `count` = "' . $pl['count'] . '"'); + //Удаляем события в БС + mysql_query('DELETE FROM `bs_actions` WHERE `bid` = "' . $pl['id'] . '" AND `count` = "' . $pl['count'] . '"'); + //Удаляем ловушки в БС + mysql_query('DELETE FROM `bs_trap` WHERE `bid` = "' . $pl['id'] . '" AND `count` = "' . $pl['count'] . '"'); } -$exp2 = array( - 1=>30000, - 2=>300000 -); -$st2s = array( - 7=>array( - 0=>10, - 1=>64, - 2=>8 - ), - 8=>array( - 0=>11, - 1=>78, - 2=>9 - ) -); +$exp2 = [ + 1 => 30000, + 2 => 300000, +]; +$st2s = [ + 7 => [ + 0 => 10, + 1 => 64, + 2 => 8, + ], + 8 => [ + 0 => 11, + 1 => 78, + 2 => 9, + ], +]; $sp = mysql_query('SELECT * FROM `bs_turnirs`'); -while( $pl = mysql_fetch_array($sp) ) { - // - $pl['to_lvl'] = $pl['level']; - if( $pl['level'] != $pl['level_max'] ) { - $pl['to_lvl'] .= '-'.$pl['level_max'].''; - } - $pl['to_lvl'] = 'всех'; - if( $pl['status'] == 1 ) { - // - $tcu = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `inTurnir` = "'.$pl['id'].'" AND `room` = "362"')); - $tcu = $tcu[0]; - // - if( $pl['users'] != $tcu ) { - //Что-то сбилось - $pl['users'] = $tcu; - } - // - //Турнир идет, проверяем живых игроков, либо завершаем через 6 часов - if( $pl['time_start'] < time() - 6*60*60 ) { - //Завершаем турнир по тайму - //Добавляем в лог БС - $text = 'Турнир завершен. Победитель: Отсутствует (Турнир завершился по таймауту). Призовой фонд: '.round($pl['money']*0.85,2).' кр.'; - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$pl['id'].'", "'.$pl['count'].'", "'.$pl['city'].'", - "'.round($pl['money']*0.85,2).'","'.$i.'" - )'); - // - //Сохраняем статистику - mysql_query('INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`) VALUES ( - "'.$pl['id'].'","'.$pl['count'].'","'.$pl['time_start'].'","'.time().'","'.(time()-$pl['time_start']).'","'.$pl['type_btl'].'","'.round($pl['money']*0.85,2).'", +while ($pl = mysql_fetch_array($sp)) { + // + $pl['to_lvl'] = $pl['level']; + if ($pl['level'] != $pl['level_max']) { + $pl['to_lvl'] .= '-' . $pl['level_max'] . ''; + } + $pl['to_lvl'] = 'всех'; + if ($pl['status'] == 1) { + // + $tcu = mysql_fetch_array( + mysql_query('SELECT COUNT(*) FROM `users` WHERE `inTurnir` = "' . $pl['id'] . '" AND `room` = "362"') + ); + $tcu = $tcu[0]; + // + if ($pl['users'] != $tcu) { + //Что-то сбилось + $pl['users'] = $tcu; + } + // + //Турнир идет, проверяем живых игроков, либо завершаем через 6 часов + if ($pl['time_start'] < time() - 6 * 60 * 60) { + //Завершаем турнир по тайму + //Добавляем в лог БС + $text = 'Турнир завершен. Победитель: Отсутствует (Турнир завершился по таймауту). Призовой фонд: ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр.'; + mysql_query( + 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time( + ) . '", "' . $pl['id'] . '", "' . $pl['count'] . '", "' . $pl['city'] . '", + "' . round($pl['money'] * 0.85, 2) . '","' . $i . '" + )' + ); + // + //Сохраняем статистику + mysql_query( + 'INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`) VALUES ( + "' . $pl['id'] . '","' . $pl['count'] . '","' . $pl['time_start'] . '","' . time() . '","' . (time( + ) - $pl['time_start']) . '","' . $pl['type_btl'] . '","' . round($pl['money'] * 0.85, 2) . '", "2","0","0","0" - )'); - $pl['time_start'] = time() + $cnfg['time_restart'] * (60*60); - e('Турнир для '.$pl['to_lvl'].' уровней в Башне Смерти завершился по таймауту. Начало нового турнира через '.timeOut($pl['time_start']-time()-3600).' ('.date('d.m.Y H:i',$pl['time_start']).')'); - backusers($pl); - $pl['count']++; - mysql_query('UPDATE `bs_turnirs` SET `money` = "0",`count` = "'.$pl['count'].'",`status` = "0",`time_start` = "'.$pl['time_start'].'",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users` SET `online` = "'.(time()+60*60*6).'" WHERE `inTurnir` = "'.$pl['id'].'" OR (`room` >= 362 AND `room` <= 366) LIMIT '.($pl['users']+$pl['arhiv'])); - //Проверяем живых игроков - if( $pl['users'] < 2 ) { - mysql_query('DELEE FROM `users` WHERE `login` LIKE "%(клон%" AND `inTurnir` = "'.$pl['id'].'" AND `room` = "362"'); - if( $pl['users'] == 1 ) { - $pl['usersn'] = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `inTurnir` = "'.$pl['id'].'" AND `room` = "362" LIMIT 1')); - $pl['usersn'] = $pl['usersn'][0]; - if( $pl['users'] != $pl['usersn'] ) { - //$pl['users'] = $pl['usersn']; - } - } - //Доп. проверка живых - if( $pl['users'] == 1 ) { - //Завершаем турнир, есть 1 победитель - if( $pl['arhiv'] == 0 ) { - //Архивариуса нет, завершаем турнир - $uwin_bot = mysql_fetch_array(mysql_query('SELECT `id`,`money`,`login`,`level`,`align`,`clan` FROM `users` WHERE `inTurnir` = "'.$pl['id'].'" AND `room` = "362" LIMIT 1')); - $swin_bot = mysql_fetch_array(mysql_query('SELECT `id`,`exp` FROM `stats` WHERE `id` = "'.$uwin_bot['id'].'" LIMIT 1')); - $uwin = mysql_fetch_array(mysql_query('SELECT `id`,`money`,`money2`,`login`,`level`,`align`,`clan` FROM `users` WHERE `inUser` = "'.$uwin_bot['id'].'" LIMIT 1')); - $swin = mysql_fetch_array(mysql_query('SELECT `id`,`exp` FROM `stats` WHERE `id` = "'.$uwin['id'].'" LIMIT 1')); - - //Опыт - $swin_bot['exp'] -= 30000; - $swin_bot['exp'] = round($swin_bot['exp']/2); - if( $swin_bot['exp'] < 0 ) { - $swin_bot['exp'] = 0; - } - $swin_bot['exp'] += 1500; - - //Сохраняем статистику - mysql_query('INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`,`wlevel`) VALUES ( - "'.$pl['id'].'","'.$pl['count'].'","'.$pl['time_start'].'","'.time().'","'.(time()-$pl['time_start']).'","'.$pl['type_btl'].'","'.round($pl['money']*0.85,2).'", - "'.$uwin['login'].'","'.$uwin['id'].'","'.$uwin['align'].'","'.$uwin['clan'].'","'.$uwin['level'].'" - )'); - $pl['time_start'] = time() + $cnfg['time_restart'] * (60*60); - if( isset($uwin['id']) ) { - mysql_query('UPDATE `users` SET `money` = "'.($uwin['money']+round($pl['money']*0.85,2)).'", `money2` = "'.($uwin['money2']+1).'", `win_bs` = IFNULL(`win_bs`, 0) + 1 WHERE `login` = "'.$uwin['login'].'"'); - mysql_query('UPDATE `stats` SET `exp` = "'.($swin['exp']+$swin_bot['exp']).'" WHERE `id` = "'.$uwin['id'].'" LIMIT 1'); - e('#'.$pl['usersn'].' Турнир для '.$pl['to_lvl'].' уровней в Башне Смерти завершился. Победитель: '.microLogin2($uwin).'. Приз: '.round($pl['money']*0.85,2).' кр. и 1 екр.'.round($swin_bot['exp']).' опыта. Начало нового турнира через '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).')'); - if(date('w') == 0 || date('w') == 6 || date('w') == 3) { - mysql_query('UPDATE `stats` SET `repexp` = `repexp` + 25 WHERE `id` = "'.$uwin['id'].'" LIMIT 1'); - } - else - { - mysql_query('UPDATE `stats` SET `repexp` = `repexp` + 10 WHERE `id` = "'.$uwin['id'].'" LIMIT 1'); - } - } - //Добавляем в лог БС - $text = 'Турнир завершен. Победитель: '.microLogin2($uwin).'. Приз: '.round($pl['money']*0.85,2).' кр. и 1 екр.'.round($swin_bot['exp']).' опыта.'; - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$pl['id'].'", "'.$pl['count'].'", "'.$pl['city'].'", - "'.round($pl['money']*0.85,2).'","'.$i.'" - )'); - // - backusers($pl); - $pl['count']++; - mysql_query('UPDATE `bs_turnirs` SET `money` = "0",`count` = "'.$pl['count'].'",`status` = "0",`time_start` = "'.$pl['time_start'].'",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - }else{ - //Ожидаем пока игрок убьет Архивариуса - - } - }else{ - //Сохраняем статистику - mysql_query('INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`) VALUES ( - "'.$pl['id'].'","'.$pl['count'].'","'.$pl['time_start'].'","'.time().'","'.(time()-$pl['time_start']).'","'.$pl['type_btl'].'","'.round($pl['money']*0.85,2).'", + )' + ); + $pl['time_start'] = time() + $cnfg['time_restart'] * (60 * 60); + e( + 'Турнир для ' . $pl['to_lvl'] . ' уровней в Башне Смерти завершился по таймауту. Начало нового турнира через ' . timeOut( + $pl['time_start'] - time() - 3600 + ) . ' (' . date('d.m.Y H:i', $pl['time_start']) . ')' + ); + backusers($pl); + $pl['count']++; + mysql_query( + 'UPDATE `bs_turnirs` SET `money` = "0",`count` = "' . $pl['count'] . '",`status` = "0",`time_start` = "' . $pl['time_start'] . '",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } else { + mysql_query( + 'UPDATE `users` SET `online` = "' . (time( + ) + 60 * 60 * 6) . '" WHERE `inTurnir` = "' . $pl['id'] . '" OR (`room` >= 362 AND `room` <= 366) LIMIT ' . ($pl['users'] + $pl['arhiv']) + ); + //Проверяем живых игроков + if ($pl['users'] < 2) { + mysql_query( + 'DELEE FROM `users` WHERE `login` LIKE "%(клон%" AND `inTurnir` = "' . $pl['id'] . '" AND `room` = "362"' + ); + if ($pl['users'] == 1) { + $pl['usersn'] = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `users` WHERE `inTurnir` = "' . $pl['id'] . '" AND `room` = "362" LIMIT 1' + ) + ); + $pl['usersn'] = $pl['usersn'][0]; + if ($pl['users'] != $pl['usersn']) { + //$pl['users'] = $pl['usersn']; + } + } + //Доп. проверка живых + if ($pl['users'] == 1) { + //Завершаем турнир, есть 1 победитель + if ($pl['arhiv'] == 0) { + //Архивариуса нет, завершаем турнир + $uwin_bot = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`money`,`login`,`level`,`align`,`clan` FROM `users` WHERE `inTurnir` = "' . $pl['id'] . '" AND `room` = "362" LIMIT 1' + ) + ); + $swin_bot = mysql_fetch_array( + mysql_query('SELECT `id`,`exp` FROM `stats` WHERE `id` = "' . $uwin_bot['id'] . '" LIMIT 1') + ); + $uwin = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`money`,`money2`,`login`,`level`,`align`,`clan` FROM `users` WHERE `inUser` = "' . $uwin_bot['id'] . '" LIMIT 1' + ) + ); + $swin = mysql_fetch_array( + mysql_query('SELECT `id`,`exp` FROM `stats` WHERE `id` = "' . $uwin['id'] . '" LIMIT 1') + ); + + //Опыт + $swin_bot['exp'] -= 30000; + $swin_bot['exp'] = round($swin_bot['exp'] / 2); + if ($swin_bot['exp'] < 0) { + $swin_bot['exp'] = 0; + } + $swin_bot['exp'] += 1500; + + //Сохраняем статистику + mysql_query( + 'INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`,`wlevel`) VALUES ( + "' . $pl['id'] . '","' . $pl['count'] . '","' . $pl['time_start'] . '","' . time( + ) . '","' . (time() - $pl['time_start']) . '","' . $pl['type_btl'] . '","' . round( + $pl['money'] * 0.85, 2 + ) . '", + "' . $uwin['login'] . '","' . $uwin['id'] . '","' . $uwin['align'] . '","' . $uwin['clan'] . '","' . $uwin['level'] . '" + )' + ); + $pl['time_start'] = time() + $cnfg['time_restart'] * (60 * 60); + if (isset($uwin['id'])) { + mysql_query( + 'UPDATE `users` SET `money` = "' . ($uwin['money'] + round( + $pl['money'] * 0.85, 2 + )) . '", `money2` = "' . ($uwin['money2'] + 1) . '", `win_bs` = IFNULL(`win_bs`, 0) + 1 WHERE `login` = "' . $uwin['login'] . '"' + ); + mysql_query( + 'UPDATE `stats` SET `exp` = "' . ($swin['exp'] + $swin_bot['exp']) . '" WHERE `id` = "' . $uwin['id'] . '" LIMIT 1' + ); + e( + '#' . $pl['usersn'] . ' Турнир для ' . $pl['to_lvl'] . ' уровней в Башне Смерти завершился. Победитель: ' . microLogin2( + $uwin + ) . '. Приз: ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр. и 1 екр.' . round( + $swin_bot['exp'] + ) . ' опыта. Начало нового турнира через ' . timeOut( + $pl['time_start'] - time() + ) . ' (' . date('d.m.Y H:i', $pl['time_start']) . ')' + ); + if (date('w') == 0 || date('w') == 6 || date('w') == 3) { + mysql_query( + 'UPDATE `stats` SET `repexp` = `repexp` + 25 WHERE `id` = "' . $uwin['id'] . '" LIMIT 1' + ); + } else { + mysql_query( + 'UPDATE `stats` SET `repexp` = `repexp` + 10 WHERE `id` = "' . $uwin['id'] . '" LIMIT 1' + ); + } + } + //Добавляем в лог БС + $text = 'Турнир завершен. Победитель: ' . microLogin2($uwin) . '. Приз: ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр. и 1 екр.' . round($swin_bot['exp']) . ' опыта.'; + mysql_query( + 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time( + ) . '", "' . $pl['id'] . '", "' . $pl['count'] . '", "' . $pl['city'] . '", + "' . round($pl['money'] * 0.85, 2) . '","' . $i . '" + )' + ); + // + backusers($pl); + $pl['count']++; + mysql_query( + 'UPDATE `bs_turnirs` SET `money` = "0",`count` = "' . $pl['count'] . '",`status` = "0",`time_start` = "' . $pl['time_start'] . '",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } else { + //Ожидаем пока игрок убьет Архивариуса + + } + } else { + //Сохраняем статистику + mysql_query( + 'INSERT INTO `bs_statistic` (`bsid`,`count`,`time_start`,`time_finish`,`time_sf`,`type_bs`,`money`,`wlogin`,`wuid`,`walign`,`wclan`) VALUES ( + "' . $pl['id'] . '","' . $pl['count'] . '","' . $pl['time_start'] . '","' . time( + ) . '","' . (time() - $pl['time_start']) . '","' . $pl['type_btl'] . '","' . round( + $pl['money'] * 0.85, 2 + ) . '", "1","0","0","0" - )'); - //Просто завершаем турнир, ничья - $pl['time_start'] = time() + $cnfg['time_restart'] * (60*60); - //Добавляем в лог БС - $text = 'Турнир завершен. Победитель: Отсутствует (Никто не остался в живых). Призовой фонд: '.round($pl['money']*0.85,2).' кр.'; - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$pl['id'].'", "'.$pl['count'].'", "'.$pl['city'].'", - "'.round($pl['money']*0.85,2).'","'.$i.'" - )'); - // - backusers($pl); - $pl['count']++; - e('Турнир для '.$pl['to_lvl'].' уровней в Башне Смерти завершился. Победитель: Отсутствует (Никто не остался в живых). Призовой фонд '.round($pl['money']*0.85,2).' кр. Начало нового турнира через '.timeOut($pl['time_start']-time()-3600).' ('.date('d.m.Y H:i',$pl['time_start']).')'); - mysql_query('UPDATE `bs_turnirs` SET `money` = "'.round($pl['money']*0.85,2).'",`count` = "'.$pl['count'].'",`status` = "0",`time_start` = "'.$pl['time_start'].'",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - }else{ - //Все живы - if( $pl['arhiv'] > 0 ) { - $a_sp = mysql_query('SELECT `s`.`timeGo`,`u`.`align`,`u`.`clan`,`u`.`sex`,`u`.`pass`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`battle`,`s`.`x`,`s`.`y` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`pass` = "bstowerbot" AND `u`.`inTurnir` = "'.mysql_real_escape_string($pl['id']).'" AND `u`.`room` = "362" LIMIT 10'); - while( $a_pl = mysql_fetch_array($a_sp) ) { - $xy = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `x` = "'.$a_pl['x'].'" AND `y` = "'.$a_pl['y'].'" LIMIT 1')); - if( isset($xy['id']) ) { - if( $a_pl['battle'] == 0 ) { - //Поднимаем предметы - $sp_itm = mysql_query('SELECT * FROM `bs_items` WHERE `x` = "'.$a_pl['x'].'" AND `y` = "'.$a_pl['y'].'" AND `bid` = "'.$pl['id'].'" AND `count` = "'.$pl['count'].'" LIMIT 20'); - while( $pl_itm = mysql_fetch_array( $sp_itm ) ) { - if( rand(0,100) < 21 ) { - //Поднимаем текущий предмет - $itm_id = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$pl_itm['item_id'].'" LIMIT 1')); - if( isset($itm_id['id']) ) { - $itm_id['odevaem'] = addItem($itm_id['id'],$a_pl['id']); - mysql_query('DELETE FROM `bs_items` WHERE `id` = "'.$pl_itm['id'].'" LIMIT 1'); - if( $itm_id['level'] <= $a_pl['level'] && $itm_id['odevaem'] > 0 ) { - //надеваем - if( $itm_id['inslot'] == 10 ) { - $itm_id['inslot'] = rand(10,12); - } - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `inOdet` = "'.$itm_id['inslot'].'" AND `uid` = "'.$a_pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `inOdet` = "'.$itm_id['inslot'].'" WHERE `id` = "'.$itm_id['odevaem'].'" LIMIT 1'); - } - } - } - } - unset($itm_id,$sp_itm,$pl_itm); - //Нападаем/Вмешиваемся в поединок - if( $pl['time_start'] < time() - $cnfg['time_puti'] ) { - $sp_usr = mysql_query('SELECT `u`.`id`,`u`.`battle`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`sex`,`s`.`team` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`x` = "'.$a_pl['x'].'" AND `u`.`pass` != "'.$a_pl['pass'].'" AND `s`.`y` = "'.$a_pl['y'].'" ORDER BY `s`.`timeGo` ASC LIMIT 5'); - while( $pl_usr = mysql_fetch_array($sp_usr) ) { - if( rand(0,100) < 31 && $a_pl['battle'] == 0 ) { - $pl_usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`sex`,`login`,`level`,`clan`,`align`,`battle` FROM `users` WHERE `inUser` = "'.$pl_usr['id'].'" LIMIT 1')); - if( isset($pl_usr_real['id']) ) { - mysql_query('UPDATE `stats` SET `hpNow` = `hpNow` + 10 WHERE `id` = "'.$a_pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = `hpNow` + 10 WHERE `id` = "'.$pl_usr['id'].'" LIMIT 1'); - bs_atack($pl,$a_pl,$pl_usr); - $a_pl['battle'] = 1; - } - } - } - unset($sp_usr,$pl_usr); - - if( $a_pl['battle'] == 0 && rand(0,100) < 71 && $a_pl['timeGo'] < time()) { - //Передвигаемся - $stor = array(); - if( $xy['up'] > 0 ) { - $stor[] = 'up'; - } - if( $xy['down'] > 0 ) { - $stor[] = 'down'; - } - if( $xy['left'] > 0 ) { - $stor[] = 'left'; - } - if( $xy['right'] > 0 ) { - $stor[] = 'right'; - } - $stor = $stor[rand(0,count($stor)-1)]; - if( $stor == 'up' ) { - $stgo = $xy[$stor]; - }elseif( $stor == 'down' ) { - $stgo = $xy[$stor]; - }elseif( $stor == 'left' ) { - $stgo = $xy[$stor]; - }elseif( $stor == 'right' ) { - $stgo = $xy[$stor]; - } - if( $stgo == 1 ) { - if( $stor == 'up' ) { - $a_pl['x']--; - }elseif( $stor == 'down' ) { - $a_pl['x']++; - }elseif( $stor == 'left' ) { - $a_pl['y']--; - }elseif( $stor == 'right' ) { - $a_pl['y']++; - } - }else{ - $stgo = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `id` = "'.$stgo.'" LIMIT 1')); - if( isset($stgo['id']) ) { - $a_pl['x'] = $stgo['x']; - $a_pl['y'] = $stgo['y']; - } - } - mysql_query('UPDATE `stats` SET `x` = "'.$a_pl['x'].'",`y` = "'.$a_pl['y'].'" WHERE `id` = "'.$a_pl['id'].'" LIMIT 1'); - unset($stor,$stgo); - } - } - - }else{ - //Сражаемся - - } - } - } - } - } - } - }elseif( $pl['status'] == 0 && $pl['time_start'] < time() ) { - //Начинаем турнир - if( nostart( $pl ) == false ) { - - //Начинаем турнир! - $spm = mysql_query('SELECT `x`,`y` FROM `bs_map` WHERE `mid` = "'.$pl['type_map'].'"'); - $maps = array( ); - while( $plm = mysql_fetch_array($spm) ) { - $maps[] = array($plm['x'],$plm['y']); - } - $i = 0; $j = 0; $usrlst = array(); - $ubss = ''; - $sp_u = mysql_query('SELECT * FROM `bs_zv` WHERE `finish` = "0" AND `bsid` = "'.$pl['id'].'" ORDER BY `money` DESC LIMIT 12'); - // - //Создаем поход - mysql_query('INSERT INTO `dungeon_now` ( + )' + ); + //Просто завершаем турнир, ничья + $pl['time_start'] = time() + $cnfg['time_restart'] * (60 * 60); + //Добавляем в лог БС + $text = 'Турнир завершен. Победитель: Отсутствует (Никто не остался в живых). Призовой фонд: ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр.'; + mysql_query( + 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time( + ) . '", "' . $pl['id'] . '", "' . $pl['count'] . '", "' . $pl['city'] . '", + "' . round($pl['money'] * 0.85, 2) . '","' . $i . '" + )' + ); + // + backusers($pl); + $pl['count']++; + e( + 'Турнир для ' . $pl['to_lvl'] . ' уровней в Башне Смерти завершился. Победитель: Отсутствует (Никто не остался в живых). Призовой фонд ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр. Начало нового турнира через ' . timeOut( + $pl['time_start'] - time() - 3600 + ) . ' (' . date('d.m.Y H:i', $pl['time_start']) . ')' + ); + mysql_query( + 'UPDATE `bs_turnirs` SET `money` = "' . round( + $pl['money'] * 0.85, 2 + ) . '",`count` = "' . $pl['count'] . '",`status` = "0",`time_start` = "' . $pl['time_start'] . '",`users` = "0",`users_finish` = "0",`ch1` = "0",`arhiv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } + } else { + //Все живы + if ($pl['arhiv'] > 0) { + $a_sp = mysql_query( + 'SELECT `s`.`timeGo`,`u`.`align`,`u`.`clan`,`u`.`sex`,`u`.`pass`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`battle`,`s`.`x`,`s`.`y` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`pass` = "bstowerbot" AND `u`.`inTurnir` = "' . mysql_real_escape_string( + $pl['id'] + ) . '" AND `u`.`room` = "362" LIMIT 10' + ); + while ($a_pl = mysql_fetch_array($a_sp)) { + $xy = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `bs_map` WHERE `x` = "' . $a_pl['x'] . '" AND `y` = "' . $a_pl['y'] . '" LIMIT 1' + ) + ); + if (isset($xy['id'])) { + if ($a_pl['battle'] == 0) { + //Поднимаем предметы + $sp_itm = mysql_query( + 'SELECT * FROM `bs_items` WHERE `x` = "' . $a_pl['x'] . '" AND `y` = "' . $a_pl['y'] . '" AND `bid` = "' . $pl['id'] . '" AND `count` = "' . $pl['count'] . '" LIMIT 20' + ); + while ($pl_itm = mysql_fetch_array($sp_itm)) { + if (rand(0, 100) < 21) { + //Поднимаем текущий предмет + $itm_id = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `items_main` WHERE `id` = "' . $pl_itm['item_id'] . '" LIMIT 1' + ) + ); + if (isset($itm_id['id'])) { + $itm_id['odevaem'] = addItem($itm_id['id'], $a_pl['id']); + mysql_query( + 'DELETE FROM `bs_items` WHERE `id` = "' . $pl_itm['id'] . '" LIMIT 1' + ); + if ($itm_id['level'] <= $a_pl['level'] && $itm_id['odevaem'] > 0) { + //надеваем + if ($itm_id['inslot'] == 10) { + $itm_id['inslot'] = rand(10, 12); + } + mysql_query( + 'UPDATE `items_users` SET `inOdet` = "0" WHERE `inOdet` = "' . $itm_id['inslot'] . '" AND `uid` = "' . $a_pl['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `items_users` SET `inOdet` = "' . $itm_id['inslot'] . '" WHERE `id` = "' . $itm_id['odevaem'] . '" LIMIT 1' + ); + } + } + } + } + unset($itm_id, $sp_itm, $pl_itm); + //Нападаем/Вмешиваемся в поединок + if ($pl['time_start'] < time() - $cnfg['time_puti']) { + $sp_usr = mysql_query( + 'SELECT `u`.`id`,`u`.`battle`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`sex`,`s`.`team` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`x` = "' . $a_pl['x'] . '" AND `u`.`pass` != "' . $a_pl['pass'] . '" AND `s`.`y` = "' . $a_pl['y'] . '" ORDER BY `s`.`timeGo` ASC LIMIT 5' + ); + while ($pl_usr = mysql_fetch_array($sp_usr)) { + if (rand(0, 100) < 31 && $a_pl['battle'] == 0) { + $pl_usr_real = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`sex`,`login`,`level`,`clan`,`align`,`battle` FROM `users` WHERE `inUser` = "' . $pl_usr['id'] . '" LIMIT 1' + ) + ); + if (isset($pl_usr_real['id'])) { + mysql_query( + 'UPDATE `stats` SET `hpNow` = `hpNow` + 10 WHERE `id` = "' . $a_pl['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `stats` SET `hpNow` = `hpNow` + 10 WHERE `id` = "' . $pl_usr['id'] . '" LIMIT 1' + ); + bs_atack($pl, $a_pl, $pl_usr); + $a_pl['battle'] = 1; + } + } + } + unset($sp_usr, $pl_usr); + + if ($a_pl['battle'] == 0 && rand(0, 100) < 71 && $a_pl['timeGo'] < time()) { + //Передвигаемся + $stor = []; + if ($xy['up'] > 0) { + $stor[] = 'up'; + } + if ($xy['down'] > 0) { + $stor[] = 'down'; + } + if ($xy['left'] > 0) { + $stor[] = 'left'; + } + if ($xy['right'] > 0) { + $stor[] = 'right'; + } + $stor = $stor[rand(0, count($stor) - 1)]; + if ($stor == 'up') { + $stgo = $xy[$stor]; + } elseif ($stor == 'down') { + $stgo = $xy[$stor]; + } elseif ($stor == 'left') { + $stgo = $xy[$stor]; + } elseif ($stor == 'right') { + $stgo = $xy[$stor]; + } + if ($stgo == 1) { + if ($stor == 'up') { + $a_pl['x']--; + } elseif ($stor == 'down') { + $a_pl['x']++; + } elseif ($stor == 'left') { + $a_pl['y']--; + } elseif ($stor == 'right') { + $a_pl['y']++; + } + } else { + $stgo = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `bs_map` WHERE `id` = "' . $stgo . '" LIMIT 1' + ) + ); + if (isset($stgo['id'])) { + $a_pl['x'] = $stgo['x']; + $a_pl['y'] = $stgo['y']; + } + } + mysql_query( + 'UPDATE `stats` SET `x` = "' . $a_pl['x'] . '",`y` = "' . $a_pl['y'] . '" WHERE `id` = "' . $a_pl['id'] . '" LIMIT 1' + ); + unset($stor, $stgo); + } + } + + } else { + //Сражаемся + + } + } + } + } + } + } + } elseif ($pl['status'] == 0 && $pl['time_start'] < time()) { + //Начинаем турнир + if (nostart($pl) == false) { + + //Начинаем турнир! + $spm = mysql_query('SELECT `x`,`y` FROM `bs_map` WHERE `mid` = "' . $pl['type_map'] . '"'); + $maps = []; + while ($plm = mysql_fetch_array($spm)) { + $maps[] = [$plm['x'], $plm['y']]; + } + $i = 0; + $j = 0; + $usrlst = []; + $ubss = ''; + $sp_u = mysql_query( + 'SELECT * FROM `bs_zv` WHERE `finish` = "0" AND `bsid` = "' . $pl['id'] . '" ORDER BY `money` DESC LIMIT 12' + ); + // + //Создаем поход + mysql_query( + 'INSERT INTO `dungeon_now` ( `id2` , `name` , `time_start` , `time_finish` , `uid` , `city` , `type` , `bsid` ) VALUES ( - "6" , "Башня Смерти" , "'.$pl['time_start'].'" , "0" , "0" , "'.$pl['city'].'" , "0" , "'.$pl['id'].'" - )'); - $dnew = mysql_insert_id(); - //Добавляем обьекты + "6" , "Башня Смерти" , "' . $pl['time_start'] . '" , "0" , "0" , "' . $pl['city'] . '" , "0" , "' . $pl['id'] . '" + )' + ); + $dnew = mysql_insert_id(); + //Добавляем обьекты $vls32 = ''; $sphj = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "6"'); - while($plhj = mysql_fetch_array($sphj)) - { - $vls32 .= '("'.$dnew.'","'.$plhj['name'].'","'.$plhj['img'].'","'.$plhj['x'].'","'.$plhj['y'].'","'.$plhj['action'].'","'.$plhj['type'].'","'.$plhj['w'].'","'.$plhj['h'].'","'.$plhj['s'].'","'.$plhj['s2'].'","'.$plhj['os1'].'","'.$plhj['os2'].'","'.$plhj['os3'].'","'.$plhj['os4'].'","'.$plhj['type2'].'","'.$plhj['top'].'","'.$plhj['left'].'","'.$plhj['date'].'"),'; + while ($plhj = mysql_fetch_array($sphj)) { + $vls32 .= '("' . $dnew . '","' . $plhj['name'] . '","' . $plhj['img'] . '","' . $plhj['x'] . '","' . $plhj['y'] . '","' . $plhj['action'] . '","' . $plhj['type'] . '","' . $plhj['w'] . '","' . $plhj['h'] . '","' . $plhj['s'] . '","' . $plhj['s2'] . '","' . $plhj['os1'] . '","' . $plhj['os2'] . '","' . $plhj['os3'] . '","' . $plhj['os4'] . '","' . $plhj['type2'] . '","' . $plhj['top'] . '","' . $plhj['left'] . '","' . $plhj['date'] . '"),'; } - $vls32 = rtrim($vls32,','); - if($vls32!='') - { - $ins232 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES '.$vls32.''); + $vls32 = rtrim($vls32, ','); + if ($vls32 != '') { + $ins232 = mysql_query( + 'INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES ' . $vls32 . '' + ); } - unset($vls32,$ins232); - //Добавляем предметы - $map = array(); - $mapsp = mysql_query('SELECT `x`,`y` FROM `dungeon_map` WHERE `id_dng` = 6'); - while( $mappl = mysql_fetch_array($mapsp) ) { - $map[] = array( 'x' => $mappl['x'] , 'y' => $mappl['y'] ); - } - $mapu = $map; - // - $ii1 = 0; - while($ii1 < count($map)) { - //На каждой клетке в среднем 2 предмета - $itbsrnd = $itbs[rand(0,count($itbs)-1)]; - $mp = rand(0,count($map)-1); - // - $x1 = $map[$mp]['x']; - $y1 = $map[$mp]['y']; - // - mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( - "'.$dnew.'","'.$itbsrnd.'","'.(time()-600).'","'.$x1.'","'.$y1.'" - )'); - // - $ii1++; - } - - //Добавляем чеки на кр. и на екр. на карту - $m1 = $maps[rand(0,count($maps)-1)]; - $x1 = round($m1[0]); - $y1 = round($m1[1]); - //$itm1 = array( 4174 , 4175 , 4176 , 4177 , 4178 , 4179 , 4180 ); //Перечисление кр. чеков - $itm1 = array( 4176 , 4177 ); //Перечисление кр. чеков - $itm1 = $itm1[rand(0,count($itm1)-1)]; - if( $itm1 > 0 ) { - // - $mp = rand(0,count($map)-1); - // - $x1 = $map[$mp]['x']; - $y1 = $map[$mp]['y']; - // - mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( - "'.$dnew.'","'.$itm1.'","'.(time()-600).'","'.$x1.'","'.$y1.'" - )'); - // - } - - //Добавляем монстров (Архивариусов) - /*$vls0 = ''; - $zi1 = 0; - $id_bots = array(159,160,161); - while($zi1 < count($id_bots)) { - if(isset($id_bots[$zi1])) { - $mp = rand(0,count($map)-1); - $x1 = $map[$mp]['x']; - $y1 = $map[$mp]['y']; - $vls0 .= '("'.(time()+150).'","'.$dnew.'","'.$id_bots[$zi1].'","1","","'.$x1.'","'.$y1.'","0",""),'; - } - $zi1++; + unset($vls32, $ins232); + //Добавляем предметы + $map = []; + $mapsp = mysql_query('SELECT `x`,`y` FROM `dungeon_map` WHERE `id_dng` = 6'); + while ($mappl = mysql_fetch_array($mapsp)) { + $map[] = ['x' => $mappl['x'], 'y' => $mappl['y']]; + } + $mapu = $map; + // + $ii1 = 0; + while ($ii1 < count($map)) { + //На каждой клетке в среднем 2 предмета + $itbsrnd = $itbs[rand(0, count($itbs) - 1)]; + $mp = rand(0, count($map) - 1); + // + $x1 = $map[$mp]['x']; + $y1 = $map[$mp]['y']; + // + mysql_query( + 'INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $dnew . '","' . $itbsrnd . '","' . (time() - 600) . '","' . $x1 . '","' . $y1 . '" + )' + ); + // + $ii1++; } - $vls0 = rtrim($vls0,','); - $ins1 = mysql_query('INSERT INTO `dungeon_bots` (`go_bot`,`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`) VALUES '.$vls0.''); - */ - // - $newkor = array(); - while( $pl_u = mysql_fetch_array($sp_u) ) { - if( $i < 12 && !isset($usrlst[$pl_u['uid']]) ) { - //Действующие участники - $usrlst[$pl_u['uid']] = true; - $bus = mysql_fetch_array(mysql_query('SELECT `align`,`chatColor`,`molch1`,`molch2`,`id`,`login`,`clan`,`align`,`level`,`sex`,`online`,`room` FROM `users` WHERE `id` = "'.mysql_real_escape_string($pl_u['uid']).'" LIMIT 1')); - if(date('w') == 0 || date('w') == 6 || date('w') == 3) { - mysql_query('UPDATE `stats` SET `repexp` = `repexp` + 5 WHERE `id` = "'.$bus['id'].'" LIMIT 1'); - } - else - { - mysql_query('UPDATE `stats` SET `repexp` = `repexp` + 5 WHERE `id` = "'.$bus['id'].'" LIMIT 1'); - } - //Замораживаем эффекты - //changeSleep($bus['id'],1); - //mysql_query('UPDATE `eff_users` SET `sleeptime` = "'.time().'",`bs` = "1" WHERE `uid` = "'.$bus['id'].'" AND `delete` = "0" AND `no_Ace` = "0"'); - // - - $bus['login_BIG'] = ''; - if( $bus['align'] > 0 ) { - $bus['login_BIG'] .= ''; - } - if( $bus['clan'] > 0 ) { - $bus['login_BIG'] .= ''; - } - $bus['login_BIG'] .= ''.$bus['login'].'['.$bus['level'].']'; - $ubss .= ', '.$bus['login_BIG']; - // - //Вселяем персонажей в ботов - if( $bus['align'] >= 1 && $bus['align'] < 2 ) { - $bus['align'] = 1; - }elseif( $bus['align'] >= 3 && $bus['align'] < 4 ) { - $bus['align'] = 3; - }elseif( $bus['align'] == 7 ) { - $bus['align'] = 7; - }else{ - $bus['align'] = 0; - } - mysql_query('INSERT INTO `users` (`chatColor`,`align`,`inTurnir`,`molch1`,`molch2`,`activ`,`login`,`room`,`name`,`sex`,`level`,`bithday`) VALUES ( - "'.$bus['chatColor'].'","'.$bus['align'].'","'.$pl['id'].'","'.$bus['molch1'].'","'.$bus['molch2'].'","0","'.$bus['login'].'","362","'.$bus['name'].'","'.$bus['sex'].'","'.$pl['level'].'","'.date('d.m.Y').'")'); - // - $inbot = mysql_insert_id(); //айди бота - if( $inbot > 0 ) { - //Бот - // - $mp = rand(0,count($mapu)-1); - - $testxy=0; - $jj=count($newkor); - if ($i == 0) - { - $x1 = $mapu[$mp]['x']; - $y1 = $mapu[$mp]['y']; - $newkor[$i]['x'] = $mapu[$mp]['x']; - $newkor[$i]['y'] = $mapu[$mp]['y']; - } - else - { + //Добавляем чеки на кр. и на екр. на карту + $m1 = $maps[rand(0, count($maps) - 1)]; + $x1 = round($m1[0]); + $y1 = round($m1[1]); + //$itm1 = array( 4174 , 4175 , 4176 , 4177 , 4178 , 4179 , 4180 ); //Перечисление кр. чеков + $itm1 = [4176, 4177]; //Перечисление кр. чеков + $itm1 = $itm1[rand(0, count($itm1) - 1)]; + if ($itm1 > 0) { + // + $mp = rand(0, count($map) - 1); + // + $x1 = $map[$mp]['x']; + $y1 = $map[$mp]['y']; + // + mysql_query( + 'INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $dnew . '","' . $itm1 . '","' . (time() - 600) . '","' . $x1 . '","' . $y1 . '" + )' + ); + // + } - while ($testxy<1) - { - $iii=0; - - while ($iii<$jj) - { - if ( ($newkor[$iii]['x'] <= $mapu[$mp]['x'] +3) && ($newkor[$iii]['x'] >= $mapu[$mp]['x'] -3) && ($newkor[$iii]['y'] <= $mapu[$mp]['y'] +3)&& ($newkor[$iii]['y'] >= $mapu[$mp]['y'] -3)) - { - $testxy=1; - } - - $iii++; - } - - if($testxy==1) - { - $mp = rand(0,count($mapu)-1); - $testxy=0; - } - else - { - $testxy=1; - $x1 = $mapu[$mp]['x']; - $y1 = $mapu[$mp]['y']; - $newkor[$i]['x'] = $mapu[$mp]['x']; - $newkor[$i]['y'] = $mapu[$mp]['y']; - } - } - - } - - // - + //Добавляем монстров (Архивариусов) + $newkor = []; + while ($pl_u = mysql_fetch_array($sp_u)) { + if ($i < 12 && !isset($usrlst[$pl_u['uid']])) { + //Действующие участники + $usrlst[$pl_u['uid']] = true; + $bus = mysql_fetch_array( + mysql_query( + 'SELECT `align`,`chatColor`,`molch1`,`molch2`,`id`,`login`,`clan`,`align`,`level`,`sex`,`online`,`room` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $pl_u['uid'] + ) . '" LIMIT 1' + ) + ); + mysql_query( + 'UPDATE `stats` SET `repexp` = `repexp` + 5 WHERE `id` = "' . $bus['id'] . '" LIMIT 1' + ); - - unset($mapu[$mp]); - // - mysql_query('INSERT INTO `stats` (`timeGo`,`timeGoL`,`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) + $bus['login_BIG'] = ''; + if ($bus['align'] > 0) { + $bus['login_BIG'] .= ''; + } + if ($bus['clan'] > 0) { + $bus['login_BIG'] .= ''; + } + $bus['login_BIG'] .= '' . $bus['login'] . '[' . $bus['level'] . ']'; + $ubss .= ', ' . $bus['login_BIG']; + // + //Вселяем персонажей в ботов + if ($bus['align'] >= 1 && $bus['align'] < 2) { + $bus['align'] = 1; + } elseif ($bus['align'] >= 3 && $bus['align'] < 4) { + $bus['align'] = 3; + } elseif ($bus['align'] == 7) { + $bus['align'] = 7; + } else { + $bus['align'] = 0; + } + mysql_query( + 'INSERT INTO `users` (`chatColor`,`align`,`inTurnir`,`molch1`,`molch2`,`activ`,`login`,`room`,`name`,`sex`,`level`,`bithday`) VALUES ( + "' . $bus['chatColor'] . '","' . $bus['align'] . '","' . $pl['id'] . '","' . $bus['molch1'] . '","' . $bus['molch2'] . '","0","' . $bus['login'] . '","362","' . $bus['name'] . '","' . $bus['sex'] . '","' . $pl['level'] . '","' . date( + 'd.m.Y' + ) . '")' + ); + // + $inbot = mysql_insert_id(); //айди бота + if ($inbot > 0) { + //Бот + // + $mp = rand(0, count($mapu) - 1); + + + $testxy = 0; + $jj = count($newkor); + if ($i == 0) { + $x1 = $mapu[$mp]['x']; + $y1 = $mapu[$mp]['y']; + $newkor[$i]['x'] = $mapu[$mp]['x']; + $newkor[$i]['y'] = $mapu[$mp]['y']; + } else { + + while ($testxy < 1) { + $iii = 0; + + while ($iii < $jj) { + if (($newkor[$iii]['x'] <= $mapu[$mp]['x'] + 3) && ($newkor[$iii]['x'] >= $mapu[$mp]['x'] - 3) && ($newkor[$iii]['y'] <= $mapu[$mp]['y'] + 3) && ($newkor[$iii]['y'] >= $mapu[$mp]['y'] - 3)) { + $testxy = 1; + } + + $iii++; + } + + if ($testxy == 1) { + $mp = rand(0, count($mapu) - 1); + $testxy = 0; + } else { + $testxy = 1; + $x1 = $mapu[$mp]['x']; + $y1 = $mapu[$mp]['y']; + $newkor[$i]['x'] = $mapu[$mp]['x']; + $newkor[$i]['y'] = $mapu[$mp]['y']; + } + } + + } + + // + + + unset($mapu[$mp]); + // + mysql_query( + 'INSERT INTO `stats` (`timeGo`,`timeGoL`,`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ( - "'.(time()+$cnfg['time_puti']).'","'.(time()+$cnfg['time_puti']).'","98","'.$dnew.'","'.$inbot.'", - "s1=3|s2=3|s3=3|s4='.$st2s[$pl['level']][0].'|s5=0|s6=0|rinv=40|m9=5|m6=10","'.$exp2[$pl['level']].'", - "'.$st2s[$pl['level']][1].'","'.$st2s[$pl['level']][2].'","'.$x1.'","'.$y1.'" - )'); - mysql_query('UPDATE `users` SET `inUser` = "'.$inbot.'" WHERE `id` = "'.$bus['id'].'" LIMIT 1'); - } - //Добавляем путы - // - mysql_query('INSERT INTO `eff_users` (`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`img2`) VALUES ( - "2","'.$inbot.'","Путы","add_speedhp=30000|add_speedmp=30000|puti='.(time()+$cnfg['time_puti']).'","1","'.(time()+$cnfg['time_puti']).'","chains.gif" - ) '); - // - //Обновляем данные заявки БС - mysql_query('UPDATE `bs_zv` SET `finish` = "'.time().'",`inBot` = "'.$inbot.'" WHERE `id` = "'.$pl_u['id'].'" LIMIT 1'); - // - unset($bus['login_BIG']); - $i++; - } - $j++; - } - unset($sp_u,$pl_u,$bus,$usrlst,$testxy,$iii,$jj); - //Выбираем тип БС - $pl['type_btl'] = 0; - // - $m1 = $maps[rand(0,count($maps)-1)]; - $x1 = round($m1[0]); - $y1 = round($m1[1]); - // - unset($mis,$m1,$x1,$y1,$i2); - // - $ubss = ltrim($ubss,', '); - // - //Обновление статуса Башни Смерти и удаление заявок - mysql_query('UPDATE `bs_turnirs` SET `type_btl` = "'.$pl['type_btl'].'", `status` = "1", `users` = "'.$i.'", `arhiv` = "'.$pl['arhiv'].'", `users_finish` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `bs_zv` SET `finish` = "'.time().'" WHERE `bsid` = "'.$pl['id'].'" AND `finish` = "0" AND `inBot` = "0"'); - //Добавляем в лог БС - $text = 'Начало турнира. Участники: '.$ubss; - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$pl['id'].'", "'.$pl['count'].'", "'.$pl['city'].'", - "'.round($pl['money']*0.85,2).'","'.$i.'" - )'); - // - e('Начался турнир , для '.$pl['to_lvl'].' уровней в Башне Смерти. Участники: '.$ubss.'.'); - } - }else{ - //Оповещаем участников о начале турнира за 60 мин., а так-же за 10 мин. - if( $pl['status'] == 0 ) { - if( $pl['ch1'] == 0 && $pl['time_start'] - 60*60 < time()) { - mysql_query('UPDATE `bs_turnirs` SET `ch1` = `ch1` + 1 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - //e('Начало турнира вечных «5» уровней, для '.$pl['to_lvl'].' уровней в Башне Смерти через '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).'), текущий призовой фонд: '.round($pl['money']*0.85,2).' кр., заявок: '.$pl['users'].''); - }elseif( $pl['ch1'] == 1 && $pl['time_start'] - 10*60 < time()) { - mysql_query('UPDATE `bs_turnirs` SET `ch1` = `ch1` + 1 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - e('Начало турнира, для '.$pl['to_lvl'].' уровней в Башне Смерти через '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).'), текущий призовой фонд: '.round($pl['money']*0.85,2).' кр., 1.00 Екр., заявок: '.$pl['users'].''); - } - } - } + "' . (time() + $cnfg['time_puti']) . '","' . (time( + ) + $cnfg['time_puti']) . '","98","' . $dnew . '","' . $inbot . '", + "s1=3|s2=3|s3=3|s4=' . $st2s[$pl['level']][0] . '|s5=0|s6=0|rinv=40|m9=5|m6=10","' . $exp2[$pl['level']] . '", + "' . $st2s[$pl['level']][1] . '","' . $st2s[$pl['level']][2] . '","' . $x1 . '","' . $y1 . '" + )' + ); + mysql_query( + 'UPDATE `users` SET `inUser` = "' . $inbot . '" WHERE `id` = "' . $bus['id'] . '" LIMIT 1' + ); + } + //Добавляем путы + // + mysql_query( + 'INSERT INTO `eff_users` (`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`img2`) VALUES ( + "2","' . $inbot . '","Путы","add_speedhp=30000|add_speedmp=30000|puti=' . (time( + ) + $cnfg['time_puti']) . '","1","' . (time() + $cnfg['time_puti']) . '","chains.gif" + ) ' + ); + // + //Обновляем данные заявки БС + mysql_query( + 'UPDATE `bs_zv` SET `finish` = "' . time( + ) . '",`inBot` = "' . $inbot . '" WHERE `id` = "' . $pl_u['id'] . '" LIMIT 1' + ); + // + unset($bus['login_BIG']); + $i++; + } + $j++; + } + unset($sp_u, $pl_u, $bus, $usrlst, $testxy, $iii, $jj); + //Выбираем тип БС + $pl['type_btl'] = 0; + // + $m1 = $maps[rand(0, count($maps) - 1)]; + $x1 = round($m1[0]); + $y1 = round($m1[1]); + // + unset($mis, $m1, $x1, $y1, $i2); + // + $ubss = ltrim($ubss, ', '); + // + //Обновление статуса Башни Смерти и удаление заявок + mysql_query( + 'UPDATE `bs_turnirs` SET `type_btl` = "' . $pl['type_btl'] . '", `status` = "1", `users` = "' . $i . '", `arhiv` = "' . $pl['arhiv'] . '", `users_finish` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `bs_zv` SET `finish` = "' . time( + ) . '" WHERE `bsid` = "' . $pl['id'] . '" AND `finish` = "0" AND `inBot` = "0"' + ); + //Добавляем в лог БС + $text = 'Начало турнира. Участники: ' . $ubss; + mysql_query( + 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( + "1", "' . mysql_real_escape_string($text) . '", "' . time( + ) . '", "' . $pl['id'] . '", "' . $pl['count'] . '", "' . $pl['city'] . '", + "' . round($pl['money'] * 0.85, 2) . '","' . $i . '" + )' + ); + // + e('Начался турнир , для ' . $pl['to_lvl'] . ' уровней в Башне Смерти. Участники: ' . $ubss . '.'); + } + } else { + //Оповещаем участников о начале турнира за 60 мин., а так-же за 10 мин. + if ($pl['status'] == 0) { + if ($pl['ch1'] == 0 && $pl['time_start'] - 60 * 60 < time()) { + mysql_query('UPDATE `bs_turnirs` SET `ch1` = `ch1` + 1 WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + //e('Начало турнира вечных «5» уровней, для '.$pl['to_lvl'].' уровней в Башне Смерти через '.timeOut($pl['time_start']-time()).' ('.date('d.m.Y H:i',$pl['time_start']).'), текущий призовой фонд: '.round($pl['money']*0.85,2).' кр., заявок: '.$pl['users'].''); + } elseif ($pl['ch1'] == 1 && $pl['time_start'] - 10 * 60 < time()) { + mysql_query('UPDATE `bs_turnirs` SET `ch1` = `ch1` + 1 WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + e( + 'Начало турнира, для ' . $pl['to_lvl'] . ' уровней в Башне Смерти через ' . timeOut( + $pl['time_start'] - time() + ) . ' (' . date( + 'd.m.Y H:i', $pl['time_start'] + ) . '), текущий призовой фонд: ' . round( + $pl['money'] * 0.85, 2 + ) . ' кр., 1.00 Екр., заявок: ' . $pl['users'] . '' + ); + } + } + } } echo '#finish#'; -?> \ No newline at end of file diff --git a/cron_turnir.php b/cron_turnir.php index c37520b7..c613ce4e 100644 --- a/cron_turnir.php +++ b/cron_turnir.php @@ -1,97 +1,85 @@ '.$_SERVER['SERVER_ADDR']); - } -} +if (!isset($_GET['test']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP( + ) != '31.131.97.206') { + die(getIP() . '
    ' . $_SERVER['SERVER_ADDR']); + } -define('GAME',true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); +const GAME = true; +setlocale(LC_CTYPE, "ru_RU.CP1251"); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__magic.php'); +$u = User::start(); // $sp = mysql_query('SELECT * FROM `battle` WHERE `otmorozok` = 1 AND `team_win` = -1 AND `otmorozok_use` = 0'); -while( $pl = mysql_fetch_array($sp) ) { - if( rand( 0 , 100 ) < 11 ) { - // - mysql_query('UPDATE `battle` SET `otmorozok_use` = 1 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - // - $usr = mysql_fetch_array(mysql_query('SELECT `level`,`city` FROM `users` WHERE `battle` = "'.$pl['id'].'" ORDER BY `level` DESC LIMIT 1')); - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` LIKE "%Отморозок [%'.$usr['level'].'%]%" LIMIT 1')); - // - $tmr = rand(1,2); - // - $logins_bot = array(); - $bot = $u->addNewbot($bot['id'],NULL,NULL,$logins_bot,NULL); - $otmz = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `login` LIKE "%Отморозок (%" AND `battle` = "'.$pl['id'].'" LIMIT 1')); - // - $otmz[0]++; - // - mysql_query('UPDATE `users` SET `city` = "'.$usr['city'].'",`login` = "Отморозок ('.$otmz[0].')",`battle` = "'.$pl['id'].'" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET `team` = "'.$tmr.'" WHERE `id` = "'.$bot['id'].'" LIMIT 1'); - // - $vtvl = '{tm1} {u1} вмешался в поединок. Хо! хо! хо!'; - $last_hod = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "'.$pl['id'].'" ORDER BY `id_hod` DESC LIMIT 1')); - $last_hod = $last_hod['id_hod']; - // - $mass = array( - 'time' => time(), - 'battle' => $pl['id'], - 'id_hod' => ($last_hod+1), - 'vars' => '||time1='.time().'||time2=0||s1=0||t1='.$tmr.'||login1=Отморозок ('.$otmz[0].')', - 'type' => 1 - ); - // - $ins = mysql_query('INSERT INTO `battle_logs` ( +while ($pl = mysql_fetch_array($sp)) { + if (rand(0, 100) < 11) { + // + mysql_query('UPDATE `battle` SET `otmorozok_use` = 1 WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + // + $usr = mysql_fetch_array( + mysql_query( + 'SELECT `level`,`city` FROM `users` WHERE `battle` = "' . $pl['id'] . '" ORDER BY `level` DESC LIMIT 1' + ) + ); + $bot = mysql_fetch_array( + mysql_query('SELECT * FROM `test_bot` WHERE `login` LIKE "%Отморозок [%' . $usr['level'] . '%]%" LIMIT 1') + ); + // + $tmr = rand(1, 2); + // + $logins_bot = []; + $bot = $u->addNewbot($bot['id'], null, null, $logins_bot, null); + $otmz = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `users` WHERE `login` LIKE "%Отморозок (%" AND `battle` = "' . $pl['id'] . '" LIMIT 1' + ) + ); + // + $otmz[0]++; + // + mysql_query( + 'UPDATE `users` SET `city` = "' . $usr['city'] . '",`login` = "Отморозок (' . $otmz[0] . ')",`battle` = "' . $pl['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1' + ); + // + mysql_query('UPDATE `stats` SET `team` = "' . $tmr . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); + // + $vtvl = '{tm1} {u1} вмешался в поединок. Хо! хо! хо!'; + $last_hod = mysql_fetch_array( + mysql_query( + 'SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $pl['id'] . '" ORDER BY `id_hod` DESC LIMIT 1' + ) + ); + $last_hod = $last_hod['id_hod']; + // + $mass = [ + 'time' => time(), + 'battle' => $pl['id'], + 'id_hod' => ($last_hod + 1), + 'vars' => '||time1=' . time() . '||time2=0||s1=0||t1=' . $tmr . '||login1=Отморозок (' . $otmz[0] . ')', + 'type' => 1, + ]; + // + $ins = mysql_query( + 'INSERT INTO `battle_logs` ( `time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` ) VALUES ( - "'.$mass['time'].'", - "'.$mass['battle'].'", - "'.$mass['id_hod'].'", - "'.$vtvl.'", - "'.$mass['vars'].'", + "' . $mass['time'] . '", + "' . $mass['battle'] . '", + "' . $mass['id_hod'] . '", + "' . $vtvl . '", + "' . $mass['vars'] . '", "", "", "", "", - "'.$mass['type'].'" - )'); - } + "' . $mass['type'] . '" + )' + ); + } } -// - -die(); - -//Подаем турнир для 2-3 уровней -$inc = mysql_query('INSERT INTO `zayvki` ( - `arand`,`noatack`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`noinc`,`razdel`,`time`,`fastfight`,`priz` -) VALUES ( - "1","1","capitalcity","0","0","300","120","2","2","3","3","1","5","'.time().'","1","1" -), ( - "1","1","capitalcity","0","0","300","120","4","4","6","6","1","5","'.time().'","1","1" -), ( - "1","1","capitalcity","0","0","300","120","7","7","7","7","1","5","'.time().'","1","1" -), ( - "1","1","capitalcity","0","0","300","120","8","8","8","8","1","5","'.time().'","1","1" -), ( - "1","1","capitalcity","0","0","300","120","9","9","9","9","1","5","'.time().'","1","1" -), ( - "1","1","capitalcity","0","0","300","120","10","10","10","10","1","5","'.time().'","1","1" -)'); - -if($inc) { - echo 'true'; -}else{ - echo 'false'; -} -?> \ No newline at end of file diff --git a/cron_vs.php b/cron_vs.php deleted file mode 100644 index cf1c3b39..00000000 --- a/cron_vs.php +++ /dev/null @@ -1,113 +0,0 @@ -'.$_SERVER['SERVER_ADDR']); - } -} - -echo '#start#'; -define('GAME',true); -setlocale(LC_CTYPE ,"ru_RU.CP1251"); -include('_incl_data/__config.php'); -include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__magic.php'); -// -$cfg = array( - 'H' => 17 //время старта по серверу -); -// -function send_chat($type,$from,$text,$time) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")'); - echo '[SEND_CHAT]'; -} -// -$bot1 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "Мусорщик" LIMIT 1')); -$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "Мироздатель" LIMIT 1')); -// -$st1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$bot1['id'].'" LIMIT 1')); -$st2 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$bot2['id'].'" LIMIT 1')); -// -$td = mysql_fetch_array(mysql_query('SELECT * FROM `vs_stat` WHERE (`d` = "'.date('d').'" AND `m` = "'.date('m').'" AND `y` = "'.date('Y').'") OR `winner` = -1 ORDER BY `time` ASC LIMIT 1')); -// -if(!isset($td['id'])) { - //Создаем - $ins = mysql_query('INSERT INTO `vs_stat` ( - `time`,`d`,`m`,`y`,`act`,`type`,`uid` - ) VALUES ( - "'.time().'","'.date('d').'","'.date('m').'","'.date('Y').'","1","0","0" - )'); - // - if(!$ins) { - echo '#ERROR_INSERT_DATA#'; - }else{ - $td = mysql_fetch_array(mysql_query('SELECT * FROM `vs_stat` WHERE `d` = "'.date('d').'" AND `m` = "'.date('m').'" AND `y` = "'.date('Y').'" ORDER BY `time` LIMIT 1')); - } - // -} -if(isset($td['id'])) { - // - echo '#type'.$td['type'].'#'; - // - if( $td['type'] == 0 ) { - if( date('H') == $cfg['H'] ) { - send_chat(1,'','Бой бессмертных проходит на Центральной Площади, займите свою сторону в этой битве и получите награду за победу!',time()); - send_chat(1,'','Мусорщик: Что-то у меня душа, в последнее время, не на месте :vamp:',time()); - send_chat(1,'','Мироздатель:Я явился чтобы спасти этот мир :grace:',time()); - // - mysql_query('INSERT INTO `battle` ( - `city`,`time_start`,`timeout`,`type`,`noinc` - ) VALUES ( - "capitalcity","'.time().'","180","180","1" - )'); - // - $btl_id = mysql_insert_id(); - if( $btl_id > 0 ) { - // - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'",`online` = "'.(time()+3600).'" WHERE `id` = "'.$bot1['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'",`online` = "'.(time()+3600).'" WHERE `id` = "'.$bot2['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET `hpNow` = "1000000",`mpNow` = "1000000",`team` = 1 WHERE `id` = "'.$bot1['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = "1000000",`mpNow` = "1000000",`team` = 2 WHERE `id` = "'.$bot2['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `vs_stat` SET `type` = "1",`battle` = "'.$btl_id.'" WHERE `id` = "'.$td['id'].'" LIMIT 1'); - // - } - // - } - }elseif( $td['type'] == 1 ) { - // - $bt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$bot1['battle'].'" AND `id` = "'.$bot2['battle'].'" LIMIT 1')); - //// - mysql_query('UPDATE `users` SET `online` = "'.(time()+3600).'" WHERE `id` = "'.$bot1['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `online` = "'.(time()+3600).'" WHERE `id` = "'.$bot2['id'].'" LIMIT 1'); - // - if( $st1['bot'] != 2 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$bot1['id'].'" LIMIT 1'); - } - if( $st2['bot'] != 2 ) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "'.$bot2['id'].'" LIMIT 1'); - } - // - if( $st1['hpNow'] < 1 || $st2['hpNow'] < 1 || $bot1['battle'] == 0 || $bot2['battle'] == 0 ) { - //Завершаем поединок, кто-то победил - - }else{ - //Бой идет, стены гнутся - - } - // - } - // -} -// -// -echo '#finish#'; -?> \ No newline at end of file diff --git a/cron_zv.php b/cron_zv.php index 5e9423c6..c11d7479 100644 --- a/cron_zv.php +++ b/cron_zv.php @@ -1,72 +1,44 @@ '.$_SERVER['SERVER_ADDR']); +if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') { + die('Hello pussy!'); +} +if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') { + die(getIPblock() . '
    ' . $_SERVER['SERVER_ADDR']); } - -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__zv.php'); +/**@var $pdo PDO */ +$zv = new FightRequest(); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","LEL","6","1","-1")'); +function send_chat($type, $from, $text, $time) +{ + global $pdo; + $pdo->prepare('insert into chat (text, city, login, type, new, time, room) values (?,?,?,?,?,?,?)')->execute([$text, 'capitalcity', $from, $type, 1, $time, 3]); } -function send_chat($type,$from,$text,$time) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")'); +function inuser_go_btl($id) +{ + if (isset($id['id'])) { + echo file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass']); + echo '
    '; + } } -function inuser_go_btl($id) { - if(isset($id['id'])) { - echo file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass']); - echo '
    '; - } +$sp = $pdo->query('select id, pass from users where battle in (select id from battle where team_win = -1 and time_over = 0 and time_start < unix_timestamp() - 3600 limit 100)'); +foreach ($sp as $pl) { + inuser_go_btl($pl); } -// -$sp = mysql_query('SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = "-1" AND `time_over` = "0" AND `time_start` < "'.(time()-3600).'" LIMIT 100'); -while($pl = mysql_fetch_array($sp)) { - $user1 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` = "'.$pl['id'].'" LIMIT 1')); - inuser_go_btl($user1); - //sleep(1); -} - -//Проверка боев -/* -$sp = mysql_query('SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = -1'); -while( $pl = mysql_fetch_array($sp) ) { - $test = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$pl['id'].'" ORDER BY `id` DESC LIMIT 1')); - $end = 0; - if(!isset($test['id']) && $pl['time_start'] < time() - 3600 ) { - $end = 1; - }elseif( $test['time'] < time() - 3600 ) { - $end = 1; - } - e($pl['id']); - if( $end == 1 ) { - mysql_query('UPDATE `battle` SET `team_win` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$pl['id'].'" LIMIT 1'); - } -} -*/ - $zv->testCronZv(); -?> diff --git a/css/obraz.css b/css/obraz.css new file mode 100644 index 00000000..dc908181 --- /dev/null +++ b/css/obraz.css @@ -0,0 +1,85 @@ +body { + background-color: black; + margin: 0; +} + +A:link { + FONT-WEIGHT: bold; + COLOR: #5B3E33; + TEXT-DECORATION: none +} + +A:visited { + FONT-WEIGHT: bold; + COLOR: #633525; + TEXT-DECORATION: none +} + +A:active { + FONT-WEIGHT: bold; + COLOR: #77684d; + TEXT-DECORATION: none +} + +A:hover { + COLOR: #000000; + TEXT-DECORATION: underline +} + +img { + border: none; +} + +div.header { + height: 135px; + background-image: url(https://new-combats.com/forum_script/img/line_capitalcity.jpg); +} + +div.footer { + background-image: url(https://img.new-combats.com/i/encicl/ln_footer.jpg); + background-repeat: repeat-x; + background-color: black; + padding: 12px; + text-align: center; + color: #DFD3A3; + font-size: 9px; +} + +img.logo { + display: block; + margin: auto; +} + +hr { + display: block; + height: 11px; + border: 0; + background-image: url(https://img.new-combats.com/ram12_33.gif), + url(https://img.new-combats.com/ram12_35.gif), + url(https://img.new-combats.com/ram12_34.gif); + background-position: left top, + right top, + center top; + background-repeat: no-repeat, + no-repeat, + repeat-x; +} + +ul { + margin: 0; + padding-left: 16px; +} + +li::marker { + content: "· "; +} + +table.main { + width: 100%; + background-color: #f2e5b1; + border-collapse: collapse; +} + +table.main td { + padding: 0; +} \ No newline at end of file diff --git a/dn_editor.php b/dn_editor.php index 3f5779d0..ea9b547b 100644 --- a/dn_editor.php +++ b/dn_editor.php @@ -1,149 +1,164 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - +info['admin'] == 0) { - die(''); +if (!$u->info['admin']) { + die(''); } -if(isset($_GET['id'])) { - $_POST['id'] = (int)$_GET['id']; +if (isset($_GET['id'])) { + $_POST['id'] = (int)$_GET['id']; } -if(isset($_POST['id_dng'])) { - $id = (int)$_POST['id_dng']; - if($id > 0) { - $test_id = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(!isset($test_id['id'])) { - unset($test_id); - } - }else{ - $id = 0; - } -}elseif(isset($_POST['id'])) { - $id = (int)$_POST['id']; - if($id > 0) { - $test_id = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(!isset($test_id['id'])) { - unset($test_id); - } - }else{ - $id = 0; - } +if (isset($_POST['id_dng'])) { + $id = (int)$_POST['id_dng']; + if ($id > 0) { + $test_id = mysql_fetch_array( + mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string($id) . '" LIMIT 1') + ); + if (!isset($test_id['id'])) { + unset($test_id); + } + } else { + $id = 0; + } +} elseif (isset($_POST['id'])) { + $id = (int)$_POST['id']; + if ($id > 0) { + $test_id = mysql_fetch_array( + mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string($id) . '" LIMIT 1') + ); + if (!isset($test_id['id'])) { + unset($test_id); + } + } else { + $id = 0; + } } - $u->info['psevdo_x'] = 0; - $u->info['psevdo_y'] = 0; - $u->info['psevdo_s'] = 1; - - if(isset($_POST['x'])) { - $u->info['psevdo_x'] = (int)$_POST['x']; - $u->info['psevdo_y'] = (int)$_POST['y']; - $u->info['psevdo_s'] = (int)$_POST['s']; - } - - if(isset($_GET['x'])) { - $u->info['psevdo_x'] = (int)$_GET['x']; - $u->info['psevdo_y'] = (int)$_GET['y']; - $u->info['psevdo_s'] = (int)$_GET['s']; - } - -if(isset($_POST['saveObjPosition'])) { - echo 'START#'; - $_POST['saveObjPosition'] = str_replace('obj_true_','',$_POST['saveObjPosition']); - $_POST['saveObjPosition'] = floor((int)$_POST['saveObjPosition']); - $obj = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `id` = "'.mysql_real_escape_string($_POST['saveObjPosition']).'" LIMIT 1')); - if(isset($obj['id'])) { - $cor = array(0,0); - $data = explode(',',ltrim(rtrim($obj['date'],'\}'),'\{')); - $da = array(); - $i = 0; - while($i < count($data)) { - $data[$i] = explode(':',$data[$i]); - $da[$data[$i][0]] = $data[$i][1]; - echo '['.$data[$i][0].' = '.$data[$i][1].']'; - $i++; - } - $obj['top'] = 0; - $obj['left'] = 0; - $rs = (int)$_POST['rz']; - $da['rt'.$rs] = 0+$_POST['objy']; - $da['rl'.$rs] = 0+$_POST['objx']; - - $dak = array_keys($da); - $dav = $da; - $da = ''; - $i = 0; - while($i < count($dak)) { - $da .= $dak[$i].':'.$dav[$dak[$i]].','; - $i++; - } - $da = rtrim($da,','); - $da = '{'.$da.'}'; - $upd = mysql_query('UPDATE `dungeon_obj` SET `top` = "'.mysql_real_escape_string($obj['top']).'", `left` = "'.mysql_real_escape_string($obj['left']).'", `date` = "'.mysql_real_escape_string($da).'" WHERE `id` = "'.$obj['id'].'" LIMIT 1'); - if($upd) { - echo 'Данные успешно сохранены '.$da; - }else{ - echo '#!Ошибка'; - } - }else{ - echo '#Ошибка'; - } - die('#END'); -}elseif(isset($_POST['ore_id'])) { - $id = (int)$_POST['id_dng']; - echo '[START# '; - $_POST['ore_id'] = floor((int)$_POST['ore_id']); - $obj = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `id` = "'.mysql_real_escape_string($_POST['ore_id']).'" LIMIT 1')); - $_POST['ore_name'] = iconv("UTF-8", "cp1251",$_POST['ore_name']); - if(isset($obj['id'])) { - mysql_query('UPDATE `dungeon_obj` SET - `name` = "'.mysql_real_escape_string($_POST['ore_name']).'", - `img` = "'.mysql_real_escape_string($_POST['ore_img']).'", - `w` = "'.mysql_real_escape_string($_POST['ore_w']).'", - `h` = "'.mysql_real_escape_string($_POST['ore_h']).'", - `x` = "'.mysql_real_escape_string($_POST['ore_x']).'", - `y` = "'.mysql_real_escape_string($_POST['ore_y']).'", +$u->info['psevdo_x'] = 0; +$u->info['psevdo_y'] = 0; +$u->info['psevdo_s'] = 1; + +if (isset($_POST['x'])) { + $u->info['psevdo_x'] = (int)$_POST['x']; + $u->info['psevdo_y'] = (int)$_POST['y']; + $u->info['psevdo_s'] = (int)$_POST['s']; +} + +if (isset($_GET['x'])) { + $u->info['psevdo_x'] = (int)$_GET['x']; + $u->info['psevdo_y'] = (int)$_GET['y']; + $u->info['psevdo_s'] = (int)$_GET['s']; +} + +if (isset($_POST['saveObjPosition'])) { + echo 'START#'; + $_POST['saveObjPosition'] = str_replace('obj_true_', '', $_POST['saveObjPosition']); + $_POST['saveObjPosition'] = floor((int)$_POST['saveObjPosition']); + $obj = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_obj` WHERE `id` = "' . mysql_real_escape_string( + $_POST['saveObjPosition'] + ) . '" LIMIT 1' + ) + ); + if (isset($obj['id'])) { + $cor = [0, 0]; + $data = explode(',', ltrim(rtrim($obj['date'], '\}'), '\{')); + $da = []; + $i = 0; + while ($i < count($data)) { + $data[$i] = explode(':', $data[$i]); + $da[$data[$i][0]] = $data[$i][1]; + echo '[' . $data[$i][0] . ' = ' . $data[$i][1] . ']'; + $i++; + } + $obj['top'] = 0; + $obj['left'] = 0; + $rs = (int)$_POST['rz']; + $da['rt' . $rs] = 0 + $_POST['objy']; + $da['rl' . $rs] = 0 + $_POST['objx']; + + $dak = array_keys($da); + $dav = $da; + $da = ''; + $i = 0; + while ($i < count($dak)) { + $da .= $dak[$i] . ':' . $dav[$dak[$i]] . ','; + $i++; + } + $da = rtrim($da, ','); + $da = '{' . $da . '}'; + $upd = mysql_query( + 'UPDATE `dungeon_obj` SET `top` = "' . mysql_real_escape_string( + $obj['top'] + ) . '", `left` = "' . mysql_real_escape_string($obj['left']) . '", `date` = "' . mysql_real_escape_string( + $da + ) . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1' + ); + if ($upd) { + echo 'Данные успешно сохранены ' . $da; + } else { + echo '#!Ошибка'; + } + } else { + echo '#Ошибка'; + } + die('#END'); +} elseif (isset($_POST['ore_id'])) { + $id = (int)$_POST['id_dng']; + echo '[START# '; + $_POST['ore_id'] = floor((int)$_POST['ore_id']); + $obj = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_obj` WHERE `id` = "' . mysql_real_escape_string($_POST['ore_id']) . '" LIMIT 1' + ) + ); + $_POST['ore_name'] = iconv("UTF-8", "cp1251", $_POST['ore_name']); + if (isset($obj['id'])) { + mysql_query( + 'UPDATE `dungeon_obj` SET + `name` = "' . mysql_real_escape_string($_POST['ore_name']) . '", + `img` = "' . mysql_real_escape_string($_POST['ore_img']) . '", + `w` = "' . mysql_real_escape_string($_POST['ore_w']) . '", + `h` = "' . mysql_real_escape_string($_POST['ore_h']) . '", + `x` = "' . mysql_real_escape_string($_POST['ore_x']) . '", + `y` = "' . mysql_real_escape_string($_POST['ore_y']) . '", - `type2` = "'.mysql_real_escape_string($_POST['ore_type2']).'", - `s` = "'.mysql_real_escape_string($_POST['ore_s']).'", - `s2` = "'.mysql_real_escape_string($_POST['ore_s2']).'", - `os1` = "'.mysql_real_escape_string($_POST['ore_os1']).'", - `os2` = "'.mysql_real_escape_string($_POST['ore_os2']).'", - `os3` = "'.mysql_real_escape_string($_POST['ore_os3']).'", - `os4` = "'.mysql_real_escape_string($_POST['ore_os4']).'", - `fix_x_y` = "'.mysql_real_escape_string($_POST['ore_fix_x_y']).'", + `type2` = "' . mysql_real_escape_string($_POST['ore_type2']) . '", + `s` = "' . mysql_real_escape_string($_POST['ore_s']) . '", + `s2` = "' . mysql_real_escape_string($_POST['ore_s2']) . '", + `os1` = "' . mysql_real_escape_string($_POST['ore_os1']) . '", + `os2` = "' . mysql_real_escape_string($_POST['ore_os2']) . '", + `os3` = "' . mysql_real_escape_string($_POST['ore_os3']) . '", + `os4` = "' . mysql_real_escape_string($_POST['ore_os4']) . '", + `fix_x_y` = "' . mysql_real_escape_string($_POST['ore_fix_x_y']) . '", - `type` = "'.mysql_real_escape_string($_POST['ore_type']).'" WHERE `id` = "'.$obj['id'].'" LIMIT 1 - '); - echo 'Данные сохранены'; - }else{ - //создаем обьект - /* + `type` = "' . mysql_real_escape_string($_POST['ore_type']) . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1 + ' + ); + echo 'Данные сохранены'; + } else { + //создаем обьект + /* $('#ore_id').val(op[0]); $('#ore_img').val(op[4]); $('#ore_name').val(op[1]); @@ -154,1017 +169,1294 @@ if(isset($_POST['saveObjPosition'])) { $('#ore_w').val(op[7]); $('#ore_h').val(op[8]); */ - if(isset($_POST['ore_img'])) { - echo 'Объект создан'; - if(mysql_query('INSERT INTO `dungeon_obj` (`for_dn`,`name`,`img`,`w`,`h`,`x`,`y`,`type2`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`fix_x_y`,`type`,`date`) VALUES ( - "'.mysql_real_escape_string($id).'", - "'.mysql_real_escape_string($_POST['ore_name']).'", - "'.mysql_real_escape_string($_POST['ore_img']).'", - "'.mysql_real_escape_string($_POST['ore_w']).'", - "'.mysql_real_escape_string($_POST['ore_h']).'", - "'.mysql_real_escape_string($_POST['ore_x']).'", - "'.mysql_real_escape_string($_POST['ore_y']).'", - "'.mysql_real_escape_string($_POST['ore_type2']).'", - "'.mysql_real_escape_string($_POST['ore_s']).'", - "'.mysql_real_escape_string($_POST['ore_s2']).'", - "'.mysql_real_escape_string($_POST['ore_os1']).'", - "'.mysql_real_escape_string($_POST['ore_os2']).'", - "'.mysql_real_escape_string($_POST['ore_os3']).'", - "'.mysql_real_escape_string($_POST['ore_os4']).'", - "'.mysql_real_escape_string($_POST['ore_fix_x_y']).'", - "'.mysql_real_escape_string($_POST['ore_type']).'", + if (isset($_POST['ore_img'])) { + echo 'Объект создан'; + if (mysql_query( + 'INSERT INTO `dungeon_obj` (`for_dn`,`name`,`img`,`w`,`h`,`x`,`y`,`type2`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`fix_x_y`,`type`,`date`) VALUES ( + "' . mysql_real_escape_string($id) . '", + "' . mysql_real_escape_string($_POST['ore_name']) . '", + "' . mysql_real_escape_string($_POST['ore_img']) . '", + "' . mysql_real_escape_string($_POST['ore_w']) . '", + "' . mysql_real_escape_string($_POST['ore_h']) . '", + "' . mysql_real_escape_string($_POST['ore_x']) . '", + "' . mysql_real_escape_string($_POST['ore_y']) . '", + "' . mysql_real_escape_string($_POST['ore_type2']) . '", + "' . mysql_real_escape_string($_POST['ore_s']) . '", + "' . mysql_real_escape_string($_POST['ore_s2']) . '", + "' . mysql_real_escape_string($_POST['ore_os1']) . '", + "' . mysql_real_escape_string($_POST['ore_os2']) . '", + "' . mysql_real_escape_string($_POST['ore_os3']) . '", + "' . mysql_real_escape_string($_POST['ore_os4']) . '", + "' . mysql_real_escape_string($_POST['ore_fix_x_y']) . '", + "' . mysql_real_escape_string($_POST['ore_type']) . '", "{use:\'takeit\'}" - )')) { - echo '+'; - }else{ - echo '-'; - } - } - } - die(' #END]'); -}elseif(isset($_POST['ore_delete_id'])) { - mysql_query('UPDATE `dungeon_obj` SET `delete` = "'.$u->info['id'].'",`for_dn` = "'.time().'" WHERE `id` = "'.mysql_real_escape_string($_POST['ore_delete_id']).'" LIMIT 1'); - die('[START# Объект удален #END]'); + )' + )) { + echo '+'; + } else { + echo '-'; + } + } + } + die(' #END]'); +} elseif (isset($_POST['ore_delete_id'])) { + mysql_query( + 'UPDATE `dungeon_obj` SET `delete` = "' . $u->info['id'] . '",`for_dn` = "' . time( + ) . '" WHERE `id` = "' . mysql_real_escape_string($_POST['ore_delete_id']) . '" LIMIT 1' + ); + die('[START# Объект удален #END]'); } -if($id > 0) { - //работа с пещерой - $pd = array( - 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) - ); - - include('dn_editor_class.php'); - - $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 ($id > 0) { + //работа с пещерой + $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) + ]; + + $d = new DungeonEditor(); + $d->start(); + + $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['look'])) { +if (!isset($_GET['look'])) { ?> - -Визуальный редактор Лабиринтов © new-combats.com + + Визуальный редактор Лабиринтов © new-combats.com - - - - - + + + + + - + -'; }else{ ?> -function genMap(){ - var i = 0, m = false, mz = false; - while(i=1) - { - if(zfloor0[i]!='') - { - document.getElementById('Floor0').innerHTML += zfloor0[i]; - } - i--; - } -} -var dConfig={ - 2:{ - 1:{'top':50,'left':140,'w':80,'h':147}, - 2:{'top':45,'left':87,'w':80,'h':147}, - 3:{'top':45,'left':192,'w':80,'h':147}, - 4:{'top':49,'left':165,'w':80,'h':147}, - 5:{'top':49,'left':105,'w':80,'h':147}, - 6:{'top':53,'left':140,'w':80,'h':147}, - 7:{'top':53,'left':87,'w':80,'h':147}, - 8:{'top':53,'left':190,'w':80,'h':147} - }, - 3:{ - 1:{'top':60,'left':152,'w':53,'h':97}, - 2:{'top':58,'left':110,'w':53,'h':97}, - 3:{'top':58,'left':188,'w':53,'h':97}, - 4:{'top':61,'left':168,'w':53,'h':97}, - 5:{'top':61,'left':128,'w':53,'h':97}, - 6:{'top':62,'left':153,'w':53,'h':97}, - 7:{'top':62,'left':113,'w':53,'h':97}, - 8:{'top':62,'left':193,'w':53,'h':97}}, - 4:{ - 1:{'top':70,'left':158,'w':35,'h':64}, - 2:{'top':68,'left':125,'w':35,'h':64}, - 3:{'top':68,'left':193,'w':35,'h':64}, - 4:{'top':71,'left':173,'w':35,'h':64}, - 5:{'top':71,'left':137,'w':35,'h':64}, - 6:{'top':73,'left':158,'w':35,'h':64}, - 7:{'top':73,'left':129,'w':35,'h':64}, - 8:{'top':73,'left':193,'w':35,'h':64} - } -} -var dConfigObj = { - 1: { - 0: { - 'top':65, - 'left':110, - 'w':1, - 'h':1 - } - } - ,2: { - 0: { - 'top':65, - 'left':110, - 'w':0.65, - 'h':0.65 - } - }, - 3: { - 0: { - 'top':65, - 'left':110, - 'w':0.48, - 'h':0.48 - } - }, - 4: { - 0: { - 'top':65, - 'left':110, - 'w':0.35, - 'h':0.35 - } - } -} -var prob = { - 0: { - 1:1, - 2:0.25, - 3:-0.10, - 4:-0.38 - }, - 1: { - 1:0.90, - 2:0.50, - 3:0.23, - 4:0.05 - } -}; - -function addObj(v,mz,iii){ - var r = ''; - //355*245 window - 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(v[5]==dsee) { rz -= 1; } - if(dConfigObj[rz]!=undefined && dConfigObj[rz][v[6]]!=undefined) { - new_w = v[7]*dConfigObj[rz][v[6]]['w']; - new_h = v[8]*dConfigObj[rz][v[6]]['h']; - new_left = dConfigObj[rz][v[6]]['left']-Math.round((v[7]*prob[0][rz])/4); - new_top = dConfigObj[rz][v[6]]['top']-Math.round((v[8]*prob[1][rz])/4); - if(v[2]==6) { new_left += 195; new_top -= 5; } - if(v[2]==4) { new_left -= 195; new_top -= 5; } - if( v[2]==9) { new_left -= 140; new_top -= 2; } - if( v[2]==7){ new_left += 140; new_top -= 2; } - if( v[2]==13){ new_left += 100; new_top -= 1; } - if( v[2]==11){ new_left -= 100; new_top -= 0; } - if( v[9]!=0){ new_left += Math.round(new_left/(100+(rz-1)*10)*v[9]+rz*0.25); } - if( v[10]!=0){ new_top += Math.round(new_h/2+new_top/(100+(rz-1)*50)*v[10]-rz*3.3); } - if( rz == 4 ){ new_top += 3; } - if( v[11] != 0 ) { - if(v[11]['t'+rz]!=undefined) { new_top += v[11]['t'+rz]; } - if(v[11]['l'+rz]!=undefined) { new_left += v[11]['l'+rz]; } - if(v[11]['w'+rz]!=undefined) { new_w += v[11]['w'+rz]; } - if(v[11]['h'+rz]!=undefined) { new_h += v[11]['h'+rz]; } - if(v[11]['rt'+rz]!=undefined) { new_top = v[11]['rt'+rz]; } - if(v[11]['rl'+rz]!=undefined) { new_left = v[11]['rl'+rz]; } - } - ////i:{0:id,1:name,2:mapPoint,3:action,4:img,5:type}, - if( rz >= 1 && rz <= 2 ) { - actionNow = ''; - if( v[11]['use'] != undefined ) { - if( v[11]['use'] == 'exit' ) { - actionNow = 'alert(\'Выход из подземелья\');'; - } else if( v[11]['use'] == 'takeit' ) { - actionNow = 'location=\'main.php?take_obj='+v[0]+'&rnd='+0.28626200682069150+'\';'; - } - } - zfloor0[rz] = ''+zfloor0[rz]; - } else { - zfloor0[rz] = ''+zfloor0[rz]; - } - r = ''; - } - 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' || 0 > 0 ) { action = 'dialogMenu('+v[0]+',1,'+v[7]+',0,0,event);'; } - zfloor0[rz] += ''; - } else { - zfloor0[rz] += ''; - } - r = ''; - } - return r; -} -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 = 'main.php?go='+id; - }else{ - gotoup777 = id; - gotext777 = ttl; - } -} -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 = "main.php?go="+gotoup777; - } - } - if(gotoup777 > 0 && gotext777 != '' && document.getElementById('gotext777').innerHTML != 'Вы перейдете '+gotext777+' (отмена)') { - //document.getElementById('gotext777').style.display = 'block'; - document.getElementById('gotext777').innerHTML = 'Вы перейдете '+gotext777+' (отмена)'; - }else if(document.getElementById('gotext777').innerHTML != '' && gotoup777 == 0 && gotext777 == '') { - //document.getElementById('gotext777').style.display = 'none'; - document.getElementById('gotext777').innerHTML = ''; - } - } -} + var obi = { + 'obj': 0, + 'w': 0, + 'h': 0, + 't': 0, + 'l': 0, + 'position': 0, + 'val': 0 + }; + } - + var sel_id = 0, sel_x = 0, sel_y = 0, sel_s = 1; - + $('#dngseemap').html(''); + + if (top.sel_s < 1) { + top.sel_s = 4; + } + + if (top.sel_s > 4) { + top.sel_s = 1; + } + + if (top.sel_id > 0) { + $('#px_' + top.sel_id).css({'background-color': ''}); + $('#px_' + top.sel_id).attr({'className': 'cq'}); + } + + $('#px_' + id).css({'background-color': '#ffd5d5'}); + + top.obi = { + 'obj': 0, + 'w': 0, + 'h': 0, + 't': 0, + 'l': 0, + 'position': 0, + 'val': 0 + }; + + top.sel_id = id; + top.sel_x = x; + top.sel_y = y; + + $('#fm1').attr("src", "dn_editor_bots.php?id_dn=&xx=" + x + "&&yy=" + y + ""); + $.post('dn_editor.php?look=1', {id: , id_p: id, x: x, y: y, s: top.sel_s}, function (data) { + $('#dngseemap').html(data); + }); + } + + function dialogMenu(id, atk, talk, look, take, e) { + var d = document.getElementById('deMenu'); + if (d != undefined) { + if (e == undefined) { + e = window.e; + + } + d.innerHTML = ''; + var t = ''; + if (talk > 0) { + t += 'Диалог
    '; + } + if (atk == 1) { + t += 'Напасть
    '; + } + if (look == 1) { + t += 'Просмотр
    '; + } + if (take == 1) { + t += 'Поднять
    '; + } + d.innerHTML = t + ''; + d.style.display = ''; + if (e.x == undefined) { + e.x = e.clientX; + e.y = e.clientY; + } + d.style.top = e.y + 'px'; + if (e.x > 320) { + d.style.right = (document.body.offsetWidth - e.x) + 'px'; + } else { + d.style.right = (-e.x + 540) + 'px'; + } + } + } + + function exitDem() { + var d = document.getElementById('deMenu'); + if (d != undefined) { + d.innerHTML = ''; + d.style.display = 'none'; + d.style.top = '0px'; + d.style.right = '0px'; + } + } + + 0) { ?> + '; + } if (!isset($_GET['look'])) { + echo 'var'; + }?> objects = {}; + //i:{id,login,mapPoint,sex,obraz,type,users_p}, + users = {}; + objs = {genObjects(); ?>}; + items = {}; + actions = {}; + dsee = gs; ?>; + mapp = { + 1: '0_0f', 2: '0_0f', 3: '0_0f', 4: '1_1f', 5: '1_1f', 6: '1_1f' + , 7: '2_1f', 8: '2_1f', 9: '2_1f' + , 11: '3_1l', 12: '3_1f', 13: '3_1r' + } + zmap = {5: 894, 8: 0, 12: 0} + zfloor0 = {1: '', 2: '', 3: '', 4: '', 5: ''}; + '; + }else{ ?> + function genMap() { + var i = 0, m = false, mz = false; + while (i < users['count']) { + if (users[i] != undefined) { + mz = mapp[users[i][2]]; + if (document.getElementById(mz) != undefined) { + m = document.getElementById(mz); + m.innerHTML = addUser(users[i], mz) + m.innerHTML; + } + } + i++; + } + var i = 0, m = false, mz = false; + while (i < objs['count']) { + if (objs[i] != undefined) { + mz = mapp[objs[i][2]]; + if (objs[i][5] == dsee && (objs[i][2] == 5 || objs[i][2] == 2 || objs[i][2] == 8 || objs[i][2] == 12 || objs[i][2] == 15)) { + mz = mapp[objs[i][2] - 3]; + } + if (document.getElementById(mz) != undefined) { + m = document.getElementById(mz); + m.innerHTML = addObj(objs[i], mz, i) + m.innerHTML; + } + } + i++; + } + var i = 5; + while (i >= 1) { + if (zfloor0[i] != '') { + document.getElementById('Floor0').innerHTML += zfloor0[i]; + } + i--; + } + } + + var dConfig = { + 2: { + 1: {'top': 50, 'left': 140, 'w': 80, 'h': 147}, + 2: {'top': 45, 'left': 87, 'w': 80, 'h': 147}, + 3: {'top': 45, 'left': 192, 'w': 80, 'h': 147}, + 4: {'top': 49, 'left': 165, 'w': 80, 'h': 147}, + 5: {'top': 49, 'left': 105, 'w': 80, 'h': 147}, + 6: {'top': 53, 'left': 140, 'w': 80, 'h': 147}, + 7: {'top': 53, 'left': 87, 'w': 80, 'h': 147}, + 8: {'top': 53, 'left': 190, 'w': 80, 'h': 147} + }, + 3: { + 1: {'top': 60, 'left': 152, 'w': 53, 'h': 97}, + 2: {'top': 58, 'left': 110, 'w': 53, 'h': 97}, + 3: {'top': 58, 'left': 188, 'w': 53, 'h': 97}, + 4: {'top': 61, 'left': 168, 'w': 53, 'h': 97}, + 5: {'top': 61, 'left': 128, 'w': 53, 'h': 97}, + 6: {'top': 62, 'left': 153, 'w': 53, 'h': 97}, + 7: {'top': 62, 'left': 113, 'w': 53, 'h': 97}, + 8: {'top': 62, 'left': 193, 'w': 53, 'h': 97} + }, + 4: { + 1: {'top': 70, 'left': 158, 'w': 35, 'h': 64}, + 2: {'top': 68, 'left': 125, 'w': 35, 'h': 64}, + 3: {'top': 68, 'left': 193, 'w': 35, 'h': 64}, + 4: {'top': 71, 'left': 173, 'w': 35, 'h': 64}, + 5: {'top': 71, 'left': 137, 'w': 35, 'h': 64}, + 6: {'top': 73, 'left': 158, 'w': 35, 'h': 64}, + 7: {'top': 73, 'left': 129, 'w': 35, 'h': 64}, + 8: {'top': 73, 'left': 193, 'w': 35, 'h': 64} + } + } + var dConfigObj = { + 1: { + 0: { + 'top': 65, + 'left': 110, + 'w': 1, + 'h': 1 + } + } + , 2: { + 0: { + 'top': 65, + 'left': 110, + 'w': 0.65, + 'h': 0.65 + } + }, + 3: { + 0: { + 'top': 65, + 'left': 110, + 'w': 0.48, + 'h': 0.48 + } + }, + 4: { + 0: { + 'top': 65, + 'left': 110, + 'w': 0.35, + 'h': 0.35 + } + } + } + var prob = { + 0: { + 1: 1, + 2: 0.25, + 3: -0.10, + 4: -0.38 + }, + 1: { + 1: 0.90, + 2: 0.50, + 3: 0.23, + 4: 0.05 + } + }; + + function addObj(v, mz, iii) { + var r = ''; + //355*245 window + 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 (v[5] == dsee) { + rz -= 1; + } + if (dConfigObj[rz] != undefined && dConfigObj[rz][v[6]] != undefined) { + new_w = v[7] * dConfigObj[rz][v[6]]['w']; + new_h = v[8] * dConfigObj[rz][v[6]]['h']; + new_left = dConfigObj[rz][v[6]]['left'] - Math.round((v[7] * prob[0][rz]) / 4); + new_top = dConfigObj[rz][v[6]]['top'] - Math.round((v[8] * prob[1][rz]) / 4); + if (v[2] == 6) { + new_left += 195; + new_top -= 5; + } + if (v[2] == 4) { + new_left -= 195; + new_top -= 5; + } + if (v[2] == 9) { + new_left -= 140; + new_top -= 2; + } + if (v[2] == 7) { + new_left += 140; + new_top -= 2; + } + if (v[2] == 13) { + new_left += 100; + new_top -= 1; + } + if (v[2] == 11) { + new_left -= 100; + new_top -= 0; + } + if (v[9] != 0) { + new_left += Math.round(new_left / (100 + (rz - 1) * 10) * v[9] + rz * 0.25); + } + if (v[10] != 0) { + new_top += Math.round(new_h / 2 + new_top / (100 + (rz - 1) * 50) * v[10] - rz * 3.3); + } + if (rz == 4) { + new_top += 3; + } + if (v[11] != 0) { + if (v[11]['t' + rz] != undefined) { + new_top += v[11]['t' + rz]; + } + if (v[11]['l' + rz] != undefined) { + new_left += v[11]['l' + rz]; + } + if (v[11]['w' + rz] != undefined) { + new_w += v[11]['w' + rz]; + } + if (v[11]['h' + rz] != undefined) { + new_h += v[11]['h' + rz]; + } + if (v[11]['rt' + rz] != undefined) { + new_top = v[11]['rt' + rz]; + } + if (v[11]['rl' + rz] != undefined) { + new_left = v[11]['rl' + rz]; + } + } + ////i:{0:id,1:name,2:mapPoint,3:action,4:img,5:type}, + if (rz >= 1 && rz <= 2) { + actionNow = ''; + if (v[11]['use'] != undefined) { + if (v[11]['use'] == 'exit') { + actionNow = 'alert(\'Выход из подземелья\');'; + } else if (v[11]['use'] == 'takeit') { + actionNow = 'location=\'main.php?take_obj=' + v[0] + '&rnd=' + 0.28626200682069150 + '\';'; + } + } + zfloor0[rz] = '' + zfloor0[rz]; + } else { + zfloor0[rz] = '' + zfloor0[rz]; + } + r = ''; + } + 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' || 0 > 0) { + action = 'dialogMenu(' + v[0] + ',1,' + v[7] + ',0,0,event);'; + } + zfloor0[rz] += ''; + } else { + zfloor0[rz] += ''; + } + r = ''; + } + return r; + } + + 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 = 'main.php?go=' + id; + } else { + gotoup777 = id; + gotext777 = ttl; + } + } + + 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 = "main.php?go=" + gotoup777; + } + } + if (gotoup777 > 0 && gotext777 != '' && document.getElementById('gotext777').innerHTML != 'Вы перейдете ' + gotext777 + ' (отмена)') { + //document.getElementById('gotext777').style.display = 'block'; + document.getElementById('gotext777').innerHTML = 'Вы перейдете ' + gotext777 + ' (отмена)'; + } else if (document.getElementById('gotext777').innerHTML != '' && gotoup777 == 0 && gotext777 == '') { + //document.getElementById('gotext777').style.display = 'none'; + document.getElementById('gotext777').innerHTML = ''; + } + } + } + + + + + - - - - - - +
    -
    -
    -   Пещера#   - - -
    -
    -
    -
    - - - + - + + - - -
    - - Редактировать ботов - - - -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - info['admin']==0){ ?> -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - -
    +
    +
    +
    +   Пещера#   + + +
    +
    - - -
    - - - +
    + + + + + + +
    + + Редактировать ботов + + + +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + info['admin'] == 0){ ?> +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    + + + + +
    + + + + +
    +



    Пещера не существует
    '; + } else { + //Пещера существует + $min_x = mysql_fetch_array( + mysql_query( + 'SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $id + ) . '" ORDER BY `x` ASC LIMIT 1' + ) + ); + $max_x = mysql_fetch_array( + mysql_query( + 'SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $id + ) . '" ORDER BY `x` DESC LIMIT 1' + ) + ); + $min_y = mysql_fetch_array( + mysql_query( + 'SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $id + ) . '" ORDER BY `y` ASC LIMIT 1' + ) + ); + $max_y = mysql_fetch_array( + mysql_query( + 'SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $id + ) . '" ORDER BY `y` DESC LIMIT 1' + ) + ); + + $min_x = $min_x[0]; + $max_x = $max_x[0]; + $min_y = $min_y[0]; + $max_y = $max_y[0]; + + $map = []; + $stl = []; + + $sp = mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $id + ) . '" AND `x` >= ' . $min_x . ' AND `x` <= ' . $max_x . ' AND `y` >= ' . $min_y . ' AND `y` <= ' . $max_y . '' + ); + while ($pl = mysql_fetch_array($sp)) { + $style = 'vertical-align:bottom;'; + + if ($pl['st'][2] == 1) { + $style .= 'border-bottom:1px solid #6e6e6e;'; + } else { + $style .= 'padding-bottom:1px;'; + } + if ($pl['st'][1] == 1) { + $style .= 'border-left:1px solid #6e6e6e;'; + } else { + $style .= 'padding-left:1px;'; + } + if ($pl['st'][0] == 1) { + $style .= 'border-top:1px solid #6e6e6e;'; + } else { + $style .= 'padding-top:1px;'; + } + if ($pl['st'][3] == 1) { + $style .= 'border-right:1px solid #6e6e6e;'; + } else { + $style .= 'padding-right:1px;'; + } + + $map[$pl['x']][$pl['y']] = ''; + } + + echo '
    Карта пещеры (X: [' . $min_x . '] - [' . $max_x . '] , Y: [' . $min_y . '] - [' . $max_y . '])


    '; + + $r = ''; + $i = $max_y; + while ($i >= $min_y) { + $j = $min_x; + $r .= ''; + while ($j <= $max_x) { + if (isset($map[$j][$i])) { + $r .= ''; + } else { + $r .= ''; + } + $j++; + } + $r .= ''; + $i--; + } + $r .= '
    ' . $map[$j][$i] . '
    '; + + echo $r; + } + ?> +
    +
    +
    -



    Пещера не существует
    '; - }else{ - //Пещера существует - $min_x = mysql_fetch_array(mysql_query('SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" ORDER BY `x` ASC LIMIT 1')); - $max_x = mysql_fetch_array(mysql_query('SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" ORDER BY `x` DESC LIMIT 1')); - $min_y = mysql_fetch_array(mysql_query('SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" ORDER BY `y` ASC LIMIT 1')); - $max_y = mysql_fetch_array(mysql_query('SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" ORDER BY `y` DESC LIMIT 1')); - - $min_x = $min_x[0]; - $max_x = $max_x[0]; - $min_y = $min_y[0]; - $max_y = $max_y[0]; - - $map = array(); - $stl = array(); - - $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($id).'" AND `x` >= '.$min_x.' AND `x` <= '.$max_x.' AND `y` >= '.$min_y.' AND `y` <= '.$max_y.''); - while($pl = mysql_fetch_array($sp)) { - $style = 'vertical-align:bottom;'; - - if($pl['st'][2] == 1) { - $style .= 'border-bottom:1px solid #6e6e6e;'; - }else{ - $style .= 'padding-bottom:1px;'; - } - if($pl['st'][1] == 1) { - $style .= 'border-left:1px solid #6e6e6e;'; - }else{ - $style .= 'padding-left:1px;'; - } - if($pl['st'][0] == 1) { - $style .= 'border-top:1px solid #6e6e6e;'; - }else{ - $style .= 'padding-top:1px;'; - } - if($pl['st'][3] == 1) { - $style .= 'border-right:1px solid #6e6e6e;'; - }else{ - $style .= 'padding-right:1px;'; - } - - $map[$pl['x']][$pl['y']] = ''; - } - - echo '
    Карта пещеры (X: ['.$min_x.'] - ['.$max_x.'] , Y: ['.$min_y.'] - ['.$max_y.'])


    '; - - $r = ''; - $i = $max_y; - while($i >= $min_y) { - $j = $min_x; - $r .= ''; - while($j <= $max_x) { - if(isset($map[$j][$i])) { - $r .= ''; - }else{ - $r .= ''; - } - $j++; - } - $r .= ''; - $i--; - } - $r .= '
    '.$map[$j][$i].'
    '; - - echo $r; - } - ?> -
    - -
    - \ No newline at end of file diff --git a/dn_editor_bots.php b/dn_editor_bots.php index 5ba63c44..7d8a93d1 100644 --- a/dn_editor_bots.php +++ b/dn_editor_bots.php @@ -1,91 +1,104 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - +info['admin'] == 0) { - die(''); +if (!$u->info['admin']) { + die(''); } -if(isset($_GET['id_dn'])) { - $_POST['id_dn'] = $_GET['id_dn']; - $_POST['xx'] = $_GET['xx']; - $_POST['yy'] = $_GET['yy']; +if (isset($_GET['id_dn'])) { + $_POST['id_dn'] = $_GET['id_dn']; + $_POST['xx'] = $_GET['xx']; + $_POST['yy'] = $_GET['yy']; } -if( $_POST['new_bot_colvo'] < 1 ) { - $_POST['new_bot_colvo'] = 1; +if ($_POST['new_bot_colvo'] < 1) { + $_POST['new_bot_colvo'] = 1; } ?>
    -id пещеры:
    -x :
    -y :
    - + id пещеры:
    + x :
    + y :
    +
    --------------- Боты -------------:
    - 0 ){ - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.$pl['id_bot'].'" LIMIT 1')); - echo $i.'.['.$pl['id2'].'] '.$bot['login'].' [id '.$bot['id'].'] , [x'.$pl['colvo'].'] удалить
    '; - } elseif( $pl['bot_group'] != '' ){ - $bots = explode( ',', $pl['bot_group'] ); - $jjj=0; - echo $i.' .['.$pl['id2'].']'; - while( $jjj < count($bots) ){ - $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.$bots[$jjj].'" LIMIT 1')); - if( isset($bot['login']) ) echo ' '.$bot['login'].' [id '.$bot['id'].'], '; - $jjj++; - } - echo ' [x'.$pl['colvo'].'] удалить
    '; - } - $i++; +while ($pl = mysql_fetch_array($sp)) { + if ($pl['id_bot'] > 0) { + $bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $pl['id_bot'] . '" LIMIT 1')); + echo $i . '.[' . $pl['id2'] . '] ' . $bot['login'] . ' [id ' . $bot['id'] . '] , [x' . $pl['colvo'] . '] удалить
    '; + } elseif ($pl['bot_group'] != '') { + $bots = explode(',', $pl['bot_group']); + $jjj = 0; + echo $i . ' .[' . $pl['id2'] . ']'; + while ($jjj < count($bots)) { + $bot = mysql_fetch_array( + mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $bots[$jjj] . '" LIMIT 1') + ); + if (isset($bot['login'])) { + echo ' ' . $bot['login'] . ' [id ' . $bot['id'] . '], '; + } + $jjj++; + } + echo ' [x' . $pl['colvo'] . '] удалить
    '; + } + $i++; } echo '
    '; ?>
    -Добавить нового:
    - - - -ID бота:
    -Случайные боты:
    -Количество:
    -Перемещается: (0 - нет, 1 - да)
    - + Добавить нового:
    + + + + ID бота:
    + Случайные боты:
    + Количество:
    + Перемещается: (0 - нет, 1 - да)
    +
    \ No newline at end of file diff --git a/dn_editor_botsAll.php b/dn_editor_botsAll.php index 7f8eb2bd..1a79dcf2 100644 --- a/dn_editor_botsAll.php +++ b/dn_editor_botsAll.php @@ -1,63 +1,53 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - +info['id']) || $u->info['ip'] != IP || $u->info['admin'] == 0) { - die(''); +if (!isset($u->info['id']) || $u->info['ip'] != IP || !$u->info['admin']) { + die(''); } -if(isset($_GET['id_dn'])) { - $_POST['id_dn'] = $_GET['id_dn']; - $_POST['xx'] = $_GET['xx']; - $_POST['yy'] = $_GET['yy']; - $_POST['botlogin'] = $_GET['botlogin']; +if (isset($_GET['id_dn'])) { + $_POST['id_dn'] = $_GET['id_dn']; + $_POST['xx'] = $_GET['xx']; + $_POST['yy'] = $_GET['yy']; + $_POST['botlogin'] = $_GET['botlogin']; } -if( $_POST['new_bot_colvo'] < 1 ) { - $_POST['new_bot_colvo'] = 1; +if ($_POST['new_bot_colvo'] < 1) { + $_POST['new_bot_colvo'] = 1; } ?>
    -id пещеры:
    -botlogin:
    - + id пещеры:
    + botlogin:
    +
    --------------- Боты -------------:
    -[login:'.$bot['login'].']
    [id '.$bot['id'].'] , [stats:'.$bot['stats'].'] '.$bot['obraz'].'&level='.$bot['level'].'
    '; - echo "
    +
    "; - $i++; +while ($pl = mysql_fetch_array($sp)) { + echo "
    +
    "; + $i++; } -?> +?> - \ No newline at end of file diff --git a/dn_editor_bots_itms.php b/dn_editor_bots_itms.php index 03581cd6..168c2b27 100644 --- a/dn_editor_bots_itms.php +++ b/dn_editor_bots_itms.php @@ -1,86 +1,86 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - +info['admin'] == 0) { - die(''); +if (!$u->info['admin']) { + die(''); } ?> -
    -id бота:
    - -
    ---------------- Бот -------------
    - + id бота:
    + + + --------------- Бот -------------
    + -
    -Логин:
    -Образ:
    -Уровень:
    -Пол: (0 - муж. , 1 - жен.)
    -Имя:
    -Агрессия: (0-100%)
    -Опыт (%):
    -Статы:
    - -
    -Предметы (на боте, 2605 - использует приемы. Перечислять чреез запятую id предмета):
    - -
    -Предметы которые падают с бота:
    - -
    - +
    + Логин:
    + Образ:
    + Уровень:
    + Пол: (0 - муж. , 1 - жен.)
    + Имя:
    + Агрессия: (0-100%)
    + Опыт (%):
    + Статы:
    + +
    + Предметы (на боте, 2605 - использует приемы. Перечислять чреез запятую id предмета):
    + +
    + Предметы которые падают с бота:
    + +
    + \ No newline at end of file diff --git a/dn_editor_class.php b/dn_editor_class.php deleted file mode 100644 index b506fd69..00000000 --- a/dn_editor_class.php +++ /dev/null @@ -1,693 +0,0 @@ - array() //карта - ) ,$id_dng,$cord = array('x' => 0),$sg = array(1 => array(1=>1,2=>2,3=>3,4=>4),2 => array(1=>2,2=>3,3=>4,4=>1),3 => array(1=>3,2=>4,3=>1,4=>2),4 => array(1=>4,2=>1,3=>2,4=>3)); - public function start() - { - global $u,$c,$code,$id; - $this->info = array( - 'id2' => $id, - 'id' => 0, - 'name' => 'Редактирование Пещеры', - 'room' => 0, - 'time_start' => time(), - 'time_start' => 0, - 'uid' => 0, - 'type' => 0, - 'bsid' => 0 - ); - - $this->id_dng = $this->info['id2']; - $this->gs = $u->info['psevdo_s']; - if($this->gs<1 || $this->gs>4) - { - $this->gs = 1; - } - - if($this->info['bsid']>0) - { - $this->bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "'.$u->info['city'].'" AND `id` = "'.$this->info['bsid'].'" AND `time_start` = "'.$this->info['time_start'].'" LIMIT 1')); - if(isset($this->bs['id'])) - { - //Если БС закончена - if($this->bs['users']-$this->bs['users_finish'] < 2) - { - $u->bsfinish($this->bs,false,NULL); - } - } - } - - /* генерируем вид персонажа (только карта) - $this->gs = 1; //смотрим прямо - 2; //смотрим лево - 3; //смотрим вниз - 4; //смотрим право - ( ( ( `y` >= '.$u->info['psevdo_y'].' && `y` <= '.($u->info['psevdo_y']+4).' ) && ( `x` >= '.($u->info['psevdo_x']-1).' && `x` <= '.($u->info['psevdo_x']+1).' ) ) || ( (`x` = '.($u->info['psevdo_x']+2).' || `x` = '.($u->info['psevdo_x']-2).') && ( `y` = '.($u->info['psevdo_y']+3).' || `y` = '.($u->info['psevdo_y']+4).' ) ) ) - */ - - $whr = array( - 1 => ' ((`x` <= '.($u->info['psevdo_x']+2).' && `x` >= '.($u->info['psevdo_x']-2).') && (`y` >= '.$u->info['psevdo_y'].' && `y` <= '.($u->info['psevdo_y']+4).')) ', //прямо - 3 => ' ((`x` <= '.($u->info['psevdo_x']+2).' && `x` >= '.($u->info['psevdo_x']-2).') && (`y` <= '.$u->info['psevdo_y'].' && `y` >= '.($u->info['psevdo_y']-4).')) ', //вниз - 2 => ' ((`x` <= '.$u->info['psevdo_x'].' && `x` >= '.($u->info['psevdo_x']-4).') && (`y` <= '.($u->info['psevdo_y']+2).' && `y` >= '.($u->info['psevdo_y']-2).')) ', //лево - 4 => ' ((`x` >= '.$u->info['psevdo_x'].' && `x` <= '.($u->info['psevdo_x']+4).') && (`y` <= '.($u->info['psevdo_y']+2).' && `y` >= '.($u->info['psevdo_y']-2).')) ' //право - ); - - $i = 1; - $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$this->id_dng.'" AND '.$whr[$this->gs].' ORDER BY `y` ASC , `x` ASC LIMIT 25'); - while($pl = mysql_fetch_array($sp)) - { - $this->map[0][$pl['y'].'_'.$pl['x']] = $pl; - $i++; - } - $this->map['good'] = $i; //целых клеток - $this->map[1] = $this->genMatix(); - $this->lookDungeon(); - - - } - - public function usersDng() - { - global $u,$c; - $r = ''; - /* отображение ботов (бесполезно в данном редакторе) */ - } - - public function atack($id) - { - global $u,$c,$code; - /* нападение, какое нападение может быть в редакторе? :) На самого себя, со стулом? :) */ - } - - public function takeinv($id) - { - global $u,$c,$code; - /* Это редактор, а не майнкрафт, здесь ничего собирать не нужно :) */ - } - - public function takeit($id) - { - global $u,$c,$code,$magic; - /* В редакторе ничего не падает ;) */ - } - - public function addItem($i) - { - //добавляем предмет в пещеру (возможно выпал из бота или из сундука) - /* А что еще? Пульт к управлению Землей?! */ - } - - public function itemsMap() - { - global $u,$c,$code; - /* Да ничего здесь не падает! Говорю же! */ - } - - public function testLike($x1,$y1,$x2,$y2) - { - //из $x1,$y1 в $x2,$y2 - //доступна-ли эта клетка для действий - $r = 0; - $c1 = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "'.$x1.'" AND `y` = "'.$y1.'" AND `id_dng` = "'.$this->info['id2'].'" LIMIT 1')); - $c2 = mysql_fetch_array(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 = array( - 1 => ' ((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` >= '.($u->info['psevdo_y']+1).' && `u`.`y` <= '.($u->info['psevdo_y']+4).')) ', //прямо - 3 => ' ((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` <= '.($u->info['psevdo_y']-1).' && `u`.`y` >= '.($u->info['psevdo_y']-4).')) ', //вниз - 2 => ' ((`u`.`x` <= '.($u->info['psevdo_x']-1).' && `u`.`x` >= '.($u->info['psevdo_x']-4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).')) ', //лево - 4 => ' ((`u`.`x` >= '.($u->info['psevdo_x']+1).' && `u`.`x` <= '.($u->info['psevdo_x']+4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).')) ' //право - ); - */ - $whr = array( - 1 => ' (((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` >= '.($u->info['psevdo_y']+1).' && `u`.`y` <= '.($u->info['psevdo_y']+4).')) OR (`u`.`y` = '.$u->info['psevdo_y'].' && `u`.`x` = '.$u->info['psevdo_x'].')) ', //прямо - 3 => ' (((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` <= '.($u->info['psevdo_y']-1).' && `u`.`y` >= '.($u->info['psevdo_y']-4).')) OR (`u`.`y` = '.$u->info['psevdo_y'].' && `u`.`x` = '.$u->info['psevdo_x'].')) ', //вниз - 2 => ' (((`u`.`x` <= '.($u->info['psevdo_x']-1).' && `u`.`x` >= '.($u->info['psevdo_x']-4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).'))OR (`u`.`y` = '.$u->info['psevdo_y'].' && `u`.`x` = '.$u->info['psevdo_x'].')) ', //лево - 4 => ' (((`u`.`x` >= '.($u->info['psevdo_x']+1).' && `u`.`x` <= '.($u->info['psevdo_x']+4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).')) OR (`u`.`y` = '.$u->info['psevdo_y'].' && `u`.`x` = '.$u->info['psevdo_x'].')) ' //право - ); - $sp = mysql_query('SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "0" AND `u`.`for_dn` = "'.$this->id_dng.'" AND ((`u`.`s` = "0" OR `u`.`s` = "'.$this->gs.'") OR `u`.`s2` = "'.$this->gs.'") AND '.$whr[$this->gs].' LIMIT 76'); - # die('SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "0" AND `u`.`for_dn` = "'.$this->id_dng.'" AND ((`u`.`s` = "0" OR `u`.`s` = "'.$this->gs.'") OR `u`.`s2` = "'.$this->gs.'") AND '.$whr[$this->gs].' LIMIT 76'); - $i = 0; $pos = array(); - while($pl = mysql_fetch_array($sp)) { - - if($pl['fix_x_y'] == 0 || - ($pl['fix_x_y'] == 1 && $pl['x'] == $u->info['psevdo_x']) || - ($pl['fix_x_y'] == 2 && $pl['y'] == $u->info['psevdo_y']) || - ($pl['fix_x_y'] == 3 && $pl['x'] == $u->info['psevdo_x'] && $pl['y'] == $u->info['psevdo_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).':{\'x\':'.$pl['x'].',\'y\':'.$pl['y'].',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'].',12:'.$pl['type'].',13:'.$pl['type2'].',14:'.$pl['s'].',15:'.$pl['s2'].',16:'.$pl['os1'].',17:'.$pl['os2'].',18:'.$pl['os3'].',19:'.$pl['os4'].',20:'.$pl['fix_x_y'].'}'; - } 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 = array(); - $is = 0; - while($is < count($dt2)) { - $dt2[$is] = explode(':',$dt2[$is]); - $da[$dt2[$is][0]] = $dt2[$is][1]; - $is++; - } - #if(isset($da['rl2']))$da['rl2'] = -round((int)$da['rl2'] * 0.70); // Слева - if(isset($da['rl2']))$da['rl2'] = round((int)$da['rl2'] -230); // Слева - 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).':{\'x\':'.$pl['x'].',\'y\':'.$pl['y'].',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'].',12:'.$pl['type'].',13:'.$pl['type2'].',14:'.$pl['s'].',15:'.$pl['s2'].',16:'.$pl['os1'].',17:'.$pl['os2'].',18:'.$pl['os3'].',19:'.$pl['os4'].',20:'.$pl['fix_x_y'].'}'; - } else if( $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 = array(); - $is = 0; - while($is < count($dt2)) { - $dt2[$is] = explode(':',$dt2[$is]); - $da[$dt2[$is][0]] = $dt2[$is][1]; - $is++; - } - #if(isset($da['rl2']))$da['rl2'] = 355-round((int)$da['rl2'] * 0.30); // Справа - if(isset($da['rl2']))$da['rl2'] = round((int)$da['rl2'] +230); // Справа - 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).':{\'x\':'.$pl['x'].',\'y\':'.$pl['y'].',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'].',12:'.$pl['type'].',13:'.$pl['type2'].',14:'.$pl['s'].',15:'.$pl['s2'].',16:'.$pl['os1'].',17:'.$pl['os2'].',18:'.$pl['os3'].',19:'.$pl['os4'].',20:'.$pl['fix_x_y'].'}'; - } - } - } - $r = 'count:'.$i.$r; - return $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 = array( - 1 => ' ((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` >= '.$u->info['psevdo_y'].' && `u`.`y` <= '.($u->info['psevdo_y']+4).')) ', //прямо - 3 => ' ((`u`.`x` <= '.($u->info['psevdo_x']+2).' && `u`.`x` >= '.($u->info['psevdo_x']-2).') && (`u`.`y` <= '.$u->info['psevdo_y'].' && `u`.`y` >= '.($u->info['psevdo_y']-4).')) ', //вниз - 2 => ' ((`u`.`x` <= '.$u->info['psevdo_x'].' && `u`.`x` >= '.($u->info['psevdo_x']-4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).')) ', //лево - 4 => ' ((`u`.`x` >= '.$u->info['psevdo_x'].' && `u`.`x` <= '.($u->info['psevdo_x']+4).') && (`u`.`y` <= '.($u->info['psevdo_y']+2).' && `u`.`y` >= '.($u->info['psevdo_y']-2).')) ' //право - ); - $i = 0; - //отображаем ботов - $sp = mysql_query('SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE '.$whr[$this->gs].' AND `dn` = "0" AND `for_dn` = "'.$this->id_dng.'" AND `u`.`delete` = "0" LIMIT 50'); - while($pl = mysql_fetch_array($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']; - } - $r .= ','.($i-1).':{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.'}'; - } - $r = 'count:'.$i.$r; - //$wd = $this->cord['2_0']; - return $r; - } - - public function botAtack($bot,$uid,$bs) { - global $u,$c,$code; - $user = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "'.$uid['id'].'" LIMIT 1')); - if($user['battle']>0){ - $btli = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['battle'].'" AND `team_win` = "-1" LIMIT 1')); - } - if(!isset($btli['id'])){ - //Создаем поединок - $btl_id = 0; - $expB = 0; - $btl = array( - 'players'=>'', - 'timeout'=>180, - 'type'=>0, - 'invis'=>0, - 'noinc'=>0, - 'travmChance'=>0, - 'typeBattle'=>0, - 'addExp'=>$expB, - 'money'=>0 - ); - - $ins = 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'].'")'); - $btl_id = mysql_insert_id(); - - if($btl_id>0){ - //Добавляем ботов - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "0" AND `dn` = "'.$this->info['id'].'" AND `x` = "'.$bot['x'].'" AND `y` = "'.$bot['y'].'" LIMIT 50'); - $j = 0; $logins_bot = array(); - while($pl = mysql_fetch_array($sp)){ - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "'.$btl_id.'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - $jui = 1; - while($jui<=$pl['colvo']){ - $k = $u->addNewbot($pl['id_bot'],NULL,NULL,$logins_bot); - $logins_bot = $k['logins_bot']; - if($k!=false) { - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $upd = mysql_query('UPDATE `stats` SET `x`="'.$bot['x'].'",`y`="'.$bot['y'].'",`team` = "1" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd){ - $j++; - } - } - } - $jui++; - } - } - unset($logins_bot); - if($j>0) - { - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$user['id'].'" LIMIT 1'); - } - } - }else{ - //Вмешиваемся в поединок - - } - } - - public function testGo($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_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "'.$u->info['psevdo_x'].'" AND `y` = "'.$u->info['psevdo_y'].'" AND `id_dng` = "'.$this->info['id2'].'" LIMIT 1')); - $ng = array( - 4=>1, - 2=>2, - 1=>3, - 3=>4 - ); - if(isset($thp['id']) && $thp['go_'.$ng[$go]]==0) - { - $go = 0; - } - $tgo = array(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_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "'.($u->info['psevdo_x']+(int)$tgo[0]).'" AND `y` = "'.($u->info['psevdo_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; - } - - $tmap = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "'.$u->info['psevdo_x'].'" AND `y` = "'.$u->info['psevdo_y'].'" AND `id_dng` = "'.$this->info['id2'].'" LIMIT 1')); - //наличие предмета - if($tmap['tr_items']!='') - { - $ti = explode(',',$tmap['tr_items']); - $i = 0; $trnit = ''; - while($i0 && $ti2[1]>0) - { - $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "'.((int)$ti2[0]).'" LIMIT '.((int)$ti2[1]).'')); - if($num_rows < (int)$ti2[1]) - { - $tgo = $ti2[2]; - if($tgo!='0000') - { - if($tgo[$ng[$go]-1]==1) - { - $go = 0; - $trm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.((int)$ti2[0]).'" LIMIT 1')); - $trnit .= '"'.$trm['name'].'", '; - } - } - } - } - $i++; - } - if($trnit!='') - { - $trnit = rtrim($trnit,', '); - $this->error = 'У вас нет подходящего предмета. Требуется '.$trnit; - } - } - - $tmGo = $u->info['timeGo']-time(); //сколько секунд осталось - if($tmGo>0) - { - $go = 0; - $this->error = 'Не так быстро...'; - } - - if($u->aves['now']>=$u->aves['max']) - { - $go = 0; - $this->error = 'Вы не можете перемещаться, рюкзак переполнен ...'; - } - - if($go>0) - { - if($go==1) - { - $u->info['psevdo_y'] += 1; - }elseif($go==2) - { - $u->info['psevdo_x'] -= 1; - }elseif($go==3) - { - $u->info['psevdo_y'] -= 1; - }elseif($go==4) - { - $u->info['psevdo_x'] += 1; - } - $u->info['timeGo'] = time()+$tmap['timeGO']; - $u->info['timeGoL'] = time(); - $upd = mysql_query('UPDATE `stats` SET `x` = "'.$u->info['psevdo_x'].'",`y` = "'.$u->info['psevdo_y'].'",`timeGo` = "'.$u->info['timeGo'].'",`timeGoL` = "'.$u->info['timeGoL'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - - 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_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "'.$u->info['psevdo_x'].'" AND `y` = "'.$u->info['psevdo_y'].'" AND `id_dng` = "'.$this->info['id2'].'" LIMIT 1')); - $ng = array( - 4=>1, - 2=>2, - 1=>3, - 3=>4 - ); - if(isset($thp['id']) && $thp['go_'.$ng[$go]]==0) - { - $go = 0; - } - $tgo = array(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_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `x` = "'.($u->info['psevdo_x']+(int)$tgo[0]).'" AND `y` = "'.($u->info['psevdo_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; - } - - $tmap = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `x` = "'.$u->info['psevdo_x'].'" AND `y` = "'.$u->info['psevdo_y'].'" AND `id_dng` = "'.$this->info['id2'].'" LIMIT 1')); - //наличие предмета - /* - if($tmap['tr_items']!='') - { - $ti = explode(',',$tmap['tr_items']); - $i = 0; $trnit = ''; - while($i0 && $ti2[1]>0) - { - $num_rows = mysql_num_rows(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `item_id` = "'.((int)$ti2[0]).'" LIMIT '.((int)$ti2[1]).'')); - if($num_rows < (int)$ti2[1]) - { - $tgo = $ti2[2]; - if($tgo!='0000') - { - if($tgo[$ng[$go]-1]==1) - { - $go = 0; - } - } - } - } - $i++; - } - } - */ - - 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)]; - } - return $r; - } - - public function lookDungeon() - { - global $u,$c,$code,$pd; - /* Генерируем изображение карты */ - /* LEVEL 1 */ - if($this->testSt(2,4)>0 || $this->testSt(3,2)>0){ $pd[28] = 1; } - if($this->testSt(1,4)>0 || $this->testSt(2,2)>0){ $pd[27] = 1; } - if($this->testSt(2,1)>0 || $this->testSt(5,3)>0){ $pd[26] = 1; } - if($this->testSt(3,1)>0 || $this->testSt(6,3)>0){ $pd[25] = 1; } - if($this->testSt(1,1)>0 || $this->testSt(4,3)>0){ $pd[24] = 1; } - - /* LEVEL 2 */ - if($this->testSt(5,4)>0 || $this->testSt(6,2)>0){ $pd[23] = 1; } - if($this->testSt(4,4)>0 || $this->testSt(5,2)>0){ $pd[22] = 1; } - if($this->testSt(5,1)>0 || $this->testSt(8,3)>0){ $pd[21] = 1; } - if($this->testSt(6,1)>0 || $this->testSt(7,3)>0){ $pd[20] = 1; } - if($this->testSt(4,1)>0 || $this->testSt(9,3)>0){ $pd[19] = 1; } - - /* LEVEL 3 */ - if($this->testSt(8,4)>0 || $this->testSt(7,2)>0){ $pd[18] = 1; } - if($this->testSt(9,4)>0 || $this->testSt(8,2)>0){ $pd[17] = 1; } - if($this->testSt(8,1)>0 || $this->testSt(12,3)>0){ $pd[16] = 1; } - if($this->testSt(7,1)>0 || $this->testSt(13,3)>0){ $pd[15] = 1; } - if($this->testSt(9,1)>0 || $this->testSt(11,3)>0){ $pd[14] = 1; } - - /* LEVEL 4 */ - if($this->testSt(12,4)>0 || $this->testSt(13,2)>0){ $pd[13] = 1; } - if($this->testSt(12,2)>0 || $this->testSt(11,4)>0){ $pd[12] = 1; } - if($this->testSt(13,1)>0 || $this->testSt(17,3)>0){ $pd[11] = 1; } //8 - if($this->testSt(11,1)>0 || $this->testSt(16,3)>0){ $pd[10] = 1; } //7 - if($this->testSt(12,1)>0 || $this->testSt(15,3)>0){ $pd[9] = 1; } - if($this->testSt(14,1)>0 || $this->testSt(18,3)>0){ $pd[6] = 1; } //2 - if($this->testSt(10,1)>0 || $this->testSt(19,3)>0){ $pd[5] = 1; } //1 - if($this->testSt(16,4)>0 || $this->testSt(15,2)>0){ $pd[4] = 1; } - if($this->testSt(15,4)>0 || $this->testSt(17,2)>0){ $pd[3] = 1; } - - /* Генерируем предметы на карте */ - - /* Генерируем персонажей и ботов на карте */ - - } - - public function getMatrix($y,$x) - { - global $u; - $this->cord['x']++; - $this->cord[($u->info['psevdo_y']+$y).'_'.($u->info['psevdo_x']+$x)] = $this->cord['x']; - return $this->map[0][($u->info['psevdo_y']+$y).'_'.($u->info['psevdo_x']+$x)]; - } - - public function genMatix() - { - $r = array(); - 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); - $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 == 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; - } -} - -$d = new dungeon; -$d->start(); -?> \ No newline at end of file diff --git a/dncon.php b/dncon.php index 05f059de..f5540c4a 100644 --- a/dncon.php +++ b/dncon.php @@ -1,85 +1,78 @@ -'; - } - }elseif( $_GET['step'] == 2 ) { - $sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "'.mysql_real_escape_string($dng).'" ORDER BY `id` ASC'); - while( $pl = mysql_fetch_assoc($sp) ) { - $sql .= array_to_sql('dungeon_obj',$pl,'id','NULL').'
    '; - } - }elseif( $_GET['step'] == 3 ) { - $sm = 200; // смещение ботов - $botadd = array(); - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "'.mysql_real_escape_string($dng).'" ORDER BY `id2` ASC'); - while( $pl = mysql_fetch_assoc($sp) ) { - $botsel = mysql_fetch_assoc(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.$pl['id_bot'].'" LIMIT 1')); - if(isset($botsel['id'])) { - $pl['id_bot'] += $sm; - if(!isset($botadd[$pl['id_bot']])) { - $botadd[$pl['id_bot']] = true; - $sql .= array_to_sql('test_bot',$botsel,'id','"'.$pl['id_bot'].'"').'
    '; - } - $sql .= array_to_sql('dungeon_bots',$pl,'id2','NULL').'
    '; - } - } - }elseif( $_GET['setp'] == 4 ) { - - } - - - echo $sql; - -}else{ - die('Доступ закрыт!'); +if (!isset($_GET['for'])) { + die('Доступ закрыт!'); +} +function array_to_sql($t, $m, $id_name, $id) +{ + $k = array_keys($m); + $a = ''; + $b = ''; + $i = 0; + while ($i < count($k)) { + $a .= ',`' . $k[$i] . '`'; + if ($id && $k[$i] == $id_name) { + $b .= ',' . $id; + } else { + $b .= ',"' . str_replace('"', '"', $m[$k[$i]]) . '"'; + } + $i++; + } + $a = ltrim($a, ','); + $b = ltrim($b, ','); + return 'INSERT INTO `' . $t . '` ( ' . $a . ' ) VALUES ( ' . $b . ' );'; } -?> \ No newline at end of file +$dng = (int)$_GET['dng']; + +$sql = ''; + +$test_bot = []; +$dungeon_bots = []; +$dungeon_items = []; +$dungeon_obj = []; +$dungeon_map = []; +$items_main = []; +$eff_main = []; + +// +if ($_GET['step'] == 1) { + $sp = mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( + $dng + ) . '" ORDER BY `x`, `y`' + ); + while ($pl = mysql_fetch_assoc($sp)) { + $sql .= array_to_sql('dungeon_map', $pl, 'id', 'NULL') . '
    '; + } +} elseif ($_GET['step'] == 2) { + $sp = mysql_query( + 'SELECT * FROM `dungeon_obj` WHERE `for_dn` = "' . mysql_real_escape_string($dng) . '" ORDER BY `id` ASC' + ); + while ($pl = mysql_fetch_assoc($sp)) { + $sql .= array_to_sql('dungeon_obj', $pl, 'id', 'NULL') . '
    '; + } +} elseif ($_GET['step'] == 3) { + $sm = 200; // смещение ботов + $botadd = []; + $sp = mysql_query( + 'SELECT * FROM `dungeon_bots` WHERE `for_dn` = "' . mysql_real_escape_string($dng) . '" ORDER BY `id2` ASC' + ); + while ($pl = mysql_fetch_assoc($sp)) { + $botsel = mysql_fetch_assoc( + mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $pl['id_bot'] . '" LIMIT 1') + ); + if (isset($botsel['id'])) { + $pl['id_bot'] += $sm; + if (!isset($botadd[$pl['id_bot']])) { + $botadd[$pl['id_bot']] = true; + $sql .= array_to_sql('test_bot', $botsel, 'id', '"' . $pl['id_bot'] . '"') . '
    '; + } + $sql .= array_to_sql('dungeon_bots', $pl, 'id2', 'NULL') . '
    '; + } + } +} +echo $sql; diff --git a/dress.php b/dress.php deleted file mode 100644 index f49a59a5..00000000 --- a/dress.php +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    - - - - - - -
    - логин, слоты, приемы, обкасты - - Статы, Умения, Статы за награду, зверь, склонка, образ, клан - - Основные, Модификаторы, Мощность, Защита, Прочее - - Стоимость, дополнительные настройки -
    Описание и благодарности.
    - - \ No newline at end of file diff --git a/editor_shop.php b/editor_shop.php index 0bc9c8d8..a9d7f367 100644 --- a/editor_shop.php +++ b/editor_shop.php @@ -1,12 +1,13 @@ -info['id']) || $u->info['admin'] < 1) { - header('location: /index.php'); - die(); +if (!$u->info['admin']) { + header('location: /index.php'); + die(); } $sid = round((int)$_GET['sid']); @@ -15,129 +16,154 @@ $r = round((int)$_GET['r']); - -Редактор предметов в магазине - - + + Редактор предметов в магазине + + -
    - - - + + + + + + + +

    Магазин: - + + - - - - - - - -

    Магазин: + - Раздел магазина: - -

    -

    ОБНОВИТЬ СТРАНИЦУ
    -
    -

    -
    -
    Добавить предмет (id предмета): в этот раздел.


    - - - - - - -
    -
    - Кол-во:
    - # -
    - -
    -
    - Цена в базе: кр.
    - Цена в базе: екр.
    - Цена в магазине: кр.
    - Цена в магазине: екр.
    -



    -

    -
    + "' . mysql_real_escape_string($_POST['item_add']) . '","1000000000","' . $sid . '","' . $r . '","1" + )' + ); + } + + $sp = mysql_query('SELECT `sid` FROM `items_shop` GROUP BY `sid`'); + while ($pl = mysql_fetch_array($sp)) { + echo ''; + } + ?> + + Раздел магазина: + +

    +

    ОБНОВИТЬ СТРАНИЦУ
    +
    +

    +
    +
    Добавить предмет (id предмета): в этот + раздел.

    +
    +
    + + + + + + +
    +
    + Кол-во:
    + # +
    + +
    +
    + Цена в базе: кр.
    + Цена в базе: екр. +
    + Цена в магазине: кр.
    + Цена в магазине: екр. +
    +



    +
    +
    +
    \ No newline at end of file diff --git a/ekr.bac.php b/ekr.bac.php deleted file mode 100644 index 499641da..00000000 --- a/ekr.bac.php +++ /dev/null @@ -1,1013 +0,0 @@ -0.13 ЕКР
    . Приятной Вам игры! - - include('_incl_data/__config.php'); - include('_incl_data/class/__db_connect.php'); - include('_incl_data/class/__user.php'); - if(!isset($u->info['id'])) { - header('location: https://new-combats.com/'); - die(); - } - - class upload { - - protected function __construct() { } - - //static $save_path = '/var/www/bk2ru/data/www/new-combats.com/clan_prw/'; - static $save_path = 'clan_prw/'; - static $error = ''; - - static function saveimg($name,$max_mb = 2,$exts = 'jpg|png|jpeg|gif',$cnm = '',$mnw = 0,$mxw = 0,$mnh = 0,$mxh = 0) { - if (isset($_FILES[$name])) { - $f = &$_FILES[$name]; - if(isset($f['tmp_name'])) { - $width = 0; - $height = 0; - list($width, $height) = getimagesize($f['tmp_name']); - } - - if( $mnw != 0 && $mnw > $width ) { - self::$error = 'Минимальная ширина картинки '.$mnw.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mxw != 0 && $mxw < $width ) { - self::$error = 'Максимальная ширина картинки '.$mxw.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mnh != 0 && $mnh > $height ) { - self::$error = 'Минимальная высота картинки '.$mnh.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mxh != 0 && $mxh < $height ) { - self::$error = 'Максимальная высота картинки '.$mxh.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( !is_dir( self::$save_path ) ) { - self::$error = 'Ошибка на стороне сервера!'; - }elseif (($f['size'] <= $max_mb*1024*1024) && ($f['size'] > 0)) { - if ( - (preg_match('/\.('.$exts.')$/i',$f['name'],$ext))&& - (preg_match('/image/i',$f['type'])) - ) { - - $ext[1] = strtolower($ext[1]); - $fn = uniqid('f_',true).'.'.$ext[1]; - $fn2 = uniqid('f_',true).'.gif'; - if( $cnm != '' ) { - $fn = $cnm; - $fn2 = $cnm; - } - if (move_uploaded_file($f['tmp_name'], self::$save_path . $fn)) { - // система изменения размера , требуется Rimage - //Rimage::resize(self::$save_path . $fn, self::$save_path . $fn2); - //@unlink(self::$save_path . $fn); // удаление файла - return array($fn2,$fn,self::$save_path . $fn); - } else { - self::$error = 'Ошибка загрузки файла'; - } - } else { - self::$error = 'Неверный тип файла. Допустимые типы : '.$exts.''; - } - } else { - self::$error = 'Неверный размер файла. Максимальный размер файла '.$max_mb.' МБ'; - } - } else { - self::$error = 'Файл не найден'; - } - return false; - } // end saveimg - - } // end class - - $ball = mysql_fetch_array(mysql_query('SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "'.$u->info['id'].'" AND `good` > 0 LIMIT 1')); - $ball = 0+$ball[0]; -}else{ - $ball = mysql_fetch_array(mysql_query('SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "'.$user['id'].'" AND `good` > 0 LIMIT 1')); - $ball = 0+$ball[0]; -} - -$day1def = 50; //сколько екр. в день можно менять на кр. -$day2def = 1000 * ($u->info['level']-7); //сколько кр. в день можно менять на екр. - -$day1 = $day1def; -$day2 = $day2def; - -if( $day2 < 0 ) { $day2 = 0; } - -$timetoday = strtotime(date('d.m.Y')); -// -$dc1 = mysql_fetch_array(mysql_query('SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен ЕКР на КР" LIMIT 1')); -$dc2 = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен КР на ЕКР" LIMIT 1')); -$dc1 = $dc1[0]; -$dc2 = $dc2[0]; - -$day1 = round($day1+$dc1,2); -$day2 = round($day2+$dc2,2); - -if($day1 < 0) { $day1 = 0; } -if($day2 < 0) { $day2 = 0; } - - -$b1 = 0; //бонус накопительный - -$bt = mysql_fetch_array(mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1')); - -$bns = array( - array( 0 , 0 , 0 ), - array( 10 , 1 , 0 ), - array( 50 , 2 , 0 ), - array( 100 , 3 , 0 ), - array( 200 , 4 , 0 ), - array( 300 , 5 , 0 ), - array( 400 , 6 , 0 ), - array( 500 , 7 , 0 ), - array( 600 , 8 , 0 ), - array( 700 , 9 , 0 ), - array( 800 , 10 , 0 ), - array( 900 , 11 , 0 ), - array( 1000 , 13 , 1 ), - array( 1100 , 15 , 2 ), - array( 1200 , 17 , 3 ), - array( 1300 , 19 , 4 ), - array( 1500 , 21 , 5 ), - array( 1700 , 23 , 6 ), - array( 2000 , 25 , 7 ), - array( 2500 , 27 , 8 ), - array( 3000 , 30 , 9 ) -); - -$bns2 = array( - array(0,0), - array(10,10), - array(20,10), - array(30,10), - array(40,10), - array(50,10), - array(60,10), - array(70,10), - array(80,10), - array(90,10), - array(100,20) -); - -$i = 0; -while( $i < count($bns) ) { - if( isset($bns[$i][0]) && $ball > $bns[$i][0] ) { - $b1 = $i; - } - $i++; -} - -if( isset($backdoor) ) { - $i = 0; - while( $i < count($bns2) ) { - if( isset($bns2[$i][0]) && $pay['ekr'] >= $bns2[$i][0] ) { - $b2 = $i; - } - $i++; - } -} - -if(!isset($backdoor)) { - - if(isset($_POST['do']) && $_POST['do'] == 'newShadow') { - $o = mysql_fetch_array(mysql_query('SELECT * FROM `_obraz` WHERE `uid` = "'.$u->info['id'].'" AND `good` = 0 AND `cancel` = 0 AND `img` = "'.mysql_real_escape_string($_POST['ffinput']).'" LIMIT 1')); - if(!isset($o['id'])) { - $u->error = 'Данный образ не найден! Возможно он уже был подтвержден!'; - }elseif( $o['price'] > $u->info['money2'] ) { - $u->error = 'На счету недостаточно ЕКР'; - }else{ - // - $u->info['money2'] -= $o['price']; - mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `_obraz` SET `good` = "'.time().'" WHERE `id` = "'.$o['id'].'" LIMIT 1'); - if( $o['type'] == 1 || $o['type'] == 2 ) { - //Личный или Клановый - copy('clan_prw/'.$o['img'],'./img.new-combats.com/i/obraz/'.$o['sex'].'/buy'.$o['id'].'.gif'); - }elseif( $o['type'] == 3 ) { - //Питомец - copy('clan_prw/'.$o['img'],'./img.new-combats.com/pet/buy'.$o['id'].'.gif'); - }elseif( $o['type'] == 5 ) { - //Питомец - copy('clan_prw/'.$o['img'],'./img.new-combats.com/i/smile/s'.$o['id'].'.gif'); - } - // - if( $_POST['ffsex'] == 1 ) { - $o['sex'] = 1; - }elseif( $_POST['ffsex'] == 0 ) { - $o['sex'] = 0; - } - // - if( $o['clan'] > 0 ) { - $o['uid1'] = 0; - }else{ - $o['uid1'] = $o['uid']; - } - // - if( $o['type'] == 1 || $o['type'] == 2 ) { - //Личный и клановый - mysql_query('INSERT INTO `obraz` ( - `sex`,`uid`,`img`,`usr_add`,`clan` - ) VALUES ( - "'.$o['sex'].'","'.$o['uid1'].'","buy'.$o['id'].'.gif","'.$o['uid'].'","'.$o['clan'].'" - )'); - }elseif( $o['type'] == 3 ) { - //Питомца - mysql_query('INSERT INTO `obraz_pet` ( - `uid`,`time`,`img` - ) VALUES ( - "'.$u->info['id'].'","'.time().'","'.mysql_real_escape_string('buy'.$o['id'].'.gif').'" - )'); - }elseif( $o['type'] == 5 ) { - //Смайлик - $u->info['add_smiles'] .= ',s'.$o['id'].''; - $u->info['add_smiles'] = ltrim($u->info['add_smiles'],','); - mysql_query('UPDATE `users` SET `add_smiles` = "'.$u->info['add_smiles'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - // - if( $o['type'] == 1 ) { - $u->error = 'Личный образ успешно установлен! Можете выбрать его в инвентаре, в разделе Образ.'; - }elseif( $o['type'] == 2 ) { - $u->error = 'Клановый образ успешно установлен! Можете выбрать его в инвентаре, в разделе Образ.'; - }elseif( $o['type'] == 3 ) { - $u->error = 'Личный образ питомца успешно установлен! Можете выбрать его в инвентаре, в разделе Звери.'; - }elseif( $o['type'] == 5 ) { - $u->error = 'Личный смайлик успешно установлен! Можете выбрать его в разделе Личные смайлики. Код смайлика :s'.$o['id'].':'; - } - } - }elseif(isset($_FILES['img'])) { - //Личный образ - $ekr = 100; - if( $u->info['money2'] < $ekr ) { - echo '{"err":"На счету недостаточно ЕКР"}'; - }else{ - $obraz = 'f_shadow1_'.$u->info['id'].'-'.md5((time()-rand(0,1000)).'#shadow1').'.gif'; - // - if($file = upload::saveimg('img',0.5,'gif',$obraz,120,120,220,220)) { - // - //$u->info['money2'] -= $ekr; - //mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "'.mysql_real_escape_string($ekr).'", - "0", - "0", - "'.mysql_real_escape_string($obraz).'", - "'.$u->info['sex'].'", - "1", - "0" - ) '); - echo '{"img":"'.$obraz.'"}'; - }else{ - echo '{"err":"'.upload::$error.'"}'; - } - } - die(); - }elseif(isset($_FILES['img5'])) { - //Личный смайлик - $ekr = 10; - $ekr_smile = 10; - if( $u->info['money2'] < $ekr ) { - echo '{"err":"На счету недостаточно ЕКР"}'; - }else{ - $obraz = 'f_smile_'.$u->info['id'].'-'.md5((time()-rand(0,1000)).'#smile').'.gif'; - // - if($file = upload::saveimg('img5',0.05,'gif',$obraz,15,100,15,50)) { - // - //$u->info['money2'] -= $ekr; - //mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "'.mysql_real_escape_string($ekr).'", - "0", - "0", - "'.mysql_real_escape_string($obraz).'", - "0", - "5", - "0" - ) '); - echo '{"img":"'.$obraz.'"}'; - }else{ - echo '{"err":"'.upload::$error.'"}'; - } - } - die(); - }elseif(isset($_FILES['img2'])) { - //Клановый образ - $ekr = 49.99; - if( $u->info['clan'] == 0 ) { - echo '{"err":"Вы должны состоять в клане"}'; - }elseif( $u->info['money2'] < $ekr ) { - echo '{"err":"На счету недостаточно ЕКР"}'; - }else{ - $obraz = 'f_shadow2_'.$u->info['id'].'-'.md5((time()-rand(0,1000)).'#shadow2').'.gif'; - // - if($file = upload::saveimg('img2',0.3,'gif',$obraz,120,120,220,220)) { - // - //$u->info['money2'] -= $ekr; - //mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "'.mysql_real_escape_string($ekr).'", - "0", - "0", - "'.mysql_real_escape_string($obraz).'", - "'.$u->info['sex'].'", - "2", - "'.$u->info['clan'].'" - ) '); - echo '{"img":"'.$obraz.'"}'; - }else{ - echo '{"err":"'.upload::$error.'"}'; - } - } - die(); - }elseif(isset($_FILES['img4'])) { - //Питомец образ - $ekr = 4.99; - if( $u->info['money2'] < $ekr ) { - echo '{"err":"На счету недостаточно ЕКР"}'; - }else{ - $obraz = 'f_shadow3_'.$u->info['id'].'-'.md5((time()-rand(0,1000)).'#shadow3').'.gif'; - // - if($file = upload::saveimg('img4',0.3,'gif',$obraz,120,120,40,40)) { - // - //$u->info['money2'] -= $ekr; - //mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( - "'.$u->info['id'].'", - "'.time().'", - "'.mysql_real_escape_string($ekr).'", - "0", - "0", - "'.mysql_real_escape_string($obraz).'", - "'.$u->info['sex'].'", - "3", - "'.$u->info['clan'].'" - ) '); - echo '{"img":"'.$obraz.'"}'; - }else{ - echo '{"err":"'.upload::$error.'"}'; - } - } - die(); - }elseif(isset($_POST['kr001'])) { - //Обмен екр на кр. - $kr = round($_POST['kr001'],2); - if( $c['crtoecr'] < 0.01 ) { - $u->error = 'Сегодня обменник закрыт.'; - }elseif( $day2 < 0.01 ) { - $u->error = 'Сегодня для вас обмен закрыт, приходите завтра.'; - }elseif( $kr < round($c['crtoecr']/100,2) ) { - $u->error = 'Минимальная сумма обмена '.round($c['crtoecr']/100,2).' КР.'; - }elseif( $kr > $day2 ) { - $u->error = 'Вы можете обменять еще '.$day2.' КР сегодня.'; - }elseif( $kr > $u->info['money']) { - $u->error = 'Недостаточно денег для обмена.'; - }else{ - $ekr = round($kr / $c['crtoecr'],2); - $u->error = 'Вы успешно обменяли '.$kr.' КР на '.$ekr.' ЕКР.'; - // - $u->info['money'] -= $kr; - $u->info['money2'] += $ekr; - // - mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'",`money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `user_operation` ( `uid`,`time`,`money`,`money2`,`type`,`b1`,`b2` ) VALUES ( - "'.$u->info['id'].'","'.time().'","'.round(-$kr,2).'","'.round($ekr,2).'","Обмен КР на ЕКР","'.$u->info['money'].'","'.$u->info['money2'].'" - )'); - } - $dc1 = mysql_fetch_array(mysql_query('SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен ЕКР на КР" LIMIT 1')); - $dc2 = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен КР на ЕКР" LIMIT 1')); - $dc1 = $dc1[0]; - $dc2 = $dc2[0]; - $day1 = round($day1def+$dc1,2); - $day2 = round($day2def+$dc2,2); - }elseif(isset($_POST['ekr2'])) { - //Обмен екр на кр. - $ekr = round($_POST['ekr2'],2); - if( $c['ecrtocr']*2.5 < 0.01 ) { - $u->error = 'Сегодня обменник закрыт.'; - }elseif( $day1 < 0.01 ) { - $u->error = 'Сегодня для вас обмен закрыт, приходите завтра.'; - }elseif( $ekr < 0.01 ) { - $u->error = 'Минимальная сумма обмена 0.01 ЕКР.'; - }elseif( $ekr > $day1 ) { - $u->error = 'Вы можете обменять еще '.$day1.' ЕКР сегодня.'; - }elseif( $ekr > $u->info['money2']) { - $u->error = 'Недостаточно денег для обмена.'; - }else{ - $kr = round($ekr * $c['ecrtocr']*2.5,2); - $u->error = 'Вы успешно обменяли '.$ekr.' ЕКР на '.$kr.' КР.'; - // - $u->info['money'] += $kr; - $u->info['money2'] -= $ekr; - // - mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'",`money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `user_operation` ( `uid`,`time`,`money`,`money2`,`type`,`b1`,`b2` ) VALUES ( - "'.$u->info['id'].'","'.time().'","'.round($kr,2).'","'.round(-$ekr,2).'","Обмен ЕКР на КР","'.$u->info['money'].'","'.$u->info['money2'].'" - )'); - } - $dc1 = mysql_fetch_array(mysql_query('SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен ЕКР на КР" LIMIT 1')); - $dc2 = mysql_fetch_array(mysql_query('SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "'.$timetoday.'" AND `uid` = "'.$u->info['id'].'" AND `type` = "Обмен КР на ЕКР" LIMIT 1')); - $dc1 = $dc1[0]; - $dc2 = $dc2[0]; - $day1 = round($day1def+$dc1,2); - $day2 = round($day2def+$dc2,2); - }elseif(isset($_POST['login'])) { - // - function en_ru($txt) { - $g = false; - $en = preg_match("/^(([0-9a-zA-Z _-])+)$/i", $txt); - $ru = preg_match("/^(([0-9а-яА-Я _-])+)$/i", $txt); - if(($ru && $en) || (!$ru && !$en)) { - $g = true; - } - return $g; - } - // - function testBad($txt) { - $white = '-_ 0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёйцукенгшщзхъфывапролджэячсмитьбю'; - $r = false; - $i = 0; - while( $i != -1 ) { - if( isset($txt[$i]) ) { - $g = false; - $j = 0; - while( $j != -1 ) { - if(isset($white[$j])) { - if( $white[$j] == $txt[$i] ) { - $g = true; - } - }else{ - $j = -2; - } - $j++; - } - if( $g == false ) { - $r = true; - } - }else{ - $i = -2; - } - $i++; - } - return $r; - } - - function is_login($login) { - $r = true; - // - $login = htmlspecialchars($login,NULL,'cp1251'); - // - $bad = array( - 'Мусорщик' => 1, - 'Мироздатель' => 1 - ); - // - $login_db = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "'.mysql_real_escape_string($login).'" LIMIT 1')); - if( isset($login_db['id']) || isset($bad[$login]) ) { - $r = false; - }else{ - $true = true; - // - /* - Логин может содержать от 4 до 16 символов, и состоять только из букв русского ИЛИ английского алфавита, цифр, символов '_', '-' и пробела. - Логин не может начинаться или заканчиваться символами '_', '-' или пробелом. - */ - // - $login = str_replace(' ',' ',$login); - $login = str_replace('%',' ',$login); - $login = str_replace(' ',' ',$login); - // - if( strlen($login) > 16 ) { - $true = false; - }elseif( strlen($login) < 4 ) { - $true = false; - }elseif( strripos($login,' ') == true ) { - $true = false; - }elseif( substr($login,1) == ' ' || substr($login,-1) == ' ' ) { - $true = false; - }elseif( substr($login,1) == '-' || substr($login,-1) == '-' ) { - $true = false; - }elseif( substr($login,1) == '_' || substr($login,-1) == '_' ) { - $true = false; - }elseif( testBad($login) == true ) { - $true = false; - }elseif( en_ru(str_replace('ё','е',str_replace('Ё','Е',$login))) == true ) { - $true = false; - } - // - if( $true == false ) { - $r = false; - }else{ - $r = true; - } - } - return $r; - } - if( $u->info['login'] == $_POST['login'] ) { - $u->error = 'Выберите другой логин...'; - }elseif( $u->info['money2'] < 25 ) { - $u->error = 'Недостаточно средств.'; - }else{ - $login = htmlspecialchars($_POST['login'],NULL,'cp1251'); - if( is_login($login) == true ) { - mysql_query('INSERT INTO `lastnames` ( `uid`,`login`,`newlogin`,`time` ) VALUES ( - "'.$u->info['id'].'","'.$u->info['login'].'","'.mysql_real_escape_string($login).'","'.time().'" - )'); - $u->info['login_last'] = $u->info['login']; - $u->info['login'] = $login; - $u->info['money2'] -= 25; - // - mysql_query("UPDATE `items_users` SET `data` = replace( `data` , 'sudba=".$u->info['login_last']."', 'sudba=".mysql_real_escape_string($u->info['login'])."') WHERE `data` LIKE '%sudba=".mysql_real_escape_string($u->info['login_last'])."%' AND `uid` = '".$u->info['id']."'"); - // - mysql_query('UPDATE `users` SET `login` = "'.mysql_real_escape_string($u->info['login']).'", `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Вы успешно сменили логин на "'.$u->info['login'].'" перезайдите в игру с главной страницы.'; - }else{ - $u->error = 'Выберите другой логин...'; - } - } - }elseif(isset($_GET['buy_ekr'])) { - // - $mrh_login = "65643"; - $mrh_pass1 = "qtzl0igb"; - // - $inv_id = 0; - // - $out_ekr = round($_POST['ekr'],2); - if( $out_ekr < 0) { - // - $out_ekr = 0; - } - $out_summ = round($out_ekr*$bt['cur'],2); - $inv_desc = 'Приобрести '.$out_ekr.' екр., персонаж №'.$u->info['id'].', дилер №'.round((int)$_POST['ref']).''; - // - $shp_item = 0; - // - //Бонус опытовый, первичный и накопительный - $out_ekr0 = $out_ekr; - // - $out_ekr += round($out_ekr0/100*$bns[$b1][1],2); - $i = 0; - while( $i < count($bns2) ) { - if( isset($bns2[$i][0]) && $out_ekr >= $bns2[$i][0] ) { - $b2_2 = $i; - } - $i++; - } - $out_ekr += round($out_ekr0/100*$bns2[$b2_2][1],2); - if($ball == 0) { - $out_ekr += round($out_ekr0/100*20,2); - } - // - //Добавляем в базу - mysql_query('INSERT INTO `pay_operation` ( - `uid`,`bank`,`code`,`ekr`,`time`,`good`,`cur`,`var`,`val`,`ref`,`ref2`,`ip`,`date` - ) VALUES ( - "'.$u->info['id'].'","'.$u->bank['id'].'","'.mysql_real_escape_string((int)$_GET['code']).'","'.mysql_real_escape_string($out_ekr).'", - "'.time().'","0","'.mysql_real_escape_string($cur['cur']).'","buy_ekr","0","'.mysql_real_escape_string($u->info['host_reg']).'", - "'.mysql_real_escape_string((int)$_GET['ref']).'","'.mysql_real_escape_string(IP).'","'.date('Y-m-d H:i:s').'" - )'); - - $shp_item = mysql_insert_id(); - - if($shp_item > 0) { - //ожидаем оплаты - }else{ - die('Ошибка в обработке платежа, обратитесь к Администрации'); - } - if($out_ekr < 1) { - die('Минимальная сумма покупки 1 екр.'); - } - // - // предлагаемая валюта платежа - // default payment e-currency - $in_curr = ""; - - // язык - // language - $culture = "ru"; - - // формирование подписи - // generate signature - - - - - //$crc = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shp_item=$shp_item"); - $crc = md5($mrh_login.':'.$out_summ.':'.$mrh_pass1.':'.$shp_item); - - // форма оплаты товара - // payment form - $url = 'https://www.free-kassa.ru/merchant/cash.php?'; - $url .= 'm='.$mrh_login.'&'; - $url .= 'oa='.$out_summ.'&'; - $url .= 'InvId='.$inv_id.'&'; - $url .= 'Desc='.$inv_desc.'&'; - $url .= 's='.$crc.'&'; - $url .= 'o='.$shp_item.'&'; - $url .= 'i='.$in_curr.'&'; - $url .= 'lang='.$culture.'&'; - // - header('location: '.$url); - die(); - print "". - "
    ". - "Сумма платежа: ".$out_ekr." Екр. ". - "". - "". - "". - "". - "". - "". - "". - "". - "
    ". - "(Все средства идут на развитие и улучшение игры)". - "
    "; - die(); - } - -?> - - - Покупка ЕвроКредитов - Бойцовский Клуб - - - - - - - - - - - - -
    - - - - - - - info['id'])) { ?> -
    Персонаж: '.$u->microLogin($u->info['id'],1).'';?>
    - error != '' ) { - echo '
    '.$u->error.'
    '; - } - ?> - freekassa  - interkassa - - - - - - - - - - - - - - - -
    Акция! При первом пополнении баланса,
    Вы получаете дополнительно 20% ЕКР к сумме покупки БЕСПЛАТНО. -
    -
    -
    - Ваш накопительный бонус: % ( ЕКР) -
    - -
    - Покупка ЕКР - -
    - Сумма ЕКР:  
    - - - -
     
     
     
    - - - - - - -
    1 ЕКР Рублей
    1 ЕКР Доллара *
    - - * - зависит от текущих курсов валют
    - Доставка игровой валюты производится в автоматическом режиме, сразу же после оплаты! -

    - При оплате могут возникать задержки на пополнение, обычно не более 1 часа. Если по истечению нескольких часов деньги так и не поступили на ваш баланс, то необходимо обратиться в службу поддержки FREE-KASSA. -
    -

    -
    - - -
    -
    - -
    - Если Вы очень хотели бы положить деньги на игровой счёт, но нет подходящей платёжной системы, обратитесь за помощью к Администратору проекта. -

    -
    -
    - -
    -
    - Ваш баланс счёта: info['money2']?> ЕКР и info['money']?> КР. -
    - -
    - Обмен -
    - Обменять ЕКР на КР по курсу 1ЕКР=КР:    
    -
    -
    - Обменять КР на ЕКР по курсу КР=1ЕКР:  
    -
    - -
    - -
    - Накопительные бонусы - - - - - - - - - - - - -
    ЕКРБонусЕКРБонус
    800 ЕКР10%3 000 ЕКР 30%
    700 ЕКР9%2 500 ЕКР 27%
    600 ЕКР8%2 000 ЕКР 25%
    500 ЕКР7%1 700 ЕКР 23%
    400 ЕКР6%1 500 ЕКР 21%
    300 ЕКР5%1 300 ЕКР 19%
    200 ЕКР4%1 200 ЕКР 17%
    100 ЕКР3%1 100 ЕКР 15%
    50 ЕКР2%1 000 ЕКР 13%
    10 ЕКР1%900 ЕКР11%
    -
    - -
    - Оптовые бонусы - - - - - - -
    Бонус10%10%10%10%10%
    Сумма10 ЕКР20 ЕКР30 ЕКР40 ЕКР50 ЕКР
    Бонус10%10%10%10%20%
    Сумма60 ЕКР70 ЕКР80 ЕКР90 ЕКР100 ЕКР
    -
    - -
    Коммерческие услуги
    - - - - -
    - Покупка личного образа - - Стоимость услуги: 100 ЕКР
    - Требования к персональному образу:
    - GIF-картинка размером 120x220 (ШхВ) и весом до 300 Кб.
    -
    - Выберите картинку: - -
    -
    - -
    - Покупка личного смайлика - - Стоимость услуги: ЕКР
    - Требования к смайлику:
    - GIF-картинка размером от 15x15 до 95x21 (ШхВ) и весом до 30 Кб.
    -
    - Выберите картинку: - -
    -
    - -
    - Смена имени персонажа - - Стоимость услуги: 25 ЕКР
    - Текущее имя: info['login']?>
    -
    - -
    - -
    - -
    -
    - -
     
    - -
    - - - \ No newline at end of file diff --git a/ekr.php b/ekr.php new file mode 100644 index 00000000..fb26022d --- /dev/null +++ b/ekr.php @@ -0,0 +1,1345 @@ +0.13 ЕКР. Приятной Вам игры! + +require_once('_incl_data/__config.php'); +require_once('_incl_data/class/__db_connect.php'); +$u = User::start(); +if (!isset($u->info['id'])) { + header('location: https://new-combats.com/'); + die(); +} + +$ball = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $u->info['id'] . '" AND `good` > 0 LIMIT 1' + ) +); + +$ball = 0 + $ball[0]; + +$day1def = 50; //сколько екр. в день можно менять на кр. +$day2def = 1000 * ($u->info['level'] - 7); //сколько кр. в день можно менять на екр. + +$day1 = $day1def; +$day2 = $day2def; + +if ($day2 < 0) { + $day2 = 0; +} + +$timetoday = strtotime(date('d.m.Y')); +// +$dc1 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен ЕКР на КР" LIMIT 1' + ) +); +$dc2 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен КР на ЕКР" LIMIT 1' + ) +); +$dc1 = $dc1[0]; +$dc2 = $dc2[0]; + +$day1 = round($day1 + $dc1, 2); +$day2 = round($day2 + $dc2, 2); + +if ($day1 < 0) { + $day1 = 0; +} +if ($day2 < 0) { + $day2 = 0; +} + + +$b1 = 0; //бонус накопительный + +$bt = mysql_fetch_array(mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1')); + +$bns = [ + [0, 0, 0], + [10, 1, 0], + [50, 2, 0], + [100, 3, 0], + [200, 4, 0], + [300, 5, 0], + [400, 6, 0], + [500, 7, 0], + [600, 8, 0], + [700, 9, 0], + [800, 10, 0], + [900, 11, 0], + [1000, 13, 1], + [1100, 15, 2], + [1200, 17, 3], + [1300, 19, 4], + [1500, 21, 5], + [1700, 23, 6], + [2000, 25, 7], + [2500, 27, 8], + [3000, 30, 9], +]; + +$bns2 = [ + [0, 0], + [10, 10], + [20, 10], + [30, 10], + [40, 10], + [50, 10], + [60, 10], + [70, 10], + [80, 10], + [90, 10], + [100, 20], +]; + +$i = 0; +while ($i < count($bns)) { + if (isset($bns[$i][0]) && $ball > $bns[$i][0]) { + $b1 = $i; + } + $i++; +} + +if (isset($backdoor)) { + $i = 0; + while ($i < count($bns2)) { + if (isset($bns2[$i][0]) && $pay['ekr'] >= $bns2[$i][0]) { + $b2 = $i; + } + $i++; + } +} + +if (!isset($backdoor)) { + if (isset($_POST['do']) && $_POST['do'] == 'newShadow') { + $o = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `_obraz` WHERE `uid` = "' . $u->info['id'] . '" AND `good` = 0 AND `cancel` = 0 AND `img` = "' . mysql_real_escape_string( + $_POST['ffinput'] + ) . '" LIMIT 1' + ) + ); + if (!isset($o['id'])) { + $u->error = 'Данный образ не найден! Возможно он уже был подтвержден!'; + } elseif ($o['price'] > $u->info['money2']) { + $u->error = 'На счету недостаточно ЕКР'; + } else { + // + $u->info['money2'] -= $o['price']; + mysql_query( + 'UPDATE `users` SET `money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + // + mysql_query('UPDATE `_obraz` SET `good` = "' . time() . '" WHERE `id` = "' . $o['id'] . '" LIMIT 1'); + if ($o['type'] == 1 || $o['type'] == 2) { + //Личный или Клановый + copy( + 'clan_prw/' . $o['img'], './img.new-combats.com/i/obraz/' . $o['sex'] . '/buy' . $o['id'] . '.gif' + ); + } elseif ($o['type'] == 3) { + //Питомец + copy('clan_prw/' . $o['img'], './img.new-combats.com/pet/buy' . $o['id'] . '.gif'); + } elseif ($o['type'] == 5) { + //Питомец + copy('clan_prw/' . $o['img'], './img.new-combats.com/i/smile/s' . $o['id'] . '.gif'); + } + // + if ($_POST['ffsex'] == 1) { + $o['sex'] = 1; + } elseif ($_POST['ffsex'] == 0) { + $o['sex'] = 0; + } + // + if ($o['clan'] > 0) { + $o['uid1'] = 0; + } else { + $o['uid1'] = $o['uid']; + } + // + if ($o['type'] == 1 || $o['type'] == 2) { + //Личный и клановый + mysql_query( + 'INSERT INTO `obraz` ( + `sex`,`uid`,`img`,`usr_add`,`clan` + ) VALUES ( + "' . $o['sex'] . '","' . $o['uid1'] . '","buy' . $o['id'] . '.gif","' . $o['uid'] . '","' . $o['clan'] . '" + )' + ); + } elseif ($o['type'] == 3) { + //Питомца + mysql_query( + 'INSERT INTO `obraz_pet` ( + `uid`,`time`,`img` + ) VALUES ( + "' . $u->info['id'] . '","' . time() . '","' . mysql_real_escape_string('buy' . $o['id'] . '.gif') . '" + )' + ); + } elseif ($o['type'] == 5) { + //Смайлик + $u->info['add_smiles'] .= ',s' . $o['id'] . ''; + $u->info['add_smiles'] = ltrim($u->info['add_smiles'], ','); + mysql_query( + 'UPDATE `users` SET `add_smiles` = "' . $u->info['add_smiles'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + } + // + if ($o['type'] == 1) { + $u->error = 'Личный образ успешно установлен! Можете выбрать его в инвентаре, в разделе Образ.'; + } elseif ($o['type'] == 2) { + $u->error = 'Клановый образ успешно установлен! Можете выбрать его в инвентаре, в разделе Образ.'; + } elseif ($o['type'] == 3) { + $u->error = 'Личный образ питомца успешно установлен! Можете выбрать его в инвентаре, в разделе Звери.'; + } elseif ($o['type'] == 5) { + $u->error = 'Личный смайлик успешно установлен! Можете выбрать его в разделе Личные смайлики. Код смайлика :s' . $o['id'] . ':'; + } + } + } elseif (isset($_FILES['img'])) { + //Личный образ + $ekr = 100; + if ($u->info['money2'] < $ekr) { + echo '{"err":"На счету недостаточно ЕКР"}'; + } else { + $obraz = 'f_shadow1_' . $u->info['id'] . '-' . md5((time() - rand(0, 1000)) . '#shadow1') . '.gif'; + $upload = new Uploader('img', $obraz); + $upload->setSavePath('clan_prw/'); + $upload->setExtentions('gif'); + $upload->setMaxFileSize(.5); + $upload->setDimensions(120, 220); + // + if ($file = $upload->saveimg()) { + mysql_query( + 'INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "' . mysql_real_escape_string($ekr) . '", + "0", + "0", + "' . mysql_real_escape_string($obraz) . '", + "' . $u->info['sex'] . '", + "1", + "0" + ) ' + ); + echo '{"img":"' . $obraz . '"}'; + } else { + echo '{"err":"' . Uploader::$error . '"}'; + } + } + die(); + } elseif (isset($_FILES['img5'])) { + //Личный смайлик + $ekr = 10; + $ekr_smile = 10; + if ($u->info['money2'] < $ekr) { + echo '{"err":"На счету недостаточно ЕКР"}'; + } else { + $obraz = 'f_smile_' . $u->info['id'] . '-' . md5((time() - rand(0, 1000)) . '#smile') . '.gif'; + $upload = new Uploader('img5', $obraz); + $upload->setSavePath('clan_prw/'); + $upload->setExtentions('gif'); + $upload->setMaxFileSize(.05); + $upload->setWidth(100, 15); + $upload->setHeight(50, 15); + // + if ($file = $upload->saveimg()) { + mysql_query( + 'INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "' . mysql_real_escape_string($ekr) . '", + "0", + "0", + "' . mysql_real_escape_string($obraz) . '", + "0", + "5", + "0" + ) ' + ); + echo '{"img":"' . $obraz . '"}'; + } else { + echo '{"err":"' . Uploader::$error . '"}'; + } + } + die(); + } elseif (isset($_FILES['img2'])) { + //Клановый образ + $ekr = 49.99; + if ($u->info['clan'] == 0) { + echo '{"err":"Вы должны состоять в клане"}'; + } elseif ($u->info['money2'] < $ekr) { + echo '{"err":"На счету недостаточно ЕКР"}'; + } else { + $obraz = 'f_shadow2_' . $u->info['id'] . '-' . md5((time() - rand(0, 1000)) . '#shadow2') . '.gif'; + $upload = new Uploader('img2', $obraz); + $upload->setSavePath('clan_prw/'); + $upload->setExtentions('gif'); + $upload->setMaxFileSize(.3); + $upload->setDimensions(120, 220); + // + if ($file = $upload->saveimg()) { + mysql_query( + 'INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "' . mysql_real_escape_string($ekr) . '", + "0", + "0", + "' . mysql_real_escape_string($obraz) . '", + "' . $u->info['sex'] . '", + "2", + "' . $u->info['clan'] . '" + ) ' + ); + echo '{"img":"' . $obraz . '"}'; + } else { + echo '{"err":"' . Uploader::$error . '"}'; + } + } + die(); + } elseif (isset($_FILES['img4'])) { + //Питомец образ + $ekr = 4.99; + if ($u->info['money2'] < $ekr) { + echo '{"err":"На счету недостаточно ЕКР"}'; + } else { + $obraz = 'f_shadow3_' . $u->info['id'] . '-' . md5((time() - rand(0, 1000)) . '#shadow3') . '.gif'; + $upload = new Uploader('img4', $obraz); + $upload->setSavePath('clan_prw/'); + $upload->setExtentions('gif'); + $upload->setMaxFileSize(.3); + $upload->setDimensions(120, 40); + // + if ($file = $upload->saveimg()) { + mysql_query( + 'INSERT INTO `_obraz` ( `uid`,`time`,`price`,`good`,`cancel`,`img`,`sex`,`type`,`clan` ) VALUES ( + "' . $u->info['id'] . '", + "' . time() . '", + "' . mysql_real_escape_string($ekr) . '", + "0", + "0", + "' . mysql_real_escape_string($obraz) . '", + "' . $u->info['sex'] . '", + "3", + "' . $u->info['clan'] . '" + ) ' + ); + echo '{"img":"' . $obraz . '"}'; + } else { + echo '{"err":"' . Uploader::$error . '"}'; + } + } + die(); + } elseif (isset($_POST['kr001'])) { + //Обмен екр на кр. + $kr = round($_POST['kr001'], 2); + if ($c['crtoecr'] < 0.01) { + $u->error = 'Сегодня обменник закрыт.'; + } elseif ($day2 < 0.01) { + $u->error = 'Сегодня для вас обмен закрыт, приходите завтра.'; + } elseif ($kr < round($c['crtoecr'] / 100, 2)) { + $u->error = 'Минимальная сумма обмена ' . round($c['crtoecr'] / 100, 2) . ' КР.'; + } elseif ($kr > $day2) { + $u->error = 'Вы можете обменять еще ' . $day2 . ' КР сегодня.'; + } elseif ($kr > $u->info['money']) { + $u->error = 'Недостаточно денег для обмена.'; + } else { + $ekr = round($kr / $c['crtoecr'], 2); + $u->error = 'Вы успешно обменяли ' . $kr . ' КР на ' . $ekr . ' ЕКР.'; + // + $u->info['money'] -= $kr; + $u->info['money2'] += $ekr; + // + mysql_query( + 'UPDATE `users` SET `money` = "' . $u->info['money'] . '",`money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + mysql_query( + 'INSERT INTO `user_operation` ( `uid`,`time`,`money`,`money2`,`type`,`b1`,`b2` ) VALUES ( + "' . $u->info['id'] . '","' . time() . '","' . round(-$kr, 2) . '","' . round( + $ekr, 2 + ) . '","Обмен КР на ЕКР","' . $u->info['money'] . '","' . $u->info['money2'] . '" + )' + ); + } + $dc1 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен ЕКР на КР" LIMIT 1' + ) + ); + $dc2 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен КР на ЕКР" LIMIT 1' + ) + ); + $dc1 = $dc1[0]; + $dc2 = $dc2[0]; + $day1 = round($day1def + $dc1, 2); + $day2 = round($day2def + $dc2, 2); + } elseif (isset($_POST['ekr2'])) { + //Обмен екр на кр. + $ekr = round($_POST['ekr2'], 2); + if ($c['ecrtocr'] * 2.5 < 0.01) { + $u->error = 'Сегодня обменник закрыт.'; + } elseif ($day1 < 0.01) { + $u->error = 'Сегодня для вас обмен закрыт, приходите завтра.'; + } elseif ($ekr < 0.01) { + $u->error = 'Минимальная сумма обмена 0.01 ЕКР.'; + } elseif ($ekr > $day1) { + $u->error = 'Вы можете обменять еще ' . $day1 . ' ЕКР сегодня.'; + } elseif ($ekr > $u->info['money2']) { + $u->error = 'Недостаточно денег для обмена.'; + } else { + $kr = round($ekr * $c['ecrtocr'] * 2.5, 2); + $u->error = 'Вы успешно обменяли ' . $ekr . ' ЕКР на ' . $kr . ' КР.'; + // + $u->info['money'] += $kr; + $u->info['money2'] -= $ekr; + // + mysql_query( + 'UPDATE `users` SET `money` = "' . $u->info['money'] . '",`money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + mysql_query( + 'INSERT INTO `user_operation` ( `uid`,`time`,`money`,`money2`,`type`,`b1`,`b2` ) VALUES ( + "' . $u->info['id'] . '","' . time() . '","' . round($kr, 2) . '","' . round( + -$ekr, 2 + ) . '","Обмен ЕКР на КР","' . $u->info['money'] . '","' . $u->info['money2'] . '" + )' + ); + } + $dc1 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен ЕКР на КР" LIMIT 1' + ) + ); + $dc2 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u->info['id'] . '" AND `type` = "Обмен КР на ЕКР" LIMIT 1' + ) + ); + $dc1 = $dc1[0]; + $dc2 = $dc2[0]; + $day1 = round($day1def + $dc1, 2); + $day2 = round($day2def + $dc2, 2); + } elseif (isset($_POST['login'])) { + // + function en_ru($txt) + { + $g = false; + $en = preg_match("/^(([0-9a-zA-Z _-])+)$/i", $txt); + $ru = preg_match("/^(([0-9а-яА-Я _-])+)$/i", $txt); + if (($ru && $en) || (!$ru && !$en)) { + $g = true; + } + return $g; + } + + // + function testBad($txt) + { + $white = '-_ 0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMїЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮїйцукенгшщзхъфывапролджэячсмитьбю'; + $r = false; + $i = 0; + while ($i != -1) { + if (isset($txt[$i])) { + $g = false; + $j = 0; + while ($j != -1) { + if (isset($white[$j])) { + if ($white[$j] == $txt[$i]) { + $g = true; + } + } else { + $j = -2; + } + $j++; + } + if ($g == false) { + $r = true; + } + } else { + $i = -2; + } + $i++; + } + return $r; + } + + function is_login($login) + { + $r = true; + // + $login = htmlspecialchars($login, null, 'cp1251'); + // + $bad = [ + 'Мусорщик' => 1, + 'Мироздатель' => 1, + ]; + // + $login_db = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `users` WHERE `login` = "' . mysql_real_escape_string($login) . '" LIMIT 1' + ) + ); + if (isset($login_db['id']) || isset($bad[$login])) { + $r = false; + } else { + $true = true; + // + /* + Логин может содержать от 4 до 16 символов, и состоять только из букв русского ИЛИ английского алфавита, цифр, символов '_', '-' и пробела. + Логин не может начинаться или заканчиваться символами '_', '-' или пробелом. + */ + // + $login = str_replace(' ', ' ', $login); + $login = str_replace('%', ' ', $login); + $login = str_replace(' ', ' ', $login); + // + if (strlen($login) > 16) { + $true = false; + } elseif (strlen($login) < 4) { + $true = false; + } elseif (strripos($login, ' ') == true) { + $true = false; + } elseif (substr($login, 1) == ' ' || substr($login, -1) == ' ') { + $true = false; + } elseif (substr($login, 1) == '-' || substr($login, -1) == '-') { + $true = false; + } elseif (substr($login, 1) == '_' || substr($login, -1) == '_') { + $true = false; + } elseif (testBad($login) == true) { + $true = false; + } elseif (en_ru(str_replace('ї', 'е', str_replace('ї', 'Е', $login))) == true) { + $true = false; + } + // + if ($true == false) { + $r = false; + } else { + $r = true; + } + } + return $r; + } + + if ($u->info['login'] == $_POST['login']) { + $u->error = 'Выберите другой логин...'; + } elseif ($u->info['money2'] < 25) { + $u->error = 'Недостаточно средств.'; + } else { + $login = htmlspecialchars($_POST['login'], null, 'cp1251'); + if (is_login($login) == true) { + mysql_query( + 'INSERT INTO `lastnames` ( `uid`,`login`,`newlogin`,`time` ) VALUES ( + "' . $u->info['id'] . '","' . $u->info['login'] . '","' . mysql_real_escape_string( + $login + ) . '","' . time() . '" + )' + ); + $u->info['login_last'] = $u->info['login']; + $u->info['login'] = $login; + $u->info['money2'] -= 25; + // + mysql_query( + "UPDATE `items_users` SET `data` = replace( `data` , 'sudba=" . $u->info['login_last'] . "', 'sudba=" . mysql_real_escape_string( + $u->info['login'] + ) . "') WHERE `data` LIKE '%sudba=" . mysql_real_escape_string( + $u->info['login_last'] + ) . "%' AND `uid` = '" . $u->info['id'] . "'" + ); + // + mysql_query( + 'UPDATE `users` SET `login` = "' . mysql_real_escape_string( + $u->info['login'] + ) . '", `money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + $u->error = 'Вы успешно сменили логин на "' . $u->info['login'] . '" перезайдите в игру с главной страницы.'; + } else { + $u->error = 'Выберите другой логин...'; + } + } + } elseif (isset($_GET['buy_ekr'])) { + // + $mrh_login = "15922";//"65643"; + $mrh_pass1 = "6?ljVLf]RSiBM2F"; + // + $inv_id = 0; + // + $out_ekr = round($_POST['ekr'], 2); + if ($out_ekr < 0) { + // + $out_ekr = 0; + } + $out_summ = round($out_ekr * $bt['cur'], 2); + $inv_desc = 'Приобрести ' . $out_ekr . ' екр., персонаж №' . $u->info['id'] . ', дилер №' . round( + (int)$_POST['ref'] + ) . ''; + // + $shp_item = 0; + // + //Бонус опытовый, первичный и накопительный + $out_ekr0 = $out_ekr; + // + $out_ekr += round($out_ekr0 / 100 * $bns[$b1][1], 2); + $i = 0; + while ($i < count($bns2)) { + if (isset($bns2[$i][0]) && $out_ekr >= $bns2[$i][0]) { + $b2_2 = $i; + } + $i++; + } + $out_ekr += round($out_ekr0 / 100 * $bns2[$b2_2][1], 2); + if ($ball == 0) { + $out_ekr += round($out_ekr0 / 100 * 20, 2); + } + // + //Добавляем в базу + mysql_query( + 'INSERT INTO `pay_operation` ( + `uid`,`bank`,`code`,`ekr`,`time`,`good`,`cur`,`var`,`val`,`ref`,`ref2`,`ip`,`date` + ) VALUES ( + "' . $u->info['id'] . '","' . $u->bank['id'] . '","' . mysql_real_escape_string( + (int)$_GET['code'] + ) . '","' . mysql_real_escape_string($out_ekr) . '", + "' . time() . '","0","' . mysql_real_escape_string( + $cur['cur'] + ) . '","buy_ekr","0","' . mysql_real_escape_string($u->info['host_reg']) . '", + "' . mysql_real_escape_string((int)$_GET['ref']) . '","' . mysql_real_escape_string(IP) . '","' . date( + 'Y-m-d H:i:s' + ) . '" + )' + ); + + $shp_item = mysql_insert_id(); + + if ($shp_item > 0) { + //ожидаем оплаты + } else { + die('Ошибка в обработке платежа, обратитесь к Администрации'); + } + if ($out_ekr < 1) { + die('Минимальная сумма покупки 1 екр.'); + } + // + // предлагаемая валюта платежа + // default payment e-currency + $in_curr = ""; + + // язык + // language + $culture = "ru"; + $currency = "RUB"; + + // формирование подписи + // generate signature + + + //$crc = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shp_item=$shp_item"); + $crc = md5( + $mrh_login . ':' . $out_summ . ':' . $mrh_pass1 . ':' . $currency . ':' . $shp_item + ); //$sign = md5($merchant_id.':'.$order_amount.':'.$secret_word.':'.$currency.':'.$order_id); + + // форма оплаты товара + // payment form + $url = 'https://pay.freekassa.ru/?'; + $url .= 'm=' . $mrh_login . '&'; + $url .= 'oa=' . $out_summ . '&'; + //$url .= 'InvId='.$inv_id.'&'; + //$url .= 'Desc='.$inv_desc.'&'; + $url .= 'currency=' . $currency . '&'; + $url .= 'o=' . $shp_item . '&'; + $url .= 's=' . $crc; + //$url .= 'i='.$in_curr.'&'; + //$url .= 'lang='.$culture.'&'; + // + + /* +
    + + + + + + + + '> + +
    + */ + header('location: ' . $url); + die(); + print "" . + "
    " . + "Сумма платежа: " . $out_ekr . " Екр. " . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "
    " . + "(Все средства идут на развитие и улучшение игры)" . + "
    "; + die(); + } + + ?> + + + Покупка ЕвроКредитов - Бойцовский Клуб + + + + + + + + + + + + +
    + + + + + + + + + info['id'])) { ?> +
    Персонаж: ' . $u->microLogin( + $u->info['id'], 1 + ) . ''; ?>
    + error != '') { + echo '
    ' . $u->error . '
    '; + } + ?> + freekassa  + + + + + + + + + + + + + + + + + + + + + + +
    +
    Акция! При первом пополнении баланса,
    Вы получаете дополнительно + 20% ЕКР к сумме покупки БЕСПЛАТНО. +
    +
    +
    +
    + Ваш накопительный бонус: % ( ЕКР) +
    + +
    + Покупка ЕКР + +
    + Сумма ЕКР:   +
    + + + +
    +  
     
      +
    + + + + + + + + + + + + +
    1 ЕКР Рублей
    1 ЕКР Доллара *
    + + * - зависит от текущих курсов валют
    + Доставка игровой валюты производится в автоматическом режиме, сразу же после + оплаты! +

    + При оплате могут возникать задержки на пополнение, обычно не более 1 часа. Если по + истечению нескольких часов деньги так и не поступили на ваш баланс, то необходимо + обратиться в службу + поддержки FREE-KASSA. +
    +

    +
    + + +
    +
    + +
    + Если Вы очень хотели бы положить деньги на игровой счїт, но нет подходящей платїжной + системы, обратитесь за помощью к Администратору проекта. +

    +
    +
    + +
    +
    + Ваш баланс счїта: info['money2'] ?> ЕКР и info['money'] ?> КР. +
    + +
    + Обмен +
    + Обменять ЕКР на КР по курсу 1ЕКР=КР:   +  
    +
    +
    + Обменять КР на ЕКР по курсу КР=1ЕКР: +  
    +
    + +
    + +
    + Накопительные бонусы + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ЕКРБонусЕКРБонус
    800 ЕКР10%3 000 ЕКР 30%
    700 ЕКР9%2 500 ЕКР 27%
    600 ЕКР8%2 000 ЕКР 25%
    500 ЕКР7%1 700 ЕКР 23%
    400 ЕКР6%1 500 ЕКР 21%
    300 ЕКР5%1 300 ЕКР 19%
    200 ЕКР4%1 200 ЕКР 17%
    100 ЕКР3%1 100 ЕКР 15%
    50 ЕКР2%1 000 ЕКР 13%
    10 ЕКР1%900 ЕКР11%
    +
    + +
    + Оптовые бонусы + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Бонус10%10%10%10%10%
    Сумма10 ЕКР20 ЕКР30 ЕКР40 ЕКР50 ЕКР
    Бонус10%10%10%10%20%
    Сумма60 ЕКР70 ЕКР80 ЕКР90 ЕКР100 ЕКР
    +
    + +
    +
    Коммерческие услуги
    +
    + + + + +
    + Покупка личного образа + + Стоимость услуги: 100 ЕКР
    + Требования к персональному образу:
    + GIF-картинка размером 120x220 (ШхВ) и весом до 300 Кб.
    +
    + Выберите картинку: + +
    +
    + +
    + Покупка личного смайлика + + Стоимость услуги: ЕКР
    + Требования к смайлику:
    + GIF-картинка размером от 15x15 до 95x21 (ШхВ) и весом до 30 Кб.
    +
    + Выберите картинку: + +
    +
    + +
    + Смена имени персонажа + + Стоимость услуги: 25 ЕКР
    + Текущее имя: info['login'] ?>
    +
    + +
    + +
    + +
    +
    + +
     
    + +
    + + + diff --git a/enter.php b/enter.php index 608a9f82..d8649a86 100644 --- a/enter.php +++ b/enter.php @@ -1,62 +1,51 @@ location = "index.php?error='.$e.'";') - //die('Location: index.php?error='.$e); - die(' + die('
    @@ -64,7 +53,7 @@ function error($e)
    - '.$e.' + ' . $e . '
    @@ -78,99 +67,41 @@ function error($e) function md5m($src) { - - $tar = Array(16); - $res = Array(16); -$src = utf8_encode ($src); - for ($i = 0; $i < strlen($src) || $i < 16; $i++) - { + + $tar = [16]; + $res = [16]; + $src = utf8_encode($src); + for ($i = 0; $i < strlen($src) || $i < 16; $i++) { $res[$i] = ord($src{$i}) ^ $i * 4; - } - for ($i = 0; $i < 4; $i++) - { - for ($j = 0; $j < 4; $j++) - { + } + for ($i = 0; $i < 4; $i++) { + for ($j = 0; $j < 4; $j++) { $tar[$i * 4 + $j] = ($res[$j * 4 + $i] + 256) % 256; - } - } + } + } return ($tar); -} +} + function array2HStr($src) { - $hex = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"); + $hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; $res = ""; - for ($i = 0; $i < 16; $i++) - { + for ($i = 0; $i < 16; $i++) { $res = $res . ($hex[$src[$i] >> 4] . $hex[$src[$i] % 16]); - } + } return ($res); } $socauth = false; -/* -if(isset($_GET['vk-auth'])) { - - $client_id = '5145826'; // ID приложения - $client_secret = 'V90yIzlgSglfgrnHw7Ny'; // Защищённый ключ - $redirect_uri = 'https://new-combats.com/enter?vk-auth'; // Адрес сайта - - $url = 'https://oauth.vk.com/authorize'; - - $params = array( - 'client_id' => $client_id, - 'redirect_uri' => $redirect_uri, - 'response_type' => 'code' - ); - - if(isset($_GET['code'])) { - $result = false; - $params = array( - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'code' => $_GET['code'], - 'redirect_uri' => $redirect_uri - ); - - $token = json_decode(file_get_contents('httpss://oauth.vk.com/access_token' . '?' . urldecode(https_build_query($params))), true); - - if (isset($token['access_token'])) { - $params = array( - 'uids' => $token['user_id'], - 'fields' => 'uid,first_name,last_name,screen_name,sex,bdate,photo_big', - 'access_token' => $token['access_token'] - ); - - $userInfo = json_decode(file_get_contents('httpss://api.vk.com/method/users.get' . '?' . urldecode(https_build_query($params))), true); - if (isset($userInfo['response'][0]['uid'])) { - $userInfo = $userInfo['response'][0]; - $result = true; - } - } - - if(isset($userInfo['uid'])) { - $scl = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `val` = "vkauth" AND `ok` = "'.mysql_real_escape_string($userInfo['uid']).'" ORDER BY `time` DESC LIMIT 1')); - if(isset($scl['id'])) { - $scl = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$scl['uid'].'" LIMIT 1')); - $_POST['login'] = $scl['login']; - $socauth = true; - }else{ - error('Ваш аккаунт ВКонтакте#'.$userInfo['uid'].' не прикреплен ни к одному из персонажей.'); - } - }else{ - error('Неудалось авторизироваться через социальную сеть ВКонтакте'); - } - } -} -*/ //ReCapthca require_once "./recaptchalib.php"; // ваш секретный ключ $secret = "6Lf3EjsaAAAAALe3zRwxyPGf13ZMWZvCmvad3-jQ"; - + // пустой ответ $response = null; - + // проверка секретного ключа $reCaptcha = new ReCaptcha($secret); @@ -182,332 +113,281 @@ $response = $reCaptcha->verifyResponse( } //ReCapthca -if (1==1)//(($response != null && $response->success=true) || $_POST['code'] != '' || $_GET['code'] != '') -{ - +$u = mysql_fetch_array(mysql_query('SELECT `u`.`pass2`,`u`.`id`,`u`.`auth`,`u`.`login`,`u`.`pass`,`u`.`city`,`u`.`ip`,`u`.`ipreg`,`u`.`online`,`u`.`banned`,`u`.`admin`,`u`.`host_reg`,`u`.`securetime`,`u`.`timereg` FROM `users` AS `u` WHERE `u`.`login`="' . mysql_real_escape_string($_POST['login']) . '" ORDER BY `id` ASC LIMIT 1')); - -$u = mysql_fetch_array(mysql_query('SELECT `u`.`pass2`,`u`.`id`,`u`.`auth`,`u`.`login`,`u`.`pass`,`u`.`city`,`u`.`ip`,`u`.`ipreg`,`u`.`online`,`u`.`banned`,`u`.`admin`,`u`.`host_reg`,`u`.`securetime`,`u`.`timereg` FROM `users` AS `u` WHERE `u`.`login`="'.mysql_real_escape_string($_POST['login']).'" ORDER BY `id` ASC LIMIT 1')); - -$auth = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "'.$u['id'].'" AND `ip` = "'.mysql_real_escape_string(IP).'" LIMIT 1')); -if( $c['securetime'] > 0 && IP != $u['ip'] && IP != $u['ipreg'] && !isset($auth['id']) && $u['securetime'] < $c['securetime'] && $u['timereg'] < $c['securetime'] ) { - error('Вы не можете войти на персонажа "'.$_POST['login'].'".
    Скорее всего вы давно не меняли пароль. Для смены перейдите по ссылке: СМЕНА ПАРОЛЯ

    Вам необходимо сменить пароль для безопасности персонажа, на почту по которой зарегистрирован персонаж придет новый случайно сгенерированный пароль.
    Если у вас нет доступа к E-mail: Зарегистрируйте нового персонажа и обратитесь к Администрации, либо модераторам.'); +$auth = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "' . $u['id'] . '" AND `ip` = "' . mysql_real_escape_string(IP) . '" LIMIT 1')); +if ($c['securetime'] > 0 && IP != $u['ip'] && IP != $u['ipreg'] && !isset($auth['id']) && $u['securetime'] < $c['securetime'] && $u['timereg'] < $c['securetime']) { + error('Вы не можете войти на персонажа "' . $_POST['login'] . '".
    Скорее всего вы давно не меняли пароль. Для смены перейдите по ссылке: СМЕНА ПАРОЛЯ

    Вам необходимо сменить пароль для безопасности персонажа, на почту по которой зарегистрирован персонаж придет новый случайно сгенерированный пароль.
    Если у вас нет доступа к E-mail: Зарегистрируйте нового персонажа и обратитесь к Администрации, либо модераторам.'); } - -/*if($u['host_reg'] == 'new-combats.com' && $u['online'] == 0) { - $_POST['pass'] = md5($_POST['pass']); - if($u['pass'] == md5($_POST['pass'])) { - $u['pass'] = $_POST['pass']; - mysql_query('UPDATE `users` SET `pass` = "'.mysql_real_escape_string($_POST['pass']).'",`online` = "'.time().'" WHERE `id` = "'.mysql_real_escape_string($u['id']).'" LIMIT 1'); - error('Войдите с главной странице еще раз. Пароль был расшифрован.'); - } -}*/ - -if( md5(md5($_POST['pass'])) == $u['pass'] ) { - $_POST['pass'] = md5($_POST['pass']); +if (md5(md5($_POST['pass'])) == $u['pass']) { + $_POST['pass'] = md5($_POST['pass']); } -if(!isset($u['id'])) -{ - error('Логин "'.$_POST['login'].'" не найден в базе.'); -}elseif($u['pass']!=md5($_POST['pass']) && $socauth == false) -{ - error('Неверный пароль к персонажу "'.$_POST['login'].'".'); - mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('".$u['id']."','".mysql_real_escape_string(IP)."','".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."','3','".time()."','".mysql_real_escape_string($_POST['pass'])."')"); -}elseif($u['banned']>0) -{ - $fm = mysql_fetch_array(mysql_query('SELECT * FROM `users_delo` WHERE `uid` = "'.$u['id'].'" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1')); - if(!isset($fm['id'])) { - $fm['text'] = 'Причина блокировки: Причина пока-что не указана.'; - } - error( - 'Персонаж '.$_POST['login'].' заблокирован.'. - '
    '.$fm['text'].'
    '. - '
    Внимание! Если Вы уверены, что произошла ошибка и Вы ничего не нарушали, перерегистрируйтесь, обьясните ситуацию администрации и ожидайте ответа!'. - '
    Перед тем как писать, ВНИМАТЕЛЬНО ознакомитесь с действующими законами.' - .'

    Если Вы заблокированы правомерно, то у Вас нет шансов на разблокировку вашего игрового персонажа.' - ); -}else{ - - //Второй пароль - if( $u['pass2'] != '' && $u['pass2'] != '0' ) { - $_SESSION['login'] = $_POST['login']; - $_SESSION['pass'] = $_POST['pass']; - $good2 = false; - $koko = ''; - if( md5(array2HStr(md5m($_POST['code']))) == $u['pass2'] ) { - $good2 = true; - unset($_SESSION['login'],$_SESSION['pass']); - }else{ - if (isset($_POST['code'])) - {$koko = 'Неверный второй пароль
    ';}; - setcookie('login','',time()-60*60*24,'',$c['host']); - setcookie('pass','',time()-60*60*24,'',$c['host']); - setcookie('login','',time()-60*60*24); - setcookie('pass','',time()-60*60*24); - } - - if( $koko != '' ) { - $koko = ''.$koko.''; - } - if( $good2 == false ) { -?> - - - - - - - Второй пароль - - -

    Запрос второго пароля к персонажу.

    - -
    -
    -
    - - -
    -
    - - - -
    - - - -
    - - - -
    - - - -
    -
    - - - - + + - -= 13 && (int)date('d') <= 13) { - mysql_query('DELETE FROM `eff_users` WHERE `id_eff` = 365 AND `uid` = "'.$u['id'].'"'); - mysql_query('INSERT INTO `eff_users` ( + function getRandomInt(max) { + return Math.floor(Math.random() * Math.floor(max)); + } + + function keypush(n) { + if (n == 12) { + + if (lenth > 0) { + + dopass = ''; + + lenth = 0; + document.getElementById('pass').setAttribute("src", "i/pin/e" + lenth + ".png"); + } + } else if (n == 11) { + + var $_POST = ; + /*$.ajax({ + url: "https://new-combats.com/enter.php", + type: "POST", + data: { + code: "ab6d4bf6593416306881a9e54260b0af", + login: ""+$_POST['login'], + pass: ""+$_POST['pass'] + }, + success: function (response) { + if (response.successFlag) { + //Replace current location from the history via history API + window.history.replaceState({}, 'foo', '/foo'); + window.location = "url of target location here if you want to send a get request"; + $("#form-id").submit();//if you want to post something up + } + } + }); + + /*$.ajax({ + type: 'post', + url: 'https://new-combats.com/enter.php', + data: "code=ab6d4bf6593416306881a9e54260b0af",//параметры запроса + success: function(data) { + alert($_POST['login']); + } + }); + //window.setTimeout('location.reload()', 1000); + */ + window.location.replace("https://new-combats.com/enter.php?code=" + dopass + "&login=" + $_POST['login'] + "&pass=" + $_POST['pass']); + + } else { + + if (lenth < 8) { + dopass = dopass + '' + n; + lenth++; + document.getElementById('pass').setAttribute("src", "i/pin/e" + lenth + ".png"); + } + + } + + } + + + = 13 && (int)date('d') <= 13) { + mysql_query('DELETE FROM `eff_users` WHERE `id_eff` = 365 AND `uid` = "' . $u['id'] . '"'); + mysql_query('INSERT INTO `eff_users` ( `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`no_Ace` ) VALUES ( - "365","'.$u['id'].'","День Рождения Клуба","add_speedhp=500|add_speedmp=500|add_speed_dungeon=50|add_repair_discount=1|","47","'.time().'",1 + "365","' . $u['id'] . '","День Рождения Клуба","add_speedhp=500|add_speedmp=500|add_speed_dungeon=50|add_repair_discount=1|","47","' . time() . '",1 )'); - $chat->send('',$u['room'],$u['city'],'',$u['login'],'В честь дня рождения проекта вы получаете эффект "День Рождения Клуба"! (Эффект обновляется каждый раз когда вы заходите на персонажа)',time(),6,0,0,0,1); - } - - if(isset($_COOKIE['ip']) && $_COOKIE['ip']!=IP) - { - mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('".$u['id']."','".mysql_real_escape_string($_COOKIE['ip'])."','".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."','1','".time()."','".mysql_real_escape_string(md5($_POST['pass']))."')"); - } - - setcookie('login',$_POST['login'],time()+60*60*24*7,'',$c['host']); - setcookie('pass',$u['pass'],time()+60*60*24*7,'',$c['host']); - setcookie('login',$_POST['login'],time()+60*60*24*7); - setcookie('pass',md5($_POST['pass']),time()+60*60*24*7); - setcookie('ip',IP,time()+60*60*24*150,''); - - if($u['online'] < time()-520) { - $sp = mysql_query('SELECT `user` FROM `friends` WHERE `friend` = "'.$u['id'].'"'); - while( $pl = mysql_fetch_array($sp) ) { - $usr = mysql_fetch_array(mysql_query('SELECT `id`,`online`,`login`,`city`,`room` FROM `users` WHERE `id` = "'.$pl['user'].'" LIMIT 1')); - if( isset($usr['id']) && $usr['online'] > time()-600 ) { - $chat->send('',$usr['room'],$usr['city'],'',$usr['login'],'Вас приветствует: '.$u['login'].'.',time(),6,0,0,0,1); - } - } - } - - $apu = ''; + $chat->send('', $u['room'], $u['city'], '', $u['login'], 'В честь дня рождения проекта вы получаете эффект "День Рождения Клуба"! (Эффект обновляется каждый раз когда вы заходите на персонажа)', time(), 6, 0, 0, 0, 1); + } - mysql_query('UPDATE `dump` SET `ver` = "1",`upd` = "2" WHERE `uid` = "'.$u['id'].'"'); + if (isset($_COOKIE['ip']) && $_COOKIE['ip'] != IP) { + mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $u['id'] . "','" . mysql_real_escape_string($_COOKIE['ip']) . "','" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','1','" . time() . "','" . mysql_real_escape_string(md5($_POST['pass'])) . "')"); + } - if($u['auth'] != md5($u['login'].'AUTH'.IP) || $_COOKIE['auth'] != md5($u['login'].'AUTH'.IP) || $u['auth']=='' || $u['auth']=='0') - { - if($u['auth'] != '' && $u['auth'] != '0' && $u['ip'] != IP) { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','".$u['login']."','В предыдущий раз этим персонажем заходили с другого компьютера ".date('d.m.Y H:i',$u['online']).". (Предыдущий ip: %".$u['ip'].")','-1','6','0')"); - } - $apu = "`auth` = '".md5($u['login'].'AUTH'.IP)."',"; - setcookie('auth',md5($u['login'].'AUTH'.IP),time()+60*60*24*365,'','new-combats.com'); - } - - if($u['repass'] == 0) { - $ipnew = IP; - }else{ - $ipnew = $u['ip']; - } - + setcookie('login', $_POST['login'], time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('pass', $u['pass'], time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('login', $_POST['login'], time() + 60 * 60 * 24 * 7); + setcookie('pass', md5($_POST['pass']), time() + 60 * 60 * 24 * 7); + setcookie('ip', IP, time() + 60 * 60 * 24 * 150, ''); - mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('".$u['id']."','".IP."','".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."','0','".time()."','".mysql_real_escape_string(md5($_POST['pass']))."')"); + if ($u['online'] < time() - 520) { + $sp = mysql_query('SELECT `user` FROM `friends` WHERE `friend` = "' . $u['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + $usr = mysql_fetch_array(mysql_query('SELECT `id`,`online`,`login`,`city`,`room` FROM `users` WHERE `id` = "' . $pl['user'] . '" LIMIT 1')); + if (isset($usr['id']) && $usr['online'] > time() - 600) { + $chat->send('', $usr['room'], $usr['city'], '', $usr['login'], 'Вас приветствует: ' . $u['login'] . '.', time(), 6, 0, 0, 0, 1); + } + } + } - mysql_query("UPDATE `users` SET ".$apu."`ip`='".$ipnew."',`dateEnter`='".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."',`online`='".time()."' WHERE `login` = '".mysql_real_escape_string($_POST['login'])."' AND `pass` = '".mysql_real_escape_string(md5($_POST['pass']))."' LIMIT 1"); - - if(isset($_POST['active_code_key'])) { - header('location: /active.php?code='.htmlspecialchars($_POST['active_code_key'],NULL,'cp1251')); - }else{ - header('location: /bk'); - } + $apu = ''; + + mysql_query('UPDATE `dump` SET `ver` = "1",`upd` = "2" WHERE `uid` = "' . $u['id'] . '"'); + + if ($u['auth'] != md5($u['login'] . 'AUTH' . IP) || $_COOKIE['auth'] != md5($u['login'] . 'AUTH' . IP) || $u['auth'] == '' || $u['auth'] == '0') { + if ($u['auth'] != '' && $u['auth'] != '0' && $u['ip'] != IP) { + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','" . $u['login'] . "','В предыдущий раз этим персонажем заходили с другого компьютера " . date('d.m.Y H:i', $u['online']) . ". (Предыдущий ip: %" . $u['ip'] . ")','-1','6','0')"); + } + $apu = "`auth` = '" . md5($u['login'] . 'AUTH' . IP) . "',"; + setcookie('auth', md5($u['login'] . 'AUTH' . IP), time() + 60 * 60 * 24 * 365, '', 'new-combats.com'); + } + + if ($u['repass'] == 0) { + $ipnew = IP; + } else { + $ipnew = $u['ip']; + } + + + mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $u['id'] . "','" . IP . "','" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','0','" . time() . "','" . mysql_real_escape_string(md5($_POST['pass'])) . "')"); + + mysql_query("UPDATE `users` SET " . $apu . "`ip`='" . $ipnew . "',`dateEnter`='" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "',`online`='" . time() . "' WHERE `login` = '" . mysql_real_escape_string($_POST['login']) . "' AND `pass` = '" . mysql_real_escape_string(md5($_POST['pass'])) . "' LIMIT 1"); + + if (isset($_POST['active_code_key'])) { + header('location: /active.php?code=' . htmlspecialchars($_POST['active_code_key'], null, 'cp1251')); + } else { + header('location: /bk'); + } } - } - else - { - error('Не выполнена ReCaptcha!'); - //echo "Не выполнена ReCaptcha!
    "; - - } -?> diff --git a/err.php b/err.php new file mode 100644 index 00000000..ab3d6633 --- /dev/null +++ b/err.php @@ -0,0 +1,22 @@ +$line"; +} +?> + + + + + + + +
    diff --git a/fastpanel.php b/fastpanel.php deleted file mode 100644 index 8f428ccc..00000000 --- a/fastpanel.php +++ /dev/null @@ -1,53 +0,0 @@ -info['id']) || $u->info['banned']>0) - { - die(json_encode(array('js'=>'top.location="bk?exit='.$code.'";'))); - }elseif($u->info['ip']!=$_SERVER['HTTP_X_REAL_IP']) - { - - } - - if($u->info['activ']>0) { - die('Вам необходимо активировать персонажа.
    Авторизируйтесь с главной страницы.'); - } - - if($u->info['repass'] > 0) { - die(); - } - - if(isset($_GET['items'])) { - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `fastpanel` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1')); - if(!isset($itm['id'])) { - mysql_query('INSERT INTO `fastpanel` (`uid`) VALUES ("'.$u->info['id'].'")'); - } - // - $r = explode('|',$_GET['items']); - $i = 0; $v = ''; - while( $i <= 10 ) { - if(isset($r[$i])) { - $id = round((int)$r[$i]); - $id = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `id` = "'.mysql_real_escape_string($id).'" AND `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($id['id'])) { - $v .= $id['id'].'|'; - }else{ - $v .= '0|'; - } - }else{ - $v .= '0|'; - } - $i++; - } - $v = rtrim($v,'|'); - mysql_query('UPDATE `fastpanel` SET `data` = "'.mysql_real_escape_string($v).'" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - } - -?> \ No newline at end of file diff --git a/fight/take.team.php b/fight/take.team.php index 956dc2be..7f6ae44c 100644 --- a/fight/take.team.php +++ b/fight/take.team.php @@ -1,93 +1,94 @@ -info['id']) && $u->info['battle'] > 0 ) { - // - function json_fix_cyr($json_str) { - $cyr_chars = array ( - '\u0430' => 'а', '\u0410' => 'А', - '\u0431' => 'б', '\u0411' => 'Б', - '\u0432' => 'в', '\u0412' => 'В', - '\u0433' => 'г', '\u0413' => 'Г', - '\u0434' => 'д', '\u0414' => 'Д', - '\u0435' => 'е', '\u0415' => 'Е', - '\u0451' => 'ё', '\u0401' => 'Ё', - '\u0436' => 'ж', '\u0416' => 'Ж', - '\u0437' => 'з', '\u0417' => 'З', - '\u0438' => 'и', '\u0418' => 'И', - '\u0439' => 'й', '\u0419' => 'Й', - '\u043a' => 'к', '\u041a' => 'К', - '\u043b' => 'л', '\u041b' => 'Л', - '\u043c' => 'м', '\u041c' => 'М', - '\u043d' => 'н', '\u041d' => 'Н', - '\u043e' => 'о', '\u041e' => 'О', - '\u043f' => 'п', '\u041f' => 'П', - '\u0440' => 'р', '\u0420' => 'Р', - '\u0441' => 'с', '\u0421' => 'С', - '\u0442' => 'т', '\u0422' => 'Т', - '\u0443' => 'у', '\u0423' => 'У', - '\u0444' => 'ф', '\u0424' => 'Ф', - '\u0445' => 'х', '\u0425' => 'Х', - '\u0446' => 'ц', '\u0426' => 'Ц', - '\u0447' => 'ч', '\u0427' => 'Ч', - '\u0448' => 'ш', '\u0428' => 'Ш', - '\u0449' => 'щ', '\u0429' => 'Щ', - '\u044a' => 'ъ', '\u042a' => 'Ъ', - '\u044b' => 'ы', '\u042b' => 'Ы', - '\u044c' => 'ь', '\u042c' => 'Ь', - '\u044d' => 'э', '\u042d' => 'Э', - '\u044e' => 'ю', '\u042e' => 'Ю', - '\u044f' => 'я', '\u042f' => 'Я', - - '\r' => '', - '\n' => '
    ', - '\t' => '' - ); - foreach ($cyr_chars as $cyr_char_key => $cyr_char) { - $json_str = str_replace($cyr_char_key, $cyr_char, $json_str); - } - return $json_str; - } - // - $r = array(); - $p = array(); - $p['sp'] = mysql_query('SELECT +if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { + if (isset($u->info['id']) && $u->info['battle'] > 0) { + // + function json_fix_cyr($json_str) + { + $cyr_chars = [ + '\u0430' => 'а', '\u0410' => 'А', + '\u0431' => 'б', '\u0411' => 'Б', + '\u0432' => 'в', '\u0412' => 'В', + '\u0433' => 'г', '\u0413' => 'Г', + '\u0434' => 'д', '\u0414' => 'Д', + '\u0435' => 'е', '\u0415' => 'Е', + '\u0451' => 'ё', '\u0401' => 'Ё', + '\u0436' => 'ж', '\u0416' => 'Ж', + '\u0437' => 'з', '\u0417' => 'З', + '\u0438' => 'и', '\u0418' => 'И', + '\u0439' => 'й', '\u0419' => 'Й', + '\u043a' => 'к', '\u041a' => 'К', + '\u043b' => 'л', '\u041b' => 'Л', + '\u043c' => 'м', '\u041c' => 'М', + '\u043d' => 'н', '\u041d' => 'Н', + '\u043e' => 'о', '\u041e' => 'О', + '\u043f' => 'п', '\u041f' => 'П', + '\u0440' => 'р', '\u0420' => 'Р', + '\u0441' => 'с', '\u0421' => 'С', + '\u0442' => 'т', '\u0422' => 'Т', + '\u0443' => 'у', '\u0423' => 'У', + '\u0444' => 'ф', '\u0424' => 'Ф', + '\u0445' => 'х', '\u0425' => 'Х', + '\u0446' => 'ц', '\u0426' => 'Ц', + '\u0447' => 'ч', '\u0427' => 'Ч', + '\u0448' => 'ш', '\u0428' => 'Ш', + '\u0449' => 'щ', '\u0429' => 'Щ', + '\u044a' => 'ъ', '\u042a' => 'Ъ', + '\u044b' => 'ы', '\u042b' => 'Ы', + '\u044c' => 'ь', '\u042c' => 'Ь', + '\u044d' => 'э', '\u042d' => 'Э', + '\u044e' => 'ю', '\u042e' => 'Ю', + '\u044f' => 'я', '\u042f' => 'Я', + + '\r' => '', + '\n' => '
    ', + '\t' => '', + ]; + foreach ($cyr_chars as $cyr_char_key => $cyr_char) { + $json_str = str_replace($cyr_char_key, $cyr_char, $json_str); + } + return $json_str; + } + + // + $r = []; + $p = []; + $p['sp'] = mysql_query( + 'SELECT `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`align`,`u`.`level`, `s`.`hpNow`,`s`.`mpNow`,`s`.`team` - FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "'.$u->info['battle'].'" - '); - while( $p['pl'] = mysql_fetch_array($p['sp']) ) { - $p['st'] = $u->getStats($p['pl']['id']); - $r[] = array( - 'id' => $p['pl']['id'], - 'login' => $p['pl']['login'], - 'team' => $p['pl']['team'], - 'hpNow' => $p['pl']['hpNow'], - 'mpNow' => $p['pl']['mpNow'], - 'hpAll' => $p['st']['hpAll'], - 'mpAll' => $p['st']['mpAll'], - 'align' => $p['pl']['align'], - 'clan' => $p['pl']['clan'], - 'level' => $p['pl']['level'] - ); - } - unset($p); - // - echo json_fix_cyr(json_encode($r)); - //echo json_encode($r); - }else{ - echo 'false'; - } + FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $u->info['battle'] . '" + ' + ); + while ($p['pl'] = mysql_fetch_array($p['sp'])) { + $p['st'] = $u->getStats($p['pl']['id']); + $r[] = [ + 'id' => $p['pl']['id'], + 'login' => $p['pl']['login'], + 'team' => $p['pl']['team'], + 'hpNow' => $p['pl']['hpNow'], + 'mpNow' => $p['pl']['mpNow'], + 'hpAll' => $p['st']['hpAll'], + 'mpAll' => $p['st']['mpAll'], + 'align' => $p['pl']['align'], + 'clan' => $p['pl']['clan'], + 'level' => $p['pl']['level'], + ]; + } + unset($p); + echo json_fix_cyr(json_encode($r)); + } else { + echo 'false'; + } } -?> \ No newline at end of file diff --git a/forum_script/_forum.class.php b/forum_script/_forum.class.php index 953db596..7d98b339 100644 --- a/forum_script/_forum.class.php +++ b/forum_script/_forum.class.php @@ -1,813 +1,725 @@ 'Доступ закрыт',1=>'Только чтение',2=>'Разрешено добавлять ответы',3=>'Разрешено создовать топики',4=>'Разрешено добавлять ответы и создавать топики'); + public $mod = 0, $see = [], $lst = [], $gd = [], $menu = '', $pages = '', $r, $user = false, $fm = false, $error, $acs = [0 => 'Доступ закрыт', 1 => 'Только чтение', 2 => 'Разрешено добавлять ответы', 3 => 'Разрешено создовать топики', 4 => 'Разрешено добавлять ответы и создавать топики']; - - public function paginator($t,$pagers=0){ - if(isset($_GET['search'])) { - $where = '( `text` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" OR `title` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" OR `login` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" ) AND `topic` < "0" AND `delete` = "0"' ; - $pre_url='search='.htmlspecialchars($_GET['search'],NULL,'cp1251').'&read='.$pagers.'&'; - $idpaginator=$pagers; - }elseif($pagers!=0){ - $where = '`topic` = "'.$pagers.'" AND `delete` = "0"' ; - $pre_url='read='.$pagers.'&'; - $idpaginator=$pagers; - }elseif($t==1){ - $where = '`topic` < "0" AND `fid` = "'.$this->r.'" AND `delete` = "0"'; - $pre_url='r='.$this->r.'&'; - $idpaginator=$this->r; - }elseif($t==2){ - $where = '`topic` = "'.$this->see['id'].'" AND `delete` = "0"' ; - $pre_url='read='.$this->see['id'].'&'; - $idpaginator=$this->see['id']; - } - $q="SELECT count(*) FROM forum_msg WHERE ".$where; - $res=mysql_query($q); - $row=mysql_fetch_row($res); - $total_rows=$row[0]; - $num_pages=ceil($total_rows/20); - $plist=''; - for($i=1;$i<=$num_pages;$i++) { - if( (!isset($_GET['page']) || round((int)$_GET['page']) < 1) && $i == 1 && ($t!=2 || isset($_GET['read']))) { - $plist.=''.$i.""; - }elseif( ( $_GET['page']!=$i || $pagers!=0 ) ){ - $plist.='
    '.$i.""; - }else{ - $plist.=''.$i.''; - } + + public function paginator($t, $pagers = 0) + { + if (isset($_GET['search'])) { + $where = '( `text` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" OR `title` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" OR `login` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" ) AND `topic` < "0" AND `delete` = "0"'; + $pre_url = 'search=' . htmlspecialchars($_GET['search'], null, 'cp1251') . '&read=' . $pagers . '&'; + $idpaginator = $pagers; + } elseif ($pagers != 0) { + $where = '`topic` = "' . $pagers . '" AND `delete` = "0"'; + $pre_url = 'read=' . $pagers . '&'; + $idpaginator = $pagers; + } elseif ($t == 1) { + $where = '`topic` < "0" AND `fid` = "' . $this->r . '" AND `delete` = "0"'; + $pre_url = 'r=' . $this->r . '&'; + $idpaginator = $this->r; + } elseif ($t == 2) { + $where = '`topic` = "' . $this->see['id'] . '" AND `delete` = "0"'; + $pre_url = 'read=' . $this->see['id'] . '&'; + $idpaginator = $this->see['id']; + } + $q = "SELECT count(*) FROM forum_msg WHERE " . $where; + $res = mysql_query($q); + $row = mysql_fetch_row($res); + $total_rows = $row[0]; + $num_pages = ceil($total_rows / 20); + $plist = ''; + for ($i = 1; $i <= $num_pages; $i++) { + if ((!isset($_GET['page']) || round((int)$_GET['page']) < 1) && $i == 1 && ($t != 2 || isset($_GET['read']))) { + $plist .= '' . $i . ""; + } elseif (($_GET['page'] != $i || $pagers != 0)) { + $plist .= '' . $i . ""; + } else { + $plist .= '' . $i . ''; } - if($plist == '') { - $plist = '1'; - } - return ''.$plist.''; - } - - public function testAnswer($text) { - - $r = str_replace('[/?]','[?]',$text); - $r = explode('[?]',$r); - $i = 1; - $pr_us_all = 0; - while($i != -1) { - if(isset($r[$i])) { - $ra = explode('[:]',$r[$i]); - $j = 0; - if(isset($this->user['id'])) { - $yg = mysql_fetch_array(mysql_query('SELECT * FROM `forum_answers` WHERE `msg_id` = "'.$this->see['id'].'" AND `q_id` = "'.$i.'" AND `uid` = "'.$this->user['id'].'" AND `delete` = "0" LIMIT 1')); - if(!isset($yg['id'],$_GET['q_now'],$_GET['answer_now']) && $_GET['q_now'] == $i) { - $_GET['answer_now'] = round((int)$_GET['answer_now']); - $_GET['q_now'] = round((int)$_GET['q_now']); - if(isset($ra[$_GET['answer_now']])) { - mysql_query('INSERT INTO `forum_answers` (`uid`,`msg_id`,`q_id`,`answer`,`time`,`city`) VALUES - ("'.$this->user['id'].'","'.$this->see['id'].'","'.mysql_real_escape_string($_GET['q_now']).'","'.mysql_real_escape_string($_GET['answer_now']).'", - "'.time().'","'.$this->user['city'].'")'); - die(''); - } - } - } - $pr_all = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `forum_answers` WHERE `msg_id` = "'.$this->see['id'].'" AND `q_id` = "'.$i.'" AND `delete` = "0" LIMIT 1')); - $pr_all = $pr_all[0]; - $pr_us_all += $pr_all; - $pr_lst = 0; - $pr_asw = 0; - while($j != -1) { - if(isset($ra[$j]) && $ra[$j] != '') { - if($j > 0) { - - $prc = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `forum_answers` WHERE `msg_id` = "'.$this->see['id'].'" AND `answer` = "'.$j.'" AND `q_id` = "'.$i.'" AND `delete` = "0" LIMIT 1')); - $prc = 0+$prc[0]; - $pr_asw += $prc; - if( $pr_asw == $pr_all ) { - $prc = 100-$pr_lst; - $pr_lst += $prc; - if($prc > 0) { - $prc = ''.$prc.''; - } - }else{ - $prc = floor($prc/$pr_all*100); - if($prc > 0) { - $pr_lst += $prc; - $prc = ''.$prc.''; - } - } - if(isset($this->user['id'])) { - if(isset($yg['id'])) { - if($yg['answer'] == $j) { - $zm = '• '.$ra[$j].'     -   '.$prc.'%   (Ваш голос)'; - }else{ - $zm = '• '.$ra[$j].'     -   '.$prc.'%'; - } - }else{ - $zm = '• '.$ra[$j].'     -   '.$prc.'%'; - } - }else{ - $zm = '• '.$ra[$j].'     -   '.$prc.'%'; - } - - $text = str_replace('[:]'.$ra[$j],$zm,$text); - }else{ - $zm = '

    '.$ra[$j].'

    '; - $text = str_replace(str_replace('
    ','',$ra[$j]),$zm,$text); - } - }else{ - $j = -2; - } - $j++; - } - $text = str_replace('[?]','',$text); - }else{ - $i = -2; - } - $i++; - } - $text = str_replace('[/?]','


    Всего проголосовало людей '.$pr_us_all.'
    ',$text); - return $text; - } - - public function startForum() - { - //Выделяем пользователя - $ufr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_COOKIE['login']).'" AND `pass` = "'.mysql_real_escape_string($_COOKIE['pass']).'" AND `banned` = "0" LIMIT 1')); - if(!isset($ufr['id']) || $ufr['banned']>0) - { - unset($u); - }else{ - $ufr['sl'] = ''.$ufr['login'].' ['.$ufr['level'].']'; - $this->user = $ufr; - } - - //Выделяем раздел который просматривает пользователь - if(isset($_GET['read'])) - { - //читаем сообщение - $see = mysql_fetch_array(mysql_query('SELECT * FROM `forum_msg` WHERE `id` = "'.mysql_real_escape_string($_GET['read']).'" AND `delete` = "0" LIMIT 1')); - if(!isset($see['id']) || ($see['fid']==65 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) || ($see['fid']==75 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4))) - { - $this->r = -2; - $this->error = 'Топик форума не найден.'; - }else{ - $this->r = -1; - $see['goodAdd'] = 1; - if($see['nocom']>0) - { - if($this->user['align']>1 && $this->user['align']<2) - { - if($see['nocom']==2 || $see['nocom']==4) - { - $see['goodAdd'] = 0; - } - } - if($this->user['align']>3 && $this->user['align']<4) - { - if($see['nocom']==2 || $see['nocom']==3) - { - $see['goodAdd'] = 0; - } - } - if($this->user['admin']>0) - { - $see['goodAdd'] = 1; - } - } - $this->see = $see; - $this->fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "'.mysql_real_escape_string($see['fid']).'" LIMIT 1')); - } - }else{ - if(isset($_GET['r'])) - { - $this->r = (int)$_GET['r']; - }else{ - $this->r = 1; - } - - $fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "'.mysql_real_escape_string($this->r).'" LIMIT 1')); - if(!isset($fm['id']) || ($fm['id']==65 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) || ($fm['id']==75 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)) ) - { - $this->r = -2; - $this->fm = false; - $this->error = 'Раздел форума не найден.'; - }else{ - $this->fm = $fm; - } - } - - $this->genMenu(); - - $this->lst = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `forum_msg` WHERE `uid` = "'.$this->user['id'].'" AND `delete` = "0" ORDER BY `time` DESC LIMIT 1')); - - //Проверяем форум на доступность - if($this->gd[$this->fm['id']]==0 && $ufr['admin']==0) - { - //просмотр закрыт - $this->r = -2; - $this->error = 'Вы не можете читать данную конференцию.'; - }elseif($this->fm['only_admin']==1 && $this->user['admin']==0) - { - //просмотр закрыт - $this->r = -2; - $this->error = 'Вы не можете читать данную конференцию.'; - } - } - - public function seeTopic() - { - global $c; - $fd_limit=20; - if(isset($_GET['page'])){ - $start=$_GET['page']*$fd_limit-$fd_limit; - }else{ - $start=0; - //echo 'SELECT * FROM `forum_msg` WHERE `topic` < "0" AND `fid` = "'.$this->r.'" AND `delete` = "0" ORDER BY `id` DESC LIMIT '.$start.','.$fd_limit; - } - if($this->see['fid']==65 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)){ - - }elseif($this->see['fid']==75 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)){ - - }elseif(isset($this->see['id'])) - { - //Выводим заголовок - echo $this->genuser($this->see['uid'],$this->see['login'],$this->see['level'],$this->see['align'],$this->see['clan'],$this->see['invis'],$this->see['city'],$this->see['cityreg']); - if($this->user['admin']>0 || ($this->user['align'] > 1 && $this->user['align'] < 2) || ($this->user['align'] > 3 && $this->user['align'] < 4)) - { - echo ' 
    '; - if($this->user['admin']>0) { - echo ''; - } - echo ''; - echo ''; - echo '
    '; - } - echo '     ('.date('d.m.Y H:i',$this->see['time']).')
    '; - $this->see['text'] = str_replace("\n", "
    ", $this->see['text']); - $this->see['text'] = $this->testAnswer($this->see['text']); - $this->see['text'] = $this->parse_bb_code($this->see['text']); - /* - if($this->see['id'] ==1608) { - $uslist = ''; $xu1 = 0; - $su1 = mysql_query('SELECT `i`.`uid`,`u`.`login`,`u`.`level`,`u`.`online`,`u`.`clan`,`u`.`align` FROM `items_users` AS `i` LEFT JOIN `users` AS `u` ON `i`.`uid` = `u`.`id` WHERE `i`.`item_id` = "2852" LIMIT 25'); - $usrs = array(); - while($pu1 = mysql_fetch_array($su1)) { - if(!isset($usrs[$pu1['uid']])) { - $xu1++; - $usrs[$pu1['uid']] = $xu1; - $uslist .= $xu1.'. '.$pu1['login'].'['.$pu1['level'].']'; - if($pu1['online']>time()-520) { - $uslist .= ' online'; - } - $uslist .= '
    '; - } - } - $this->see['text'] = str_replace("{users-list}", 'Список участников ['.$xu1.'/25]:
    '.$uslist.'
    ', $this->see['text']); - unset($uslist,$pu1,$su1,$xu1,$usrs); - }*/ - - $rtrn = ''; - $rtrn .= 'see['fixed'] > 0) { - $rtrn .= ' class="fixed_topik"'; - } - - $rtrn .= ' style="margin-left:31px;">'; - - if($this->see['clear']==0){ - $rtrn .= $this->see['text']; - }else{ - if($this->user['admin'] > 0) { - $rtrn .= '
    '.$this->see['text'].'
    '; - } - $rtrn .= '
    Запись была удалена'; - if($this->user['del_admin'] == 0) { - $rtrn .= ', '.$this->see['del_login'].''; - } - $rtrn .= '
    '; - } - - //Записи модераторов и ангелов - $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "'.$this->see['id'].'"'); - while($pl1 = mysql_fetch_array($sp1)) { - $rtrn .= '
    '; - if($pl1['from_admin'] == 1) { - $pl1['login'] = '<Администрация>'; - $pl1['city'] = ''; - $pl1['cityreg'] = ''; - $pl1['clan'] = ''; - $pl1['level'] = '??'; - $pl1['uid'] = 0; - } - $rtrn .= $this->genuser($pl1['uid'],$pl1['login'],$pl1['level'],$pl1['align'],$pl1['clan'],$pl1['invis'],$pl1['city'],$pl1['cityreg']); - $rtrn .= ' ('.date('d.m.y H:i',$pl1['time']).'): '; - $pl1['text'] = str_replace("\n", "
    ", $pl1['text']); - $rtrn .= $this->link_it($pl1['text']).'
    '; - } - - $rtrn .= '
    '; - //Выводим комментарии - $sp = mysql_query('SELECT * FROM `forum_msg` WHERE `topic` = "'.$this->see['id'].'" AND `delete` = "0" ORDER BY `time` ASC LIMIT '.$start.','.$fd_limit ); - while($pl = mysql_fetch_array($sp)) - { - - $rtrn .= $this->genuser($pl['uid'],$pl['login'],$pl['level'],$pl['align'],$pl['clan'],$pl['invis'],$pl['city'],$pl['cityreg']); - if($this->user['admin']>0 || ($this->user['align'] > 1 && $this->user['align'] < 2) || ($this->user['align'] > 3 && $this->user['align'] < 4)) - { - $rtrn .= ' 
    '; - if($this->user['admin']>0) { - $rtrn .= ''; - } - $rtrn .= ''; - $rtrn .= ''; - $rtrn .= '
    '; - } - $rtrn .= '     ('.date('d.m.Y H:i',$pl['time']).')
    '; - $pl['text'] = $this->parse_bb_code($pl['text']); - $pl['text'] = str_replace("\n", "
    ", $pl['text']); - if($pl['clear']==0){ - $rtrn .= '
    '.$pl['text'].'
    '; - }else{ - if($this->user['admin'] > 0) { - $rtrn .= '
    '.$pl['text'].'
    '; - } - $rtrn .= '
    Комментарий удален'; - if($this->user['del_admin'] == 0) { - $rtrn .= ', '.$pl['del_login'].''; - } - $rtrn .= '
    '; - } - - //Записи модераторов и ангелов - $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "'.$pl['id'].'"'); - while($pl1 = mysql_fetch_array($sp1)) { - $rtrn .= '
    '; - if($pl1['from_admin'] == 1) { - $pl1['login'] = '<Администрация>'; - $pl1['city'] = ''; - $pl1['cityreg'] = ''; - $pl1['clan'] = ''; - $pl1['level'] = '??'; - $pl1['uid'] = 0; - } - $rtrn .= $this->genuser($pl1['uid'],$pl1['login'],$pl1['level'],$pl1['align'],$pl1['clan'],$pl1['invis'],$pl1['city'],$pl1['cityreg']); - $rtrn .= ' ('.date('d.m.y H:i',$pl1['time']).'): '; - $pl1['text'] = str_replace("\n", "
    ", $pl1['text']); - $rtrn .= $this->link_it($pl1['text']).'
    '; - } - - $rtrn .= '
    '; - } - echo $rtrn; - - } - } - - public function link_it($text) { - $text= preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2$3", $text); - $text= preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2$3", $text); - $text= preg_replace("/(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1$2@$3", $text); - return($text); - } + } + if ($plist == '') { + $plist = '1'; + } + return '' . $plist . ''; + } - - public function genuser($id,$login,$level,$align,$clan,$invis,$city,$cityreg) - { - global $c,$code; - $ufr = ''; - if($align>0) - { - $u .= ''; - } - if($clan>0) - { - $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.((int)$clan).'" LIMIT 1')); - if(isset($clan['id'])) - { - $u .= ''; - } - } - - if($login == '<Администрация>') - { - $login = 'Администрация'; - } - - $u .= ''.$login.' ['.$level.']'; - - if($city!='') - { - $ufr = '   '.$u; - } - return $u; - } - - public function pravasee() - { - $prava = 1; //можно добавлять и просматривать - if($this->see['fid']==65 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) - { - //топик ОС - $prava = 0; - }elseif($this->see['fid']==75 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)) - { - //топик Армады - $prava = 0; - }elseif(isset($this->see['id']) && $this->see['nocom']==3 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)) - { - $prava = 0; - }elseif(isset($this->see['id']) && $this->see['nocom']==2 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) - { - $prava = 0; - }elseif(isset($this->see['id']) && $this->see['nocom']==1 && $this->user['admin']==0) - { - $prava = 0; - }elseif($this->user['level']<1) - { - $prava = 0; - }elseif($this->lst['time']>time()-60) - { - $prava = 0; - } - return $prava; - } - - public function admintopmsg($read,$id,$text,$color,$adm) { - - $msg = mysql_fetch_array(mysql_query('SELECT `id` FROM `forum_msg` WHERE `id` = "'.mysql_real_escape_string($id).'" LIMIT 1')); - if(!isset($msg['id'])) { - $this->error = 'Сообщение не найдено'; - }elseif(trim($text,' ')=='' || iconv_strlen(trim($text,' '))<2) - { - $this->error = 'Минимальная длина сообщения должна быть не менее 2-х символов'; - }elseif($this->user['molch2']>time()) - { - $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, на вас наложено заклятие молчания'; - }elseif(isset($this->see['id']) && $this->see['nocom']==3 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif(isset($this->see['id']) && $this->see['nocom']==2 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif(isset($this->see['id']) && $this->see['nocom']==1 && $this->user['admin']==0) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif($this->user['level'] < 8) - { - $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, это возможно с 8-го уровня'; - }else{ - mysql_query('INSERT INTO `forum_msg_mod` (`uid`,`login`,`align`,`level`,`admin`,`clan`,`time`,`text`,`msg_id`,`delete`,`color`,`city`,`cityreg`,`from_admin`) VALUES - ("'.$this->user['id'].'","'.$this->user['login'].'","'.$this->user['align'].'","'.$this->user['level'].'","'.$this->user['admin'].'","'.$this->user['clan'].'", - "'.time().'","'.mysql_real_escape_string($text).'","'.mysql_real_escape_string($msg['id']).'","0","red","'.$this->user['city'].'","'.$this->user['cityreg'].'", - "'.mysql_real_escape_string(round((int)$adm)).'") '); - if(!isset($this->see['id'])) { - header('location: ?r='.round((int)$_GET['r']).'&page='.round((int)$_GET['page'])); - }else{ - header('location: ?read='.$this->see['id'].'&page='.round((int)$_GET['page'])); - } - } - - } - - public function parse_bb_code($text) { - $text = preg_replace('/\[(\/?)(b|i|u|s)\s*\]/', "<$1$2>", $text); - - $text = preg_replace('/\[code\]/', '
    ', $text);
    -		$text = preg_replace('/\[\/code\]/', '
    ', $text); - - $text = preg_replace('/\[(\/?)quote\]/', "<$1blockquote>", $text); - $text = preg_replace('/\[(\/?)quote(\s*=\s*([\'"]?)([^\'"]+)\3\s*)?\]/', "<$1blockquote>Цитата $4:
    ", $text); - - //$text = preg_replace('/\[url\](?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\[\/url\]/', "$1", $text); - $text = preg_replace('/\[url=(.+?)\](.+?)\[\/url\]/', "$2", $text); - $text = preg_replace('/\[url\s?=\s?([\'"]?)(?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\1\](.*?)\[\/url\]/', "$3", $text); - - - $text = preg_replace('/\[img\s*\]([^\]\[]+)\[\/img\]/', "", $text); - $text = preg_replace('/\[img\s*=\s*([\'"]?)([^\'"\]]+)\1\]/', "", $text); - - $text = $this->close_dangling_tags($text); - - return $text; - } - - // $s - строка, в которой необходимо закрыть теги - // $tags - список тегов для закрытия через символ | (b|u|i) - public function close_dangling_tags($html){ - #put all opened tags into an array - preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU",$html,$result); - $openedtags=$result[1]; - - #put all closed tags into an array - preg_match_all("##iU",$html,$result); - $closedtags=$result[1]; - $len_opened = count($openedtags); - # all tags are closed - if(count($closedtags) == $len_opened){ - return $html; - } - - $openedtags = array_reverse($openedtags); - # close tags - for($i=0;$i < $len_opened;$i++) { - if (!in_array($openedtags[$i],$closedtags)){ - if( $openedtags[$i] != 'br' ) { - $html .= ''; - } - } else { - unset($closedtags[array_search($openedtags[$i],$closedtags)]); - } - } - return $html; - } - - public function addnewtop($title,$text,$ico,$time,$login,$uid,$fid,$topic) - { - if(trim($text,' ')=='' || iconv_strlen(trim($text,' '))<5) - { - $this->error = 'Минимальная длина сообщения должна быть не менее 5-ти символов'; - }elseif($this->user['molch2']>time()) - { - $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, на вас наложено заклятие молчания'; - }elseif((trim($title,' ')=='' || iconv_strlen(trim($title,' '))<5) && $topic == -1) - { - $this->error = 'Минимальная длина заголовка должна быть не менее 5-ти символов'; - }elseif(isset($this->see['id']) && $this->see['nocom']==3 && $this->user['admin']==0 && ($this->user['align']<=3 || $this->user['align']>=4)) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif(isset($this->see['id']) && $this->see['nocom']==2 && $this->user['admin']==0 && ($this->user['align']<=1 || $this->user['align']>=2)) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif(isset($this->see['id']) && $this->see['nocom']==1 && $this->user['admin']==0) - { - $this->error = 'В этом топике запрещено оставлять ответы'; - }elseif($this->user['level'] < 2) - { - $this->error = 'Общение на форуме доступно с 2-го уровня'; - }elseif($this->gd[$fid]>0 && $this->lst['time']14) - { - $ico = 13; - } - $tl = array(); - if(isset($_POST['adminname']) && $this->user['admin']>0) - { - $tl['login'] = '<Администрация>'; - $tl['level'] = '??'; - $tl['align'] = '0'; - $tl['clan'] = '0'; - $tl['cityreg'] = 'newvillage'; - $tl['city'] = 'questcity'; - $tl['id'] = '0'; - }else{ - $tl['login'] = $this->user['login']; - $tl['level'] = $this->user['level']; - $tl['align'] = $this->user['align']; - $tl['clan'] = $this->user['clan']; - $tl['cityreg'] = $this->user['cityreg']; - $tl['city'] = $this->user['city']; - $tl['id'] = $uid; - } - $lst = mysql_fetch_array(mysql_query('SELECT * FROM `forum_msg` WHERE `topic` = "'.mysql_real_escape_string($topic).'" OR (`topic` = "-1" AND `id` = "'.mysql_real_escape_string($topic).'") ORDER BY `time` DESC LIMIT 1')); - $ins = mysql_query('INSERT INTO `forum_msg` (`cityreg`,`city`,`align`,`clan`,`level`,`login`,`fid`,`title`,`topic`,`ico`,`text`,`time`,`ip`,`uid`) VALUES ("'.mysql_real_escape_string($tl['cityreg']).'","'.mysql_real_escape_string($tl['city']).'","'.mysql_real_escape_string($tl['align']).'","'.mysql_real_escape_string($tl['clan']).'","'.mysql_real_escape_string($tl['level']).'","'.mysql_real_escape_string($tl['login']).'","'.mysql_real_escape_string($fid).'","'.mysql_real_escape_string(htmlspecialchars($title, NULL , 'cp1251')).'","'.mysql_real_escape_string($topic).'","'.mysql_real_escape_string($ico).'","'.mysql_real_escape_string(htmlspecialchars($text, NULL , 'cp1251')).'","'.mysql_real_escape_string($time).'","'.$_SERVER['HTTP_X_REAL_IP'].'","'.$tl['id'].'")'); - if(!$ins) - { - $this->error = 'Ошибка создания топика'; - return false; - }else{ - if($topic != -1) { - //Если автор предыдущего сообщения не текущий юзер - отправляем в чат сообщение о новом ответе - if($lst['uid']+1!=$this->user['id']) { - $fnt = ''.date('d.m.Y H:i').' На форуме опубликован новый ответ в обсуждении, в котором вы принимали участие. Читать далее'; - $ins = ''; $ll = array(); - $sp = mysql_query('SELECT `u`.`city`,`u`.`id`,`u`.`login`,`f`.`uid`,`f`.`login` FROM `forum_msg` AS `f` LEFT JOIN `users` AS `u` ON `f`.`uid` = `u`.`id` WHERE `f`.`delete` = "0" AND (`f`.`topic` = "'.mysql_real_escape_string($topic).'" OR (`f`.`topic` = "-1" AND `f`.`id` = "'.mysql_real_escape_string($topic).'")) LIMIT 1'); - while($pl = mysql_fetch_array($sp)) { - if(!isset($ll[$pl['uid']]) && $pl['uid']!=$this->user['id']) { - $ins .= '("'.$pl['city'].'","1","'.$pl['login'].'","6","-1","'.$fnt.'"),'; - $ll[$pl['uid']] = true; - } - } - unset($ll); - $ins = trim($ins,','); - if($ins!='') { - mysql_query('INSERT INTO `chat` (`city`,`new`,`to`,`type`,`time`,`text`) VALUES '.$ins.''); - } - } - } - $fid = mysql_insert_id(); - $this->lst['time'] = time(); - if(isset($this->see['id'])) { - header('location: ?read='.$this->see['id'].'&page='.round((int)$_GET['page'])); - }else{ - header('location: ?r='.round((int)$_GET['r']).'&page='.round((int)$_GET['page'])); - } - return $fid; - } - }elseif($this->lst['time']>time()-60) - { - $this->error = 'Вы не можете оставлять ответы и создавать топики так быстро'; - }else{ - $this->error = 'Вы не можете оставлять ответы и создавать топики в этой конференции'; - } - } - - public function forumData() - { - $fd_limit = 20; - if(isset($_GET['page'])){ - $start=$_GET['page']*$fd_limit-$fd_limit; - }else{ - $start=0; - //echo 'SELECT * FROM `forum_msg` WHERE `topic` < "0" AND `fid` = "'.$this->r.'" AND `delete` = "0" ORDER BY `id` DESC LIMIT '.$start.','.$fd_limit; - } - global $code,$c,$filter; - //отображаем топики данной конференции - $re = ''; - if(isset($_GET['search'])) { - $sp = mysql_query('SELECT * FROM `forum_msg` WHERE ( `text` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" OR `title` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" OR `login` LIKE "%'.mysql_real_escape_string($_GET['search']).'%" ) AND `topic` < "0" AND `delete` = "0" ORDER BY `id` DESC LIMIT '.$start.','.$fd_limit ); - }else{ - $sp = mysql_query('SELECT * FROM `forum_msg` WHERE `topic` < "0" AND `fid` = "'.$this->r.'" AND `delete` = "0" ORDER BY `fixed` DESC,`id` DESC LIMIT '.$start.','.$fd_limit ); - } - while($pl = mysql_fetch_array($sp)) - { - $lstDT = $pl['time']; - $row = mysql_num_rows(mysql_query('SELECT `id` FROM `forum_msg` WHERE `topic` = "'.$pl['id'].'" AND `delete` = "0"')); - $plist=''.$this->paginator(2,$pl['id']).''; - if($plist!=''){ - $plist=' '.$plist.'';} - - $re .= ' 0) { - $fxd = ' '; - $re .= ' class="fixed_topik"'; - } - $re .= ' style="margin-top:10px;">'; - $re .= '
    '.$fxd.' '.$pl['title'].' '.$plist.'   '.$this->genuser($pl['uid'],$pl['login'],$pl['level'],$pl['align'],$pl['clan'],$pl['invis'],$pl['city'],$pl['cityreg']).'
    '; - $re .= '
    '.date('d.m.Y H:i',$pl['time']).' » '; - if($pl['fid'] == 24) { - $re .= $filter->str_count(str_replace('[?]','Вопрос: ',str_replace('[/?]','',str_replace('[:]',', ',$pl['text']))),250); - }else{ - $re .= $filter->str_count(str_replace('[?]','Вопрос: ',str_replace('[/?]','',str_replace('[:]',', ',$pl['text']))),250); - } - $re .= '
    '; - $re .= '
    Ответов: '.$row.' ... '; - - $pku = mysql_query('SELECT `login`,`invis`,`time` FROM `forum_msg` WHERE `topic` = "'.$pl['id'].'" AND `delete` = 0 ORDER BY `id` DESC LIMIT 10'); - $pkusr = ''; - while($plku = mysql_fetch_array($pku)) { - $pkusr = $plku['login'].', '.$pkusr; - $lstDT = $plku['time']; - } - $pkusr = rtrim($pkusr,', '); - $re .= $pkusr; - unset($pkusr); - - $re .= '     ('.date('d.m.Y H:i',$lstDT).')
    '; - $re .= '
    '; - $re .="\n"; - } - echo $re; - } - - public function history($id,$uid,$act,$text) - { - if($type==1) - { - - } - } - - public function actionSee($id) - { - if($id==1) - { - //удалить топик \ коммент - $up = mysql_query('UPDATE `forum_msg` SET `delete` = "'.time().'",`del_login`="'.$this->user['login'].'" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['delete'] = time(); - }elseif($id==2) - { - //запретить комментировать - mysql_query('UPDATE `forum_msg` SET `nocom` = "1" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['nocom'] = 1; - }elseif($id==3) - { - //разрешить комментировать только Ангелам - mysql_query('UPDATE `forum_msg` SET `nocom` = "2" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['nocom'] = 2; - }elseif($id==4) - { - //разрешить комментировать только паладинам - mysql_query('UPDATE `forum_msg` SET `nocom` = "3" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['nocom'] = 3; - }elseif($id==5) - { - //разрешить комментировать только тарманам - mysql_query('UPDATE `forum_msg` SET `nocom` = "4" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['nocom'] = 4; - }elseif($id==6) - { - //разрешить комментировать всем - mysql_query('UPDATE `forum_msg` SET `nocom` = "0" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - $this->see['nocom'] = 0; - }elseif($id==9) - { - //разрешить комментировать всем - $rzn = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "'.mysql_real_escape_string($_GET['trm']).'" LIMIT 1')); - if(isset($rzn['id'])) { - mysql_query('UPDATE `forum_msg` SET `fid` = "'.mysql_real_escape_string($rzn['id']).'" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - } - }elseif($id==7) { - //фиксация топика или сообщения - if( $this->see['fixed'] == 0 ) { - $this->see['fixed'] = time(); - }else{ - $this->see['fixed'] = 0; - } - mysql_query('UPDATE `forum_msg` SET `fixed` = "'.$this->see['fixed'].'" WHERE `id` = "'.$this->see['id'].'" LIMIT 1'); - }elseif($id==8) { - //удаление сообщения - $tpdms = mysql_fetch_array(mysql_query('SELECT `id`,`clear`,`delete` FROM `forum_msg` WHERE `id` = "'.mysql_real_escape_string(round((int)$_GET['delete_msg'])).'" LIMIT 1' )); - if(isset($tpdms['id'])) { - // if(isset($this->see['id'])) { - if( $tpdms['clear'] == 0 ) { - $tpdms['clear'] = time(); - }else{ - $tpdms['delete'] = $this->user['id']; - } - mysql_query('UPDATE `forum_msg` SET `clear` = "'.$tpdms['clear'].'",`delete` = "'.$tpdms['delete'].'",`del_login` = "'.$this->user['login'].'",`del_align` = "'.$this->user['align'].'",`del_clan` = "'.$this->user['clan'].'",`del_admin` = "'.$this->user['admin'].'" WHERE `id` = "'.$tpdms['id'].'" LIMIT 1'); - // } - } - } - if(!isset($this->see['id'])) { - header('location: ?r='.round((int)$_GET['r']).'&page='.round((int)$_GET['page'])); - }else{ - header('location: ?read='.$this->see['id'].'&page='.round((int)$_GET['page'])); - } - } - - public function genRz($pl) - { - global $code; - $rt = ''; - if(isset($pl['id'])) - { - //0 - доступ закрыт, нелья даже читать, 1 - только чтение, 2 - разрешено добавлять ответы, 3 - разрешено создавать топики, 4 - разрешено создавать топики и добавлять ответы - $ico = 4; - if($pl['level']>$this->user['level']) - { - $ico = 1; - } - //проверяем уровень доступа - $this->gd[$pl['id']] = $ico; - $ico = ''; - $rt = ''.$ico.' '.$pl['name'].''; - }else{ - $rt = 'Раздел не найден'; - } - return $rt; - } - - public function genMenu() - { - $m = ''; - - - $sp = mysql_query('SELECT * FROM `forum_menu` WHERE `parent` = "0" ORDER BY `pos` DESC'); - while($pl = mysql_fetch_array($sp)) - { - if( $pl['id'] == 65 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 ||$this->user['align'] >= 2) ) { - - }elseif( $pl['id'] == 75 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 ||$this->user['align'] >= 4) ) { - - }elseif($pl['only_admin']==0 || $this->user['admin']>0) - { - $m .= $this->genRz($pl).'
    '; - if($this->r==$pl['id'] || $this->fm['parent']==$pl['id']) - { - $sp2 = mysql_query('SELECT * FROM `forum_menu` WHERE `parent` = "'.$pl['id'].'" AND `parent2`="0"'); - while($pl2 = mysql_fetch_array($sp2)) - { - $m .= '    '.$this->genRz($pl2).'
    '; - if($this->r==$pl2['id'] || $this->fm['parent2']==$pl2['id']) - { - $sp3 = mysql_query('SELECT * FROM `forum_menu` WHERE `parent2` = "'.$pl2['id'].'"'); - while($pl3 = mysql_fetch_array($sp3)) - { - $m .= '        '.$this->genRz($pl3).'
    '; - } - } - } - } - } - } - - $this->menu = $m; - } + public function testAnswer($text) + { + + $r = str_replace('[/?]', '[?]', $text); + $r = explode('[?]', $r); + $i = 1; + $pr_us_all = 0; + while ($i != -1) { + if (isset($r[$i])) { + $ra = explode('[:]', $r[$i]); + $j = 0; + if (isset($this->user['id'])) { + $yg = mysql_fetch_array(mysql_query('SELECT * FROM `forum_answers` WHERE `msg_id` = "' . $this->see['id'] . '" AND `q_id` = "' . $i . '" AND `uid` = "' . $this->user['id'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($yg['id'], $_GET['q_now'], $_GET['answer_now']) && $_GET['q_now'] == $i) { + $_GET['answer_now'] = round((int)$_GET['answer_now']); + $_GET['q_now'] = round((int)$_GET['q_now']); + if (isset($ra[$_GET['answer_now']])) { + mysql_query('INSERT INTO `forum_answers` (`uid`,`msg_id`,`q_id`,`answer`,`time`,`city`) VALUES + ("' . $this->user['id'] . '","' . $this->see['id'] . '","' . mysql_real_escape_string($_GET['q_now']) . '","' . mysql_real_escape_string($_GET['answer_now']) . '", + "' . time() . '","' . $this->user['city'] . '")'); + die(''); + } + } + } + $pr_all = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `forum_answers` WHERE `msg_id` = "' . $this->see['id'] . '" AND `q_id` = "' . $i . '" AND `delete` = "0" LIMIT 1')); + $pr_all = $pr_all[0]; + $pr_us_all += $pr_all; + $pr_lst = 0; + $pr_asw = 0; + while ($j != -1) { + if (isset($ra[$j]) && $ra[$j] != '') { + if ($j > 0) { + + $prc = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `forum_answers` WHERE `msg_id` = "' . $this->see['id'] . '" AND `answer` = "' . $j . '" AND `q_id` = "' . $i . '" AND `delete` = "0" LIMIT 1')); + $prc = 0 + $prc[0]; + $pr_asw += $prc; + if ($pr_asw == $pr_all) { + $prc = 100 - $pr_lst; + $pr_lst += $prc; + if ($prc > 0) { + $prc = '' . $prc . ''; + } + } else { + $prc = floor($prc / $pr_all * 100); + if ($prc > 0) { + $pr_lst += $prc; + $prc = '' . $prc . ''; + } + } + if (isset($this->user['id'])) { + if (isset($yg['id'])) { + if ($yg['answer'] == $j) { + $zm = '• ' . $ra[$j] . '     -   ' . $prc . '%   (Ваш голос)'; + } else { + $zm = '• ' . $ra[$j] . '     -   ' . $prc . '%'; + } + } else { + $zm = '• ' . $ra[$j] . '     -   ' . $prc . '%'; + } + } else { + $zm = '• ' . $ra[$j] . '     -   ' . $prc . '%'; + } + + $text = str_replace('[:]' . $ra[$j], $zm, $text); + } else { + $zm = '

    ' . $ra[$j] . '

    '; + $text = str_replace(str_replace('
    ', '', $ra[$j]), $zm, $text); + } + } else { + $j = -2; + } + $j++; + } + $text = str_replace('[?]', '', $text); + } else { + $i = -2; + } + $i++; + } + $text = str_replace('[/?]', '


    Всего проголосовало людей ' . $pr_us_all . '
    ', $text); + return $text; + } + + public function startForum() + { + //Выделяем пользователя + $ufr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string($_COOKIE['login']) . '" AND `pass` = "' . mysql_real_escape_string($_COOKIE['pass']) . '" AND `banned` = "0" LIMIT 1')); + if (!isset($ufr['id']) || $ufr['banned'] > 0) { + unset($u); + } else { + $ufr['sl'] = '' . $ufr['login'] . ' [' . $ufr['level'] . ']'; + $this->user = $ufr; + } + + //Выделяем раздел который просматривает пользователь + if (isset($_GET['read'])) { + //читаем сообщение + $see = mysql_fetch_array(mysql_query('SELECT * FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string($_GET['read']) . '" AND `delete` = "0" LIMIT 1')); + if (!isset($see['id']) || ($see['fid'] == 65 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) || ($see['fid'] == 75 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4))) { + $this->r = -2; + $this->error = 'Топик форума не найден.'; + } else { + $this->r = -1; + $see['goodAdd'] = 1; + if ($see['nocom'] > 0) { + if ($this->user['align'] > 1 && $this->user['align'] < 2) { + if ($see['nocom'] == 2 || $see['nocom'] == 4) { + $see['goodAdd'] = 0; + } + } + if ($this->user['align'] > 3 && $this->user['align'] < 4) { + if ($see['nocom'] == 2 || $see['nocom'] == 3) { + $see['goodAdd'] = 0; + } + } + if ($this->user['admin'] > 0) { + $see['goodAdd'] = 1; + } + } + $this->see = $see; + $this->fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "' . mysql_real_escape_string($see['fid']) . '" LIMIT 1')); + } + } else { + if (isset($_GET['r'])) { + $this->r = (int)$_GET['r']; + } else { + $this->r = 1; + } + + $fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "' . mysql_real_escape_string($this->r) . '" LIMIT 1')); + if (!isset($fm['id']) || ($fm['id'] == 65 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) || ($fm['id'] == 75 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4))) { + $this->r = -2; + $this->fm = false; + $this->error = 'Раздел форума не найден.'; + } else { + $this->fm = $fm; + } + } + + $this->genMenu(); + + $this->lst = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `forum_msg` WHERE `uid` = "' . $this->user['id'] . '" AND `delete` = "0" ORDER BY `time` DESC LIMIT 1')); + + //Проверяем форум на доступность + if ($this->gd[$this->fm['id']] == 0 && $ufr['admin'] == 0) { + //просмотр закрыт + $this->r = -2; + $this->error = 'Вы не можете читать данную конференцию.'; + } elseif ($this->fm['only_admin'] == 1 && $this->user['admin'] == 0) { + //просмотр закрыт + $this->r = -2; + $this->error = 'Вы не можете читать данную конференцию.'; + } + } + + public function seeTopic() + { + global $c; + $fd_limit = 20; + if (isset($_GET['page'])) { + $start = $_GET['page'] * $fd_limit - $fd_limit; + } else { + $start = 0; + //echo 'SELECT * FROM `forum_msg` WHERE `topic` < "0" AND `fid` = "'.$this->r.'" AND `delete` = "0" ORDER BY `id` DESC LIMIT '.$start.','.$fd_limit; + } + if ($this->see['fid'] == 65 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) { + + } elseif ($this->see['fid'] == 75 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4)) { + + } elseif (isset($this->see['id'])) { + //Выводим заголовок + echo $this->genuser($this->see['uid'], $this->see['login'], $this->see['level'], $this->see['align'], $this->see['clan'], $this->see['invis'], $this->see['city'], $this->see['cityreg']); + if ($this->user['admin'] > 0 || ($this->user['align'] > 1 && $this->user['align'] < 2) || ($this->user['align'] > 3 && $this->user['align'] < 4)) { + echo ' 
    '; + if ($this->user['admin'] > 0) { + echo ''; + } + echo ''; + echo ''; + echo '
    '; + } + echo '     (' . date('d.m.Y H:i', $this->see['time']) . ')
    '; + $this->see['text'] = str_replace("\n", "
    ", $this->see['text']); + $this->see['text'] = $this->testAnswer($this->see['text']); + $this->see['text'] = $this->parse_bb_code($this->see['text']); + + $rtrn = ''; + $rtrn .= 'see['fixed'] > 0) { + $rtrn .= ' class="fixed_topik"'; + } + + $rtrn .= ' style="margin-left:31px;">'; + + if ($this->see['clear'] == 0) { + $rtrn .= $this->see['text']; + } else { + if ($this->user['admin'] > 0) { + $rtrn .= '
    ' . $this->see['text'] . '
    '; + } + $rtrn .= '
    Запись была удалена'; + if ($this->user['del_admin'] == 0) { + $rtrn .= ', ' . $this->see['del_login'] . ''; + } + $rtrn .= '
    '; + } + + //Записи модераторов и ангелов + $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "' . $this->see['id'] . '"'); + while ($pl1 = mysql_fetch_array($sp1)) { + $rtrn .= '
    '; + if ($pl1['from_admin'] == 1) { + $pl1['login'] = '<Администрация>'; + $pl1['city'] = ''; + $pl1['cityreg'] = ''; + $pl1['clan'] = ''; + $pl1['level'] = '??'; + $pl1['uid'] = 0; + } + $rtrn .= $this->genuser($pl1['uid'], $pl1['login'], $pl1['level'], $pl1['align'], $pl1['clan'], $pl1['invis'], $pl1['city'], $pl1['cityreg']); + $rtrn .= ' (' . date('d.m.y H:i', $pl1['time']) . '): '; + $pl1['text'] = str_replace("\n", "
    ", $pl1['text']); + $rtrn .= $this->link_it($pl1['text']) . '
    '; + } + + $rtrn .= '
    '; + //Выводим комментарии + $sp = mysql_query('SELECT * FROM `forum_msg` WHERE `topic` = "' . $this->see['id'] . '" AND `delete` = "0" ORDER BY `time` ASC LIMIT ' . $start . ',' . $fd_limit); + while ($pl = mysql_fetch_array($sp)) { + + $rtrn .= $this->genuser($pl['uid'], $pl['login'], $pl['level'], $pl['align'], $pl['clan'], $pl['invis'], $pl['city'], $pl['cityreg']); + if ($this->user['admin'] > 0 || ($this->user['align'] > 1 && $this->user['align'] < 2) || ($this->user['align'] > 3 && $this->user['align'] < 4)) { + $rtrn .= ' 
    '; + if ($this->user['admin'] > 0) { + $rtrn .= ''; + } + $rtrn .= ''; + $rtrn .= ''; + $rtrn .= '
    '; + } + $rtrn .= '     (' . date('d.m.Y H:i', $pl['time']) . ')
    '; + $pl['text'] = $this->parse_bb_code($pl['text']); + $pl['text'] = str_replace("\n", "
    ", $pl['text']); + if ($pl['clear'] == 0) { + $rtrn .= '
    ' . $pl['text'] . '
    '; + } else { + if ($this->user['admin'] > 0) { + $rtrn .= '
    ' . $pl['text'] . '
    '; + } + $rtrn .= '
    Комментарий удален'; + if ($this->user['del_admin'] == 0) { + $rtrn .= ', ' . $pl['del_login'] . ''; + } + $rtrn .= '
    '; + } + + //Записи модераторов и ангелов + $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "' . $pl['id'] . '"'); + while ($pl1 = mysql_fetch_array($sp1)) { + $rtrn .= '
    '; + if ($pl1['from_admin'] == 1) { + $pl1['login'] = '<Администрация>'; + $pl1['city'] = ''; + $pl1['cityreg'] = ''; + $pl1['clan'] = ''; + $pl1['level'] = '??'; + $pl1['uid'] = 0; + } + $rtrn .= $this->genuser($pl1['uid'], $pl1['login'], $pl1['level'], $pl1['align'], $pl1['clan'], $pl1['invis'], $pl1['city'], $pl1['cityreg']); + $rtrn .= ' (' . date('d.m.y H:i', $pl1['time']) . '): '; + $pl1['text'] = str_replace("\n", "
    ", $pl1['text']); + $rtrn .= $this->link_it($pl1['text']) . '
    '; + } + + $rtrn .= '
    '; + } + echo $rtrn; + + } + } + + public function link_it($text) + { + $text = preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2$3", $text); + $text = preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2$3", $text); + $text = preg_replace("/(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1$2@$3", $text); + return ($text); + } + + + public function genuser($id, $login, $level, $align, $clan, $invis, $city, $cityreg) + { + global $c, $code; + $ufr = ''; + if ($align > 0) { + $u .= ''; + } + if ($clan > 0) { + $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . ((int)$clan) . '" LIMIT 1')); + if (isset($clan['id'])) { + $u .= ''; + } + } + + if ($login == '<Администрация>') { + $login = 'Администрация'; + } + + $u .= '' . $login . ' [' . $level . ']'; + + if ($city != '') { + $ufr = '   ' . $u; + } + return $u; + } + + private function isAlign1() + { + return $this->user['align'] > 1 && $this->user['align'] < 2; + } + private function isAlign3() + { + return $this->user['align'] > 3 && $this->user['align'] < 4; + } + + public function pravasee() + { + //можно добавлять и просматривать + return ($this->see['fid'] != 65 || $this->user['admin'] != 0 || $this->isAlign1()) && ($this->see['fid'] != 75 || $this->user['admin'] != 0 || $this->isAlign3()) && (!isset($this->see['id']) || $this->see['nocom'] != 3 || $this->user['admin'] != 0 || $this->isAlign3()) && (!isset($this->see['id']) || $this->see['nocom'] != 2 || $this->user['admin'] != 0 || $this->isAlign1()) && (!isset($this->see['id']) || $this->see['nocom'] != 1 || $this->user['admin'] != 0) && $this->user['level'] >= 1 && $this->lst['time'] <= time() - 60; + } + + public function admintopmsg($read, $id, $text, $color, $adm) + { + + $msg = mysql_fetch_array(mysql_query('SELECT `id` FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); + if (!isset($msg['id'])) { + $this->error = 'Сообщение не найдено'; + } elseif (trim($text, ' ') == '' || iconv_strlen(trim($text, ' ')) < 2) { + $this->error = 'Минимальная длина сообщения должна быть не менее 2-х символов'; + } elseif ($this->user['molch2'] > time()) { + $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, на вас наложено заклятие молчания'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 3 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4)) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 2 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 1 && $this->user['admin'] == 0) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif ($this->user['level'] < 8) { + $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, это возможно с 8-го уровня'; + } else { + mysql_query('INSERT INTO `forum_msg_mod` (`uid`,`login`,`align`,`level`,`admin`,`clan`,`time`,`text`,`msg_id`,`delete`,`color`,`city`,`cityreg`,`from_admin`) VALUES + ("' . $this->user['id'] . '","' . $this->user['login'] . '","' . $this->user['align'] . '","' . $this->user['level'] . '","' . $this->user['admin'] . '","' . $this->user['clan'] . '", + "' . time() . '","' . mysql_real_escape_string($text) . '","' . mysql_real_escape_string($msg['id']) . '","0","red","' . $this->user['city'] . '","' . $this->user['cityreg'] . '", + "' . mysql_real_escape_string(round((int)$adm)) . '") '); + if (!isset($this->see['id'])) { + header('location: ?r=' . round((int)$_GET['r']) . '&page=' . round((int)$_GET['page'])); + } else { + header('location: ?read=' . $this->see['id'] . '&page=' . round((int)$_GET['page'])); + } + } + + } + + public function parse_bb_code($text) + { + $text = preg_replace('/\[(\/?)(b|i|u|s)\s*\]/', "<$1$2>", $text); + + $text = preg_replace('/\[code\]/', '
    ', $text);
    +        $text = preg_replace('/\[\/code\]/', '
    ', $text); + + $text = preg_replace('/\[(\/?)quote\]/', "<$1blockquote>", $text); + $text = preg_replace('/\[(\/?)quote(\s*=\s*([\'"]?)([^\'"]+)\3\s*)?\]/', "<$1blockquote>Цитата $4:
    ", $text); + + //$text = preg_replace('/\[url\](?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\[\/url\]/', "$1", $text); + $text = preg_replace('/\[url=(.+?)\](.+?)\[\/url\]/', "$2", $text); + $text = preg_replace('/\[url\s?=\s?([\'"]?)(?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\1\](.*?)\[\/url\]/', "$3", $text); + + + $text = preg_replace('/\[img\s*\]([^\]\[]+)\[\/img\]/', "", $text); + $text = preg_replace('/\[img\s*=\s*([\'"]?)([^\'"\]]+)\1\]/', "", $text); + + $text = $this->close_dangling_tags($text); + + return $text; + } + + // $s - строка, в которой необходимо закрыть теги + // $tags - список тегов для закрытия через символ | (b|u|i) + public function close_dangling_tags($html) + { + #put all opened tags into an array + preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result); + $openedtags = $result[1]; + + #put all closed tags into an array + preg_match_all("##iU", $html, $result); + $closedtags = $result[1]; + $len_opened = count($openedtags); + # all tags are closed + if (count($closedtags) == $len_opened) { + return $html; + } + + $openedtags = array_reverse($openedtags); + # close tags + for ($i = 0; $i < $len_opened; $i++) { + if (!in_array($openedtags[$i], $closedtags)) { + if ($openedtags[$i] != 'br') { + $html .= ''; + } + } else { + unset($closedtags[array_search($openedtags[$i], $closedtags)]); + } + } + return $html; + } + + public function addnewtop($title, $text, $ico, $time, $login, $uid, $fid, $topic) + { + if (trim($text, ' ') == '' || iconv_strlen(trim($text, ' ')) < 5) { + $this->error = 'Минимальная длина сообщения должна быть не менее 5-ти символов'; + } elseif ($this->user['molch2'] > time()) { + $this->error = 'Вы не можете писать сообщения и создавать топики на форуме, на вас наложено заклятие молчания'; + } elseif ((trim($title, ' ') == '' || iconv_strlen(trim($title, ' ')) < 5) && $topic == -1) { + $this->error = 'Минимальная длина заголовка должна быть не менее 5-ти символов'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 3 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4)) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 2 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif (isset($this->see['id']) && $this->see['nocom'] == 1 && $this->user['admin'] == 0) { + $this->error = 'В этом топике запрещено оставлять ответы'; + } elseif ($this->user['level'] < 2) { + $this->error = 'Общение на форуме доступно с 2-го уровня'; + } elseif ($this->gd[$fid] > 0 && $this->lst['time'] < time() - 60) { + $ico = (int)$ico; + if ($ico < 1 || $ico > 14) { + $ico = 13; + } + $tl = []; + if (isset($_POST['adminname']) && $this->user['admin'] > 0) { + $tl['login'] = '<Администрация>'; + $tl['level'] = '??'; + $tl['align'] = '0'; + $tl['clan'] = '0'; + $tl['cityreg'] = 'newvillage'; + $tl['city'] = 'questcity'; + $tl['id'] = '0'; + } else { + $tl['login'] = $this->user['login']; + $tl['level'] = $this->user['level']; + $tl['align'] = $this->user['align']; + $tl['clan'] = $this->user['clan']; + $tl['cityreg'] = $this->user['cityreg']; + $tl['city'] = $this->user['city']; + $tl['id'] = $uid; + } + $lst = mysql_fetch_array(mysql_query('SELECT * FROM `forum_msg` WHERE `topic` = "' . mysql_real_escape_string($topic) . '" OR (`topic` = "-1" AND `id` = "' . mysql_real_escape_string($topic) . '") ORDER BY `time` DESC LIMIT 1')); + $ins = mysql_query('INSERT INTO `forum_msg` (`cityreg`,`city`,`align`,`clan`,`level`,`login`,`fid`,`title`,`topic`,`ico`,`text`,`time`,`ip`,`uid`) VALUES ("' . mysql_real_escape_string($tl['cityreg']) . '","' . mysql_real_escape_string($tl['city']) . '","' . mysql_real_escape_string($tl['align']) . '","' . mysql_real_escape_string($tl['clan']) . '","' . mysql_real_escape_string($tl['level']) . '","' . mysql_real_escape_string($tl['login']) . '","' . mysql_real_escape_string($fid) . '","' . mysql_real_escape_string(htmlspecialchars($title, null, 'cp1251')) . '","' . mysql_real_escape_string($topic) . '","' . mysql_real_escape_string($ico) . '","' . mysql_real_escape_string(htmlspecialchars($text, null, 'cp1251')) . '","' . mysql_real_escape_string($time) . '","' . $_SERVER['HTTP_X_REAL_IP'] . '","' . $tl['id'] . '")'); + if (!$ins) { + $this->error = 'Ошибка создания топика'; + return false; + } else { + if ($topic != -1) { + //Если автор предыдущего сообщения не текущий юзер - отправляем в чат сообщение о новом ответе + if ($lst['uid'] + 1 != $this->user['id']) { + $fnt = '' . date('d.m.Y H:i') . ' На форуме опубликован новый ответ в обсуждении, в котором вы принимали участие. Читать далее'; + $ins = ''; + $ll = []; + $sp = mysql_query('SELECT `u`.`city`,`u`.`id`,`u`.`login`,`f`.`uid`,`f`.`login` FROM `forum_msg` AS `f` LEFT JOIN `users` AS `u` ON `f`.`uid` = `u`.`id` WHERE `f`.`delete` = "0" AND (`f`.`topic` = "' . mysql_real_escape_string($topic) . '" OR (`f`.`topic` = "-1" AND `f`.`id` = "' . mysql_real_escape_string($topic) . '")) LIMIT 1'); + while ($pl = mysql_fetch_array($sp)) { + if (!isset($ll[$pl['uid']]) && $pl['uid'] != $this->user['id']) { + $ins .= '("' . $pl['city'] . '","1","' . $pl['login'] . '","6","-1","' . $fnt . '"),'; + $ll[$pl['uid']] = true; + } + } + unset($ll); + $ins = trim($ins, ','); + if ($ins != '') { + mysql_query('INSERT INTO `chat` (`city`,`new`,`to`,`type`,`time`,`text`) VALUES ' . $ins . ''); + } + } + } + $fid = mysql_insert_id(); + $this->lst['time'] = time(); + if (isset($this->see['id'])) { + header('location: ?read=' . $this->see['id'] . '&page=' . round((int)$_GET['page'])); + } else { + header('location: ?r=' . round((int)$_GET['r']) . '&page=' . round((int)$_GET['page'])); + } + return $fid; + } + } elseif ($this->lst['time'] > time() - 60) { + $this->error = 'Вы не можете оставлять ответы и создавать топики так быстро'; + } else { + $this->error = 'Вы не можете оставлять ответы и создавать топики в этой конференции'; + } + } + + public function forumData() + { + $fd_limit = 20; + $start = isset($_GET['page']) ? $_GET['page'] * $fd_limit - $fd_limit : 0; + global $code; + $filter = new Filter(); + //отображаем топики данной конференции + $re = ''; + if (isset($_GET['search'])) { + $sp = mysql_query('SELECT * FROM `forum_msg` WHERE ( `text` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" OR `title` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" OR `login` LIKE "%' . mysql_real_escape_string($_GET['search']) . '%" ) AND `topic` < "0" AND `delete` = "0" ORDER BY `id` DESC LIMIT ' . $start . ',' . $fd_limit); + } else { + $sp = mysql_query('SELECT * FROM `forum_msg` WHERE `topic` < "0" AND `fid` = "' . $this->r . '" AND `delete` = "0" ORDER BY `fixed` DESC,`id` DESC LIMIT ' . $start . ',' . $fd_limit); + } + while ($pl = mysql_fetch_array($sp)) { + $lstDT = $pl['time']; + $row = mysql_num_rows(mysql_query('SELECT `id` FROM `forum_msg` WHERE `topic` = "' . $pl['id'] . '" AND `delete` = "0"')); + $plist = '' . $this->paginator(2, $pl['id']) . ''; + if ($plist != '') { + $plist = ' ' . $plist . ''; + } + + $re .= ' 0) { + $fxd = ' '; + $re .= ' class="fixed_topik"'; + } + $re .= ' style="margin-top:10px;">'; + $re .= '
    ' . $fxd . ' ' . $pl['title'] . ' ' . $plist . '   ' . $this->genuser($pl['uid'], $pl['login'], $pl['level'], $pl['align'], $pl['clan'], $pl['invis'], $pl['city'], $pl['cityreg']) . '
    '; + $re .= '
    ' . date('d.m.Y H:i', $pl['time']) . ' » '; + if ($pl['fid'] == 24) { + $re .= $filter->str_count(str_replace('[?]', 'Вопрос: ', str_replace('[/?]', '', str_replace('[:]', ', ', $pl['text']))), 250); + } else { + $re .= $filter->str_count(str_replace('[?]', 'Вопрос: ', str_replace('[/?]', '', str_replace('[:]', ', ', $pl['text']))), 250); + } + $re .= '
    '; + $re .= '
    Ответов: ' . $row . ' ... '; + + $pku = mysql_query('SELECT `login`,`invis`,`time` FROM `forum_msg` WHERE `topic` = "' . $pl['id'] . '" AND `delete` = 0 ORDER BY `id` DESC LIMIT 10'); + $pkusr = ''; + while ($plku = mysql_fetch_array($pku)) { + $pkusr = $plku['login'] . ', ' . $pkusr; + $lstDT = $plku['time']; + } + $pkusr = rtrim($pkusr, ', '); + $re .= $pkusr; + unset($pkusr); + + $re .= '     (' . date('d.m.Y H:i', $lstDT) . ')
    '; + $re .= '
    '; + $re .= "\n"; + } + echo $re; + } + + public function history($id, $uid, $act, $text) + { + if ($type == 1) { + + } + } + + public function actionSee($id) + { + if ($id == 1) { + //удалить топик \ коммент + $up = mysql_query('UPDATE `forum_msg` SET `delete` = "' . time() . '",`del_login`="' . $this->user['login'] . '" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['delete'] = time(); + } elseif ($id == 2) { + //запретить комментировать + mysql_query('UPDATE `forum_msg` SET `nocom` = "1" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['nocom'] = 1; + } elseif ($id == 3) { + //разрешить комментировать только Ангелам + mysql_query('UPDATE `forum_msg` SET `nocom` = "2" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['nocom'] = 2; + } elseif ($id == 4) { + //разрешить комментировать только паладинам + mysql_query('UPDATE `forum_msg` SET `nocom` = "3" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['nocom'] = 3; + } elseif ($id == 5) { + //разрешить комментировать только тарманам + mysql_query('UPDATE `forum_msg` SET `nocom` = "4" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['nocom'] = 4; + } elseif ($id == 6) { + //разрешить комментировать всем + mysql_query('UPDATE `forum_msg` SET `nocom` = "0" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + $this->see['nocom'] = 0; + } elseif ($id == 9) { + //разрешить комментировать всем + $rzn = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "' . mysql_real_escape_string($_GET['trm']) . '" LIMIT 1')); + if (isset($rzn['id'])) { + mysql_query('UPDATE `forum_msg` SET `fid` = "' . mysql_real_escape_string($rzn['id']) . '" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + } + } elseif ($id == 7) { + //фиксация топика или сообщения + if ($this->see['fixed'] == 0) { + $this->see['fixed'] = time(); + } else { + $this->see['fixed'] = 0; + } + mysql_query('UPDATE `forum_msg` SET `fixed` = "' . $this->see['fixed'] . '" WHERE `id` = "' . $this->see['id'] . '" LIMIT 1'); + } elseif ($id == 8) { + //удаление сообщения + $tpdms = mysql_fetch_array(mysql_query('SELECT `id`,`clear`,`delete` FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string(round((int)$_GET['delete_msg'])) . '" LIMIT 1')); + if (isset($tpdms['id'])) { + // if(isset($this->see['id'])) { + if ($tpdms['clear'] == 0) { + $tpdms['clear'] = time(); + } else { + $tpdms['delete'] = $this->user['id']; + } + mysql_query('UPDATE `forum_msg` SET `clear` = "' . $tpdms['clear'] . '",`delete` = "' . $tpdms['delete'] . '",`del_login` = "' . $this->user['login'] . '",`del_align` = "' . $this->user['align'] . '",`del_clan` = "' . $this->user['clan'] . '",`del_admin` = "' . $this->user['admin'] . '" WHERE `id` = "' . $tpdms['id'] . '" LIMIT 1'); + // } + } + } + if (!isset($this->see['id'])) { + header('location: ?r=' . round((int)$_GET['r']) . '&page=' . round((int)$_GET['page'])); + } else { + header('location: ?read=' . $this->see['id'] . '&page=' . round((int)$_GET['page'])); + } + } + + public function genRz($pl) + { + global $code; + $rt = ''; + if (isset($pl['id'])) { + //0 - доступ закрыт, нелья даже читать, 1 - только чтение, 2 - разрешено добавлять ответы, 3 - разрешено создавать топики, 4 - разрешено создавать топики и добавлять ответы + $ico = 4; + if ($pl['level'] > $this->user['level']) { + $ico = 1; + } + //проверяем уровень доступа + $this->gd[$pl['id']] = $ico; + $ico = ''; + $rt = '' . $ico . ' ' . $pl['name'] . ''; + } else { + $rt = 'Раздел не найден'; + } + return $rt; + } + + public function genMenu() + { + $m = ''; + + + $sp = mysql_query('SELECT * FROM `forum_menu` WHERE `parent` = "0" ORDER BY `pos` DESC'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['id'] == 65 && $this->user['admin'] == 0 && ($this->user['align'] <= 1 || $this->user['align'] >= 2)) { + + } elseif ($pl['id'] == 75 && $this->user['admin'] == 0 && ($this->user['align'] <= 3 || $this->user['align'] >= 4)) { + + } elseif ($pl['only_admin'] == 0 || $this->user['admin'] > 0) { + $m .= $this->genRz($pl) . '
    '; + if ($this->r == $pl['id'] || $this->fm['parent'] == $pl['id']) { + $sp2 = mysql_query('SELECT * FROM `forum_menu` WHERE `parent` = "' . $pl['id'] . '" AND `parent2`="0"'); + while ($pl2 = mysql_fetch_array($sp2)) { + $m .= '    ' . $this->genRz($pl2) . '
    '; + if ($this->r == $pl2['id'] || $this->fm['parent2'] == $pl2['id']) { + $sp3 = mysql_query('SELECT * FROM `forum_menu` WHERE `parent2` = "' . $pl2['id'] . '"'); + while ($pl3 = mysql_fetch_array($sp3)) { + $m .= '        ' . $this->genRz($pl3) . '
    '; + } + } + } + } + } + } + + $this->menu = $m; + } } $f = new forum; diff --git a/forum_script/index.php b/forum_script/index.php index 5f0b08b9..c10fe8a1 100644 --- a/forum_script/index.php +++ b/forum_script/index.php @@ -1,888 +1,1200 @@ -startForum(); -if(($f->user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0) -{ - if(isset($_GET['mod_use'])) - { - if(!isset($_COOKIE['mod'])) - { - setcookie('mod',true,time()+60*60*24*30); - $_COOKIE['mod'] = true; - }else{ - setcookie('mod',true,time()-60*60*24*30); - unset($_COOKIE['mod']); - } - }elseif(isset($_GET['mod_use2']) && $f->user['admin']>0) - { - if(!isset($_COOKIE['mod2'])) - { - setcookie('mod2',true,time()+60*60*24*30); - $_COOKIE['mod2'] = true; - }else{ - setcookie('mod2',true,time()-60*60*24*30); - unset($_COOKIE['mod2']); - } - } - - $mod = 'on'; - $mod2 = 'off'; - - if(isset($_COOKIE['mod'])) - { - $mod = 'off'; - $f->mod = 1; - } - if(isset($_COOKIE['mod2']) && $f->user['admin']>0) - { - $mod2 = 'on'; - $f->user['admin'] = 0; - } +if (($f->user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0) { + if (isset($_GET['mod_use'])) { + if (!isset($_COOKIE['mod'])) { + setcookie('mod', true, time() + 60 * 60 * 24 * 30); + $_COOKIE['mod'] = true; + } else { + setcookie('mod', true, time() - 60 * 60 * 24 * 30); + unset($_COOKIE['mod']); + } + } elseif (isset($_GET['mod_use2']) && $f->user['admin'] > 0) { + if (!isset($_COOKIE['mod2'])) { + setcookie('mod2', true, time() + 60 * 60 * 24 * 30); + $_COOKIE['mod2'] = true; + } else { + setcookie('mod2', true, time() - 60 * 60 * 24 * 30); + unset($_COOKIE['mod2']); + } + } + + $mod = 'on'; + $mod2 = 'off'; + + if (isset($_COOKIE['mod'])) { + $mod = 'off'; + $f->mod = 1; + } + if (isset($_COOKIE['mod2']) && $f->user['admin'] > 0) { + $mod2 = 'on'; + $f->user['admin'] = 0; + } } -if(isset($f->user['id'])) -{ - if(isset($_POST['add_otv_adm']) && (($f->user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0)) { - - $f->admintopmsg(round((int)$_GET['read']),round((int)$_POST['add_otv_adm']),$_POST['text2_adm'],'Red',round((int)$_POST['adminname_adm'])); - - }elseif(isset($_POST['add_top'])) - { - //if($f->gd[$f->fm['id']]==3 || $f->gd[$f->fm['id']]==4 || $f->user['admin']>0) - //{ - $add = $f->addnewtop($_POST['title'],$_POST['text'],$_POST['icon'],time(),$f->user['login'],$f->user['id'],$_POST['add_top'],-1); - if($add>0) - { - $fnt = 'На форуме, в разделе "Новости" опубликована новая статья "'.$_POST['title'].'". Читать далее'; - mysql_query('INSERT INTO `chat` (`type`,`time`,`text`) VALUES ("45","'.time().'","'.$fnt.'")'); - } - //} - }elseif(isset($_POST['add_otv'])) - { - $addTo = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`delete`,`fid` FROM `forum_msg` WHERE `id` = "'.mysql_real_escape_string($_POST['add_otv']).'" LIMIT 1')); - if(isset($addTo['id'])) - { - //if($f->gd[$addTo['fid']]==2 || $f->gd[$addTo['fid']]==4 || $f->user['admin']>0) - //{ - $add = $f->addnewtop('',$_POST['text2'],0,time(),$f->user['login'],$f->user['id'],$addTo['fid'],$addTo['id']); - //} - } - } +if (isset($f->user['id'])) { + if (isset($_POST['add_otv_adm']) && (($f->user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + + $f->admintopmsg( + round((int)$_GET['read']), round((int)$_POST['add_otv_adm']), $_POST['text2_adm'], 'Red', + round((int)$_POST['adminname_adm']) + ); + + } elseif (isset($_POST['add_top'])) { + //if($f->gd[$f->fm['id']]==3 || $f->gd[$f->fm['id']]==4 || $f->user['admin']>0) + //{ + $add = $f->addnewtop( + $_POST['title'], $_POST['text'], $_POST['icon'], time(), $f->user['login'], $f->user['id'], + $_POST['add_top'], -1 + ); + if ($add > 0) { + $fnt = 'На форуме, в разделе "Новости" опубликована новая статья "' . $_POST['title'] . '". Читать далее'; + mysql_query('INSERT INTO `chat` (`type`,`time`,`text`) VALUES ("45","' . time() . '","' . $fnt . '")'); + } + //} + } elseif (isset($_POST['add_otv'])) { + $addTo = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`time`,`delete`,`fid` FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string( + $_POST['add_otv'] + ) . '" LIMIT 1' + ) + ); + if (isset($addTo['id'])) { + //if($f->gd[$addTo['fid']]==2 || $f->gd[$addTo['fid']]==4 || $f->user['admin']>0) + //{ + $add = $f->addnewtop( + '', $_POST['text2'], 0, time(), $f->user['login'], $f->user['id'], $addTo['fid'], $addTo['id'] + ); + //} + } + } } -if(isset($_GET['read']) && $f->mod==1) -{ - - if(isset($_GET['trm']) && (($f->user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0)) { - $f->actionSee(9); - }elseif(isset($_GET['delete_msg']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['align']>=3.05 && $f->user['align']<4) || $f->user['admin']>0)) { - $f->actionSee(8); - }elseif(isset($_GET['delete']) && isset($f->see['id']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['align']>=3.05 && $f->user['align']<4) || $f->user['admin']>0)) - { - $f->actionSee(1); - }elseif(isset($_GET['nocomment']) && isset($f->see['id']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['align']>=3.05 && $f->user['align']<4) || $f->user['admin']>0)) - { - $f->actionSee(2); - }elseif(isset($_GET['fixed']) && isset($f->see['id']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['align']>=3.05 && $f->user['align']<4) || $f->user['admin']>0)) - { - $f->actionSee(7); - }elseif(isset($_GET['onlyadmin']) && isset($f->see['id']) && $f->user['admin']>0) - { - $f->actionSee(3); - }elseif(isset($_GET['onlymoder']) && isset($f->see['id']) && (($f->user['align']>=3.05 && $f->user['align']<4) || ($f->user['admin']>0 && $_GET['onlymoder']==2))) - { - $f->actionSee(5); - }elseif(isset($_GET['onlymoder']) && isset($f->see['id']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['admin']>0 && $_GET['onlymoder']==1))) - { - $f->actionSee(4); - }elseif(isset($_GET['onlyall']) && isset($f->see['id']) && (($f->user['align']>=1.5 && $f->user['align']<2) || ($f->user['align']>=3.05 && $f->user['align']<4) || $f->user['admin']>0)) - { - $f->actionSee(6); - } +if (isset($_GET['read']) && $f->mod == 1) { + + if (isset($_GET['trm']) && (($f->user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(9); + } elseif (isset($_GET['delete_msg']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['align'] >= 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(8); + } elseif (isset($_GET['delete']) && isset($f->see['id']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['align'] >= 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(1); + } elseif (isset($_GET['nocomment']) && isset($f->see['id']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['align'] >= 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(2); + } elseif (isset($_GET['fixed']) && isset($f->see['id']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['align'] >= 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(7); + } elseif (isset($_GET['onlyadmin']) && isset($f->see['id']) && $f->user['admin'] > 0) { + $f->actionSee(3); + } elseif (isset($_GET['onlymoder']) && isset($f->see['id']) && (($f->user['align'] >= 3.05 && $f->user['align'] < 4) || ($f->user['admin'] > 0 && $_GET['onlymoder'] == 2))) { + $f->actionSee(5); + } elseif (isset($_GET['onlymoder']) && isset($f->see['id']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['admin'] > 0 && $_GET['onlymoder'] == 1))) { + $f->actionSee(4); + } elseif (isset($_GET['onlyall']) && isset($f->see['id']) && (($f->user['align'] >= 1.5 && $f->user['align'] < 2) || ($f->user['align'] >= 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0)) { + $f->actionSee(6); + } } -$dost = array(0=>'всем пользователям',1=>'только чтение',2=>'только для Ангелов',3=>'только для Паладинов',4=>'только для Тарманов'); +$dost = [0 => 'всем пользователям', 1 => 'только чтение', 2 => 'только для Ангелов', 3 => 'только для Паладинов', 4 => 'только для Тарманов']; ?> - - -Форум браузерной онлайн игры Новый «Бойцовский клуб» - - - - - - - - + + + Форум браузерной онлайн игры Новый «Бойцовский клуб» + + + + + + + + - - + + //--> +
    -
    -*/ ?> - +
    - - - - - + + -
       - - error) && $f->error!='' && $f->r!=-2) - { - echo ''.$f->error.''; - } - if($f->user['admin']>0 && isset($_GET['aem'])) - { - ?> -
    -

    Вернуться назад

    -
    -
    Данные для редактирования не найдены


    '; - }else{ - $fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "'.$ed['fid'].'" LIMIT 1')); - echo 'ID: '.$ed['id'].'
    Раздел: '.$fm['name'].'
    '; - } - ?> -
    - - +
    - - - -
    - - - - - - - - - - - - - - - -
    user==false){ echo 'Вы не авторизованы
    Войти на персонажа'; }else{ echo 'Вы вошли как:
    '.$u->microLogin($u->info['id'],1).'

    '; } ?> - user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0){ echo '
    «Модерирование» ['.$mod.']'; } - if($f->user['admin']>0 || $mod2=='on'){ echo '
    «Администрирование» ['.$mod2.']'; } ?> -
    -
    -
    Конференция
    -
    -
    - menu; ?> -
    -


    - - - - - - - - - - - - - - - - -
    - Результаты поиска по запросу: "'.$word.'". Найдено записей '.$limw.' шт.
    '; ?>
    - - - paginator(1); - ?> - - - -
    Страницы:
    Поиск:
    -
    - forumData(); ?> -
    Страницы:
     
    -
    - r>=1){ - //смотрим разделы - ?> - - - - - + r == -2) { + //МЕГА-выводим ошибку + ?> +
    - - - - - - - - - - - - - - - -
    user==false){ echo 'Вы не авторизованы
    Войти на персонажа'; }else{ echo 'Вы вошли как:
    '.$u->microLogin($u->info['id'],1).'

    '; } ?> - user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0){ echo '
    «Модерирование» ['.$mod.']'; } - if($f->user['admin']>0 || $mod2=='on'){ echo '
    «Администрирование» ['.$mod2.']'; } ?> -
    -
    -
    Конференция
    -
    -
    - menu; ?> -
    -


    - - - - - - - - - - - - - - - - - - - -
    - Конференция "'.$f->fm['name'].'"

    '.$f->fm['opisan']; ?>
    - - - paginator(1); - ?> - - - -
    Страницы:
    Поиск:
    -
    - forumData(); ?> -
    Страницы:
     
    - user['id'])){ ?> -
    - gd[$f->fm['id']]!=2 && $f->gd[$f->fm['id']]!=4 && $f->user['admin']==0) - { - echo '

    Вы не можете создавать топики в этой конференции

    '; - }elseif($f->lst['time'] -
    - - - - - - - - - - - -

    Добавить свой вопрос в форум

    - Тема сообщения -
    - -
    - -
    - -
    - -
    + + + - -
       + + error) && $f->r != -2? '' . $f->error . '' : ''?> + user['admin'] > 0 && isset($_GET['aem'])) { + ?> +
    +

    Вернуться назад

    +
    +
    Данные для редактирования не найдены


    '; + } else { + $fm = mysql_fetch_array( + mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "' . $ed['fid'] . '" LIMIT 1') + ); + echo 'ID: ' . $ed['id'] . '
    Раздел: ' . $fm['name'] . '
    '; + } + ?> +
    + + - - + + -
    user['admin']>0) - { - echo '

    '; - } - ?> - -   - -   - -   - -   - -   - -   - -
    - -   - -   - -   - -   - -   - -   - -
    - - - + + + + + + + + + + + + + + + + +
    +
    user) { + echo 'Вы не авторизованы
    Войти на персонажа'; + } else { + echo 'Вы вошли как:
    ' . $u->microLogin( + $u->info['id'], 1 + ) . '

    '; + } ?> + user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0) { + echo '
    «Модерирование» [' . $mod . ']'; + } + if ($f->user['admin'] > 0 || $mod2 == 'on') { + echo '
    «Администрирование» [' . $mod2 . ']'; + } ?> +
    +
    +
    +
    Конференция
    +
    +
    +
    + menu; ?> +
    +
    + +


    +
    +
    + + + + + + + + + + + + + + + + +
    +
    + Результаты поиска по запросу: "' . $word . '". Найдено записей ' . $limw . ' шт.
    '; ?>
    +
    +
    + + + paginator(1); + ?> + + + +
    +
    Страницы:
    +
    +
    + Поиск: + +
    +
    +
    +
    + forumData(); ?> +
    +
    +
    Страницы:
    +
     
    +
    +
    - -
    Временное ограничение на создание топиков.
    Осталось подождать '.round($f->lst['time']+61-time()).' сек.

    '; } ?> - - -
    -
    - r==-1){ - //оставляем комментарий - ?> - - - - - - - - - - - - - - -
    - - - - - - - - - - - paginator(2); - ?> - - - -
     
    - see['fid'].'" AND `topic` = "-1" AND `delete` = "0" AND `id` > '.$f->see['id'].' ORDER BY `id` ASC LIMIT 1')); - $url2 = mysql_fetch_array(mysql_query('SELECT `id`,`title` FROM `forum_msg` WHERE `fid` = "'.$f->see['fid'].'" AND `topic` = "-1" AND `delete` = "0" AND `id` < '.$f->see['id'].' ORDER BY `id` DESC LIMIT 1')); - - if(isset($url1['id'])) { - $url1 = '« предыдущая ветвь'; - }else{ - $url1 = '« предыдущая ветвь'; - } - if(isset($url2['id'])) { - $url2 = 'следующая ветвь »'; - }else{ - $url2 = 'следующая ветвь »'; - } - - ?> -
     | форум | 
    -
    -
     
    Страницы:
    -

    fm['name']; ?> > see['title']; ?>

    - user['align']>1.5 || $f->user['align']>3.05 || $f->user['admin']>0) && $f->mod == 1){ ?> -
    - Доступ: see['nocom']]; ?>
    -
    user['admin'] > 0) { - $rtn .= ''; - } - } - echo $rtn; - ?> -
    - + + + + +
    + + + + + + + + + + + + + + + + +
    +
    user == false) { + echo 'Вы не авторизованы
    Войти на персонажа'; + } else { + echo 'Вы вошли как:
    ' . $u->microLogin( + $u->info['id'], 1 + ) . '

    '; + } ?> + user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0) { + echo '
    «Модерирование» [' . $mod . ']'; + } + if ($f->user['admin'] > 0 || $mod2 == 'on') { + echo '
    «Администрирование» [' . $mod2 . ']'; + } ?> +
    +
    +
    +
    Конференция
    +
    +
    +
    + menu; ?> +
    +
    + +


    +
    +
    + + + + + + + + + + + + + + + + + + + +
    +
    + Конференция "' . $f->fm['name'] . '"

    ' . $f->fm['opisan']; ?>
    +
    +
    + + + paginator(1); + ?> + + + +
    +
    Страницы:
    +
    +
    +
    Поиск:
    +
    +
    +
    +
    + forumData(); ?> +
    +
    +
    Страницы:
    +
     
    + user['id'])) { ?> +
    + gd[$f->fm['id']] != 2 && $f->gd[$f->fm['id']] != 4 && $f->user['admin'] == 0) { + echo '

    Вы не можете создавать топики в этой конференции

    '; + } elseif ($f->lst['time'] < time() - 60) { ?> +
    + + + + + + + + + + + +

    Добавить свой вопрос в + форум

    + Тема сообщения + +
    + +
    + +
    + +
    + +
    + + + + + +
    user['admin'] > 0) { + echo '

    '; + } + ?> + + +   + + +   + + +   + + +   + + +   + + +   + +
    + + +   + + +   + + +   + + +   + + +   + + +   + + +
    + + +
    +
    +
    +
    Временное ограничение на создание топиков.
    Осталось подождать ' . round( + $f->lst['time'] + 61 - time() + ) . ' сек.

    '; + } ?> +
    + +
    +
    +
    see['nocom']==0) - { - if($f->user['admin']>0) - { - ?> - - user['align']>1.5 && $f->user['align']<2) || $f->user['admin']>0) - { - ?> - - user['align']>3.05 && $f->user['align']<4) || $f->user['admin']>0) - { - ?> - - - - - - - -
    seeTopic(); ?>
    Страницы:
    user['id']) || !isset($f->user['id'])){ ?> -
    - see['nocom']>0) - { - echo '

    Обсуждение закрыто

    '; - }elseif($f->see['goodAdd']!=1 || $f->pravasee()!=1) - { - echo '

    Вы не можете оставлять ответы в этом топике.
    Попробуйте через '.round($f->lst['time']+62-time()).' сек.

    '; - }/*elseif($f->gd[$f->see['fid']]!=3 && $f->gd[$f->see['fid']]!=4 && $f->user['admin']==0) + } elseif ($f->r == -1) { + //оставляем комментарий + ?> + + + + + +
    + + + + + + + + + + + + paginator(2); + ?> + + + + + + + + + + + + + + +
     
    +
    + see['fid'] . '" AND `topic` = "-1" AND `delete` = "0" AND `id` > ' . $f->see['id'] . ' ORDER BY `id` ASC LIMIT 1' + ) + ); + $url2 = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`title` FROM `forum_msg` WHERE `fid` = "' . $f->see['fid'] . '" AND `topic` = "-1" AND `delete` = "0" AND `id` < ' . $f->see['id'] . ' ORDER BY `id` DESC LIMIT 1' + ) + ); + + if (isset($url1['id'])) { + $url1 = '« предыдущая ветвь'; + } else { + $url1 = '« предыдущая ветвь'; + } + if (isset($url2['id'])) { + $url2 = 'следующая ветвь »'; + } else { + $url2 = 'следующая ветвь »'; + } + + ?> +
     | форум | 
    +
    +
    +
     
    Страницы:
    +

    fm['name']; ?> > see['title']; ?>

    + user['align'] > 1.5 || $f->user['align'] > 3.05 || $f->user['admin'] > 0) && $f->mod == 1) { ?> +
    + Доступ: see['nocom']]; ?>
    +
    + +
    + +
    seeTopic(); ?>
    Страницы:
    user['id']) || !isset($f->user['id'])) { ?> +
    + see['nocom'] > 0) { + echo '

    Обсуждение закрыто

    '; + } elseif ($f->see['goodAdd'] != 1 || $f->pravasee() != 1) { + echo '

    Вы не можете оставлять ответы в этом топике.
    Попробуйте через ' . round( + $f->lst['time'] + 62 - time() + ) . ' сек.

    '; + }/*elseif($f->gd[$f->see['fid']]!=3 && $f->gd[$f->see['fid']]!=4 && $f->user['admin']==0) { echo '

    Вы не можете оставлять ответы в этом топике

    '; - }*/elseif($f->lst['time'] -
    - - - - - - - - - - - + }*/ elseif ($f->lst['time'] < time() - 60) { ?> + +

    Добавить свой ответ

    -
    - -
    - -
    -
    - - - - -
    user['admin']>0) - { - echo '

    '; - } - ?>
    - -
    + + + + + + + + + + +

    Добавить свой ответ

    + +
    + +
    + +
    +
    + + + + + +
    user['admin'] > 0) { + echo '

    '; + } + ?>
    + +
    +
    +
    +
    Временное ограничение на добавление ответов.

    '; + } ?> +
    +
    +
     
    - -
    Временное ограничение на добавление ответов.

    '; } ?> -
    -
     
    + + + +
    Ошибка: error; ?>
    Вернуться на форум
    + + +
      
    - r==-2){ - //МЕГА-выводим ошибку - ?> - - - - -
    Ошибка: error; ?>
    Вернуться на форум
    - - - -   -   - - +
    \ No newline at end of file diff --git a/head/buttons.php b/head/buttons.php deleted file mode 100644 index 0083285e..00000000 --- a/head/buttons.php +++ /dev/null @@ -1,1114 +0,0 @@ -Произошла ошибка

    Произошла ошибка:

    '.$e.'

    Назад


    (c) '.$c[1].'

    '); -} - -function GetRealIp() -{ - if (!empty($_SERVER['HTTP_CLIENT_IP'])) - { - $ip=$_SERVER['HTTP_CLIENT_IP']; - } - elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - { - $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; - } - else - { - $ip=$_SERVER['REMOTE_ADDR']; - } - return $ip; -} -define('IP',GetRealIp()); - -include_once('_incl_data/__config.php'); -include_once('_incl_data/class/__db_connect.php'); -include_once('_incl_data/class/__user.php'); -include_once('_incl_data/class/__filter_class.php'); -include_once('_incl_data/class/__chat_class.php'); - -ini_set( 'max_execution_time', '120' ); - -if(isset($_GET['showcode'])) -{ - include('show_reg_img/security.php'); - die(); -} - -if($u->info['joinIP']==1 && $u->info['ip']!=IP) -{ - er('#Пожалуйста авторизируйтесь с главной страницы'); -}elseif(isset($_GET['exit'])) -{ - setcookie('login','',time()-60*60*24*30,'',$c['host']); - setcookie('pass','',time()-60*60*24*30,'',$c['host']); - setcookie('login','',time()-60*60*24*30); - setcookie('pass','',time()-60*60*24*30); - mysql_query('UPDATE `users` SET `online` = "'.(time()-420).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); //520 - die(''); -}elseif(!isset($u->info['id'])) -{ - - /*setcookie('login','',time()-60*60*24*30,'',$c['host']); - setcookie('pass','',time()-60*60*24*30,'',$c['host']); - setcookie('login','',time()-60*60*24*30); - setcookie('pass','',time()-60*60*24*30);*/ - - er('Возникла проблема с определением id персонажа
    Авторизируйтесь с главной страницы.'); -} - -if($u->info['online'] < time()-60) -{ - $filter->setOnline($u->info['online'],$u->info['id'],0); - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); -} - -$u->stats = $u->getStats($u->info['id'],0); - -if($u->info['activ']>0) { - include('activnew.php'); - die(); -} - -?> - - - - -Браузерная игра - Новый Бойцовский Клуб - - - - - - - - - - - - - - - - - - - - - - - - -info['id'].'" LIMIT 1')); -if(isset($fpi['id'])) { - $i = 0; - $fpv = explode('|',$fpi['data']); - $fph = ''; - while( $i <= 10 ) { - $id = $fpv[$i]; - $id = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "'.mysql_real_escape_string($id).'" AND `delete` = 0 AND `inShop` = 0 LIMIT 1')); - if(isset($id['id'])) { - //есть итем - $idm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($id['item_id']).'" LIMIT 1')); - $idd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($idm['id']).'" LIMIT 1')); - //$po = ; - $fph .= 'top.addfastpanel(\''.$idm['id'].'\',\''.$idm['name'].'\',\''.$idm['type'].'\',\''.$id['1price'].'\',\''.$id['2price'].'\',\''.$u->city_name[$id['maidin']].'\',\''.$idm['img'].'\',\''.$id['item_id'].'\',\''.$idm['iznosNOW'].'\',\''.$idm['iznosMAX'].'\',\'1\',\'1\',\'1\',\'1\');'; - }else{ - //пусто - } - $i++; - } - echo ''; -}*/ -// -if( !isset($_COOKIE['d1c']) ) { - include('_incl_data/class/mobile.php'); - $detect = new Mobile_Detect; - $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); - $_COOKIE['d1c'] = $deviceType; - setcookie('d1c',$deviceType,(time()+86400)); -}else{ - $deviceType = $_COOKIE['d1c']; -} - -if( $deviceType == 'tablet' || $deviceType == 'phone' ) { - echo ''; -?> - - - - - - - - - - - - -testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_yes" LIMIT 1',1); -if(!isset($yes['id'])) -{ - //Пользовательское соглашение - if(isset($_GET['yes'])) - { - //согласен - $u->addAction(time(),'user_yes',''); - header('location: https://'.$c[$u->info['city']].'/bk'); - die(); - } - /*echo '
    -
    -Наверное Вы удивлены что это за текст?
    Пожалуйста уделите одну минуту Вашего драгоценного времени и прочитайте его:


    -  Добрый день, вечер или даже ночь! Вы наверное играли в Бойцовский Клуб? Да, точно играли, по крайней мере в проекты которые -себя называют "Лучший Клон БК" и т.д., а по факту, простите, это хуйня из под коня. Сейчас много проектов -которые создаются любителями, которые пользуются готовыми движками. Скачать и установить такой сайт -может любой школьник, даже безграмотный! Наш проект не такой! Постоянное развитие, улучшение, экшен, -да и к тому-же уникальность нашего движка не сможет оспорить ни один человек. Надеемся что Вам понравится -наш проект и Вы будете играть здесь до последнего дня проекта!
    -  Соглашаясь с этим текстом Вы отказывается от всего этого дерьма в интернете и вступаете в круг людей которые -за качество и отсутствие однообразия! Вас ждет множество удивительных вещей, в то время как другие потакают некачественному продукту. -

    Я полностью согласен с написанным выше текстом


    Если по каким-либо причинам Вы не согласны, то пожалуйста закройте наш сайт и более не открывайте! Спасибо! ;-) -
    ';*/ -//} -?> - -info['bithday'] == '01.01.1800') { -?> - - - -info['active']!='' && $u->info['mail']=='No E-mail') { - if($error!='') { - echo ''; - } -?> - - - - -
    - - - -
    -
    -
    -
    Настройки чата
    -
    -Скорость обновления:
    -
    Сортировка списка онлайн: -По убыванию
    -
    Экономия трафика
    -
    Сообщения с молчанкой
    - - -
    - - -
    - -
    - - - -
    -
    - -
    -
    - -
    - - - - - - - - - -
    - - - - - -
    - - - - - - - -
    ЗнанияПерсонажВыход
    -
    - - - - -
    -
    - - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    -
    - -
    -
    - - - - - -
    -
    -
    -
    - - - - - - -
    -
    -
    */ ?> - -
    - -
    - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - -
    - -
    -
    - -
    - info['admin'] > 0 ) { ?> - -
    - -
    -
    -
    -
    - - - - - - - - - info['level']>9){ ?> - - - - - - - - - - - - - info['level']>7){ ?> - - info['level']>=0){ ?> - - - info['align']==50 || $u->info['align2']==50 || $u->info['admin'] == 1) {?> - - info['align']>=1.1 && $u->info['align']<2 ){ ?> - - info['align']>=3.01 && $u->info['align']<4){ ?> - - info['vip']>time() || $u->stats['silvers']>0 || $u->stats['bronze']>0 || $u->stats['gold']>0 ){ ?> - - - - info['level']>= 0){ ?> - - info['align']>=1 && $u->info['align']<2){ ?> - - info['align']>=3 && $u->info['align']<4){ ?> - - info['align']==7) { ?> - - info['bukmeker']==1 || $u->info['admin']==1){ ?> - - info['admin'] > 0 || $u->info['align'] == 50){ ?> - - info['level']>-1){ ?> - - info['clan']>0){ ?> - - info['admin']>0){ ?> - - - - - - - - - - - - -
    info['admin'] > 0 ) { ?> onclick="top.frames['main'].location.href='map.php';" class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30" title="Чат">  - - - - - - - - -   - -
    -
    - - - - -info['active']!='' && $u->info['mail']!='No E-mail') -{ - $yes = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_active_good" LIMIT 1',1); - $yes2 = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "user_active_send" LIMIT 1',1); - if($u->info['login'] != '-LEL-') - { - mysql_query('UPDATE `stats` SET `active` = "" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - - /* - function send_mime_mail($name_from, // имя отправителя - $email_from, // email отправителя - $name_to, // имя получателя - $email_to, // email получателя - $data_charset, // кодировка переданных данных - $send_charset, // кодировка письма - $subject, // тема письма - $body // текст письма - ) - { - $to = mime_header_encode($name_to, $data_charset, $send_charset) - . ' <' . $email_to . '>'; - $subject = mime_header_encode($subject, $data_charset, $send_charset); - $from = mime_header_encode($name_from, $data_charset, $send_charset) - .' <' . $email_from . '>'; - if($data_charset != $send_charset) { - $body = iconv($data_charset, $send_charset, $body); - } - $headers = "From: $from\r\n"; - $headers .= "Content-type: text/plain; charset=$send_charset\r\n"; - - return mail($to, $subject, $body, $headers); - } - - function mime_header_encode($str, $data_charset, $send_charset) { - if($data_charset != $send_charset) { - $str = iconv($data_charset, $send_charset, $str); - } - return '=?' . $send_charset . '?B?' . base64_encode($str) . '?='; - } - - if(!isset($yes2['id'])) - { - //отправляем письмо - echo ''; - //$u->addAction(time(),'user_active_send',$u->info['mail']); - // получатели - send_mime_mail('www.new-combats.com', - 'support@new-combats.com', - ''.$u->info['login'].'', - $u->info['mail'], - 'CP1251', // кодировка, в которой находятся передаваемые строки - 'KOI8-R', // кодировка, в которой будет отправлено письмо - 'Активация персонажа '.$u->info['login'].'', - "Здравствуйте! Мы очень рады новому персонажу в нашем Мире! \r\n Ваш персонаж: ".$u->info['login']." [0] \r\n Ссылка для активации: https://capitalcity.new-combats.com/bk?active=".$u->info['active'].".\r\n\r\nС уважением, Администрация!"); - $u->addAction(time(),'user_active_send',$u->info['mail']); - - }elseif(!isset($yes['id'])) - { - //Пользовательское соглашение - if(isset($_GET['active']) && $u->info['active'] == $_GET['active']) - { - //согласен - $u->addAction(time(),'user_active_good',$u->info['mail']); - mysql_query('UPDATE `stats` SET `active` = "" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - die(''); - } - } - */ -} -?> - - - - \ No newline at end of file diff --git a/hmonitor.php b/hmonitor.php index 6a608e8e..0553dd05 100644 --- a/hmonitor.php +++ b/hmonitor.php @@ -1,194 +1,198 @@ - - + - - - - - -Монитор поединков + + + + + + Монитор поединков -
    Просматривает персонаж: microLogin($u->info['id'],1)?>
    +
    Просматривает персонаж: microLogin($u->info['id'], 1) ?>

    -
    -

                          Заявки на хаотические поединки

    -
    +

                          Заявки + на хаотические поединки

    +microLogin($plu['id'],1).','; - } - // - if( $users == '' ) { - $users = 'Поле боя ждет своих героев!'; - }else{ - $users = rtrim($users,','); - } - // - $html .= $i . '. '.date('H:i',$pl['time']).' '; - $html .= ' '; - $html .= ' ('.$users.') ('.$pl['min_lvl_1'].'-'.$pl['max_lvl_1'].') Тип боя: '; - if( $pl['noinc'] > 0 ) { - $html .= ''; - } - if( $pl['fastfight'] > 0 ) { - $html .= ''; - } - if( $pl['arand'] > 0 ) { - $html .= ''; - } - $html .= 'Бой начнется через '.$u->timeOut($pl['time']+$pl['time_start']-time()).', таймаут '.$u->timeOut($pl['timeout']).''; - if( $pl['priz'] > 0 ) { - $html .= '(Героическое Сражение)
    '; - } - $html .= '
    '; +while ($pl = mysql_fetch_array($sp)) { + $i++; + // + $users = ''; + // + $spu = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $pl['id'] . '"'); + while ($plu = mysql_fetch_array($spu)) { + $users .= $u->microLogin($plu['id'], 1) . ','; + } + // + if ($users == '') { + $users = 'Поле боя ждет своих героев!'; + } else { + $users = rtrim($users, ','); + } + // + $html .= $i . '. ' . date('H:i', $pl['time']) . ' '; + $html .= ' '; + $html .= ' (' . $users . ') (' . $pl['min_lvl_1'] . '-' . $pl['max_lvl_1'] . ') Тип боя: '; + if ($pl['noinc'] > 0) { + $html .= ''; + } + if ($pl['fastfight'] > 0) { + $html .= ''; + } + if ($pl['arand'] > 0) { + $html .= ''; + } + $html .= 'Бой начнется через ' . $u->timeOut( + $pl['time'] + $pl['time_start'] - time() + ) . ', таймаут ' . $u->timeOut($pl['timeout']) . ''; + if ($pl['priz'] > 0) { + $html .= '(Героическое Сражение)
    '; + } + $html .= '
    '; } -if( $html == '' ) { - $html = '
    (Раздел пуст)
    '; +if ($html == '') { + $html = '
    (Раздел пуст)
    '; } -echo $html; $html = ''; +echo $html; +$html = ''; ?>

    Текущие бои

    -microLogin($plu['id'],1).','; - } - // - if( count($usersa) > 0 ) { - $j = 0; - while( $j < count($userst) ) { - if( $users != '' ) { - $users .= '  против  '; - } - $users .= $usersa[$userst[$j]]; - $users = rtrim($users,','); - $j++; - } - // - $i++; - // - - $html .= $i . '. '.date('d.m.Y H:i',$pl['time_start']).' '; - $html .= ' '; - $html .= ' ('.$users.') Тип боя: '; - if( $pl['noinc'] > 0 ) { - $html .= ''; - } - if( $pl['fastfight'] > 0 ) { - $html .= ''; - } - if( $pl['arand'] > 0 ) { - $html .= ''; - } - $html .= ', таймаут '.$u->timeOut($pl['timeout']).''; - if( $pl['priz'] > 0 ) { - $html .= '(Героическое Сражение)
    '; - } - $html .= ' »» '; - $html .= '
    '; - } - // +while ($pl = mysql_fetch_array($sp)) { + // + $users = ''; + $usersa = []; + $userst = []; + // + $spu = mysql_query( + 'SELECT `a`.`id`,`b`.`team` FROM `users` AS `a` LEFT JOIN `stats` AS `b` ON `a`.`id` = `b`.`id` WHERE `a`.`battle` = "' . $pl['id'] . '"' + ); + while ($plu = mysql_fetch_array($spu)) { + if (!isset($usersa[$plu['team']])) { + $userst[] = $plu['team']; + } + $usersa[$plu['team']] .= $u->microLogin($plu['id'], 1) . ','; + } + // + if (count($usersa) > 0) { + $j = 0; + while ($j < count($userst)) { + if ($users != '') { + $users .= '  против  '; + } + $users .= $usersa[$userst[$j]]; + $users = rtrim($users, ','); + $j++; + } + // + $i++; + // + + $html .= $i . '. ' . date('d.m.Y H:i', $pl['time_start']) . ' '; + $html .= ' '; + $html .= ' (' . $users . ') Тип боя: '; + if ($pl['noinc'] > 0) { + $html .= ''; + } + if ($pl['fastfight'] > 0) { + $html .= ''; + } + if ($pl['arand'] > 0) { + $html .= ''; + } + $html .= ', таймаут ' . $u->timeOut($pl['timeout']) . ''; + if ($pl['priz'] > 0) { + $html .= '(Героическое Сражение)
    '; + } + $html .= ' »» '; + $html .= '
    '; + } + // } -if( $html == '' ) { - $html = '
    (Раздел пуст)
    '; +if ($html == '') { + $html = '
    (Раздел пуст)
    '; } -echo $html; $html = ''; +echo $html; +$html = ''; ?>

    Башня смерти

    -city_name[$pl['city']].'" src="https://img.new-combats.com/i/city_ico/'.$pl['city'].'.gif">'; - // - $html .= ' ['.$pl['level'].']'; - if( $pl['status'] == 0 ) { - //Ожидаем начала нового турнира - $html .= ' Начало турнира в "Башне Смерти" : '.date('d.m.Y H:i',$pl['time_start']).' ( Начнется через '.$u->timeOut($pl['time_start']-time()).') Призовой фонд на текущий момент: '.round(($pl['money']/100*85),2).' кр. Всего подано заявок: '.$pl['users'].''; - }else{ - //Уже идет турнир - $users = ''; - $spu = mysql_query('SELECT `id` FROM `users` WHERE `inTurnir` = "'.$pl['id'].'"'); - while( $plu = mysql_fetch_array($spu) ) { - $users .= $u->microLogin($plu['id'],1). ','; - } - $users = rtrim($users,','); - $html .= ' Турнир Башни Смерти уже идет.'; - $html .= ' Участники: '.$users.', Лог турнира: »»'; - } - // - $html .= '
    '; - // +while ($pl = mysql_fetch_array($sp)) { + $i++; + // + $html .= $i . '. '; + // + $html .= ' [' . $pl['level'] . ']'; + if ($pl['status'] == 0) { + //Ожидаем начала нового турнира + $html .= ' Начало турнира в "Башне Смерти" : ' . date( + 'd.m.Y H:i', $pl['time_start'] + ) . ' ( Начнется через ' . $u->timeOut( + $pl['time_start'] - time() + ) . ') Призовой фонд на текущий момент: ' . round( + ($pl['money'] / 100 * 85), 2 + ) . ' кр. Всего подано заявок: ' . $pl['users'] . ''; + } else { + //Уже идет турнир + $users = ''; + $spu = mysql_query('SELECT `id` FROM `users` WHERE `inTurnir` = "' . $pl['id'] . '"'); + while ($plu = mysql_fetch_array($spu)) { + $users .= $u->microLogin($plu['id'], 1) . ','; + } + $users = rtrim($users, ','); + $html .= ' Турнир Башни Смерти уже идет.'; + $html .= ' Участники: ' . $users . ', Лог турнира: »»'; + } + // + $html .= '
    '; + // } -if( $html == '' ) { - $html = '
    (Раздел пуст)
    '; +if ($html == '') { + $html = '
    (Раздел пуст)
    '; } -echo $html; $html = ''; +echo $html; +$html = ''; ?>

    Войны кланов

    -(Раздел пуст)'; +(Раздел пуст)'; } -echo $html; $html = ''; +echo $html; +$html = ''; ?>

    История Великих сражений

    -(Раздел пуст)'; +(Раздел пуст)'; } -echo $html; $html = ''; +echo $html; +$html = ''; ?> -

    Бойцовский Клуб v2.1 © , «www.new-combats.com»™    
    -

    +
    +
    + Бойцовский Клуб v2.1 © , «www.new-combats.com»™    
    +

    -
    - - - - - -
    + diff --git a/inf.php b/inf.php index 2ee62c9f..55118618 100644 --- a/inf.php +++ b/inf.php @@ -1,152 +1,195 @@ - 1 && $inf['info_delete'] < time() ) { - $inf['info_delete'] = 0; - mysql_query('UPDATE `users` SET `info_delete` = 0 WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - } - } +if ($uplogin == 'delete' || $utf8Login == 'delete' || $utf8Login2 == 'delete') { + +} else { + $inf = mysql_fetch_array( + mysql_query( + 'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE ((`u`.`login`="' . mysql_real_escape_string( + $_GET['login'] + ) . '" OR `u`.`login`="' . mysql_real_escape_string( + $utf8Login2 + ) . '" OR `u`.`login`="' . mysql_real_escape_string( + $utf8Login + ) . '" OR `u`.`login`="' . mysql_real_escape_string($uplogin) . '") ) LIMIT 1' + ) + ); + if (!isset($inf['id'])) { + $inf = mysql_fetch_array( + mysql_query( + 'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE (`u`.`id`="' . mysql_real_escape_string( + $_GET['id'] + ) . '" OR `u`.`id`="' . mysql_real_escape_string($uplogin) . '") LIMIT 1' + ) + ); + } + if ($inf['login'] == 'delete' || $inf['login'] == 'DELETE') { + unset($inf); + } else { + if ($inf['info_delete'] > 1 && $inf['info_delete'] < time()) { + $inf['info_delete'] = 0; + mysql_query('UPDATE `users` SET `info_delete` = 0 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + } + } +} +if (!isset($inf['id'])) { + unset($inf); +} else { + + if (isset($_GET['restartmonster']) && $u->info['admin'] > 0) { + mysql_query( + 'UPDATE `stats` SET `res_x` = 0 WHERE `id` = "' . mysql_real_escape_string($inf['id']) . '" LIMIT 1' + ); + $inf['res_x'] = 0; + } + if ($inf['haos'] > 1) { + //снимаем хаос + if ($inf['haos'] < time()) { + $inf['align'] = 0; + mysql_query('UPDATE `users` SET `align` = "0",`haos` = "0" WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + } + } + if ($u->info['admin'] > 0) { + if (isset($_GET['wipe']) && $u->newAct($_GET['sd4']) == true) { + $upd = mysql_query('UPDATE `stats` SET `wipe` = "1" WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); + if ($upd) { + $uer = 'Сброс характеристик прошел успешно
    '; + } else { + $uer = 'Ошибка сброса...
    '; + } + } + } + if (($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0) { + if (isset($_GET['molchMax']) && $u->newAct($_GET['sd4']) == true) { + $upd = mysql_query( + 'UPDATE `users` SET `molch3` = "' . $inf['molch1'] . '" WHERE `id` = "' . $inf['id'] . '" LIMIT 1' + ); + if ($upd) { + $uer = 'Все прошло успешно...
    '; + } else { + $uer = 'Ошибка...
    '; + } + } + } } -if(!isset($inf['id'])) -{ - unset($inf); -}else{ - - if(isset($_GET['restartmonster']) && $u->info['admin'] > 0) { - mysql_query('UPDATE `stats` SET `res_x` = 0 WHERE `id` = "'.mysql_real_escape_string($inf['id']).'" LIMIT 1'); - $inf['res_x'] = 0; - } - if($inf['haos']>1) - { - //снимаем хаос - if($inf['haos']info['admin']>0) - { - if(isset($_GET['wipe']) && $u->newAct($_GET['sd4'])==true) - { - $upd = mysql_query('UPDATE `stats` SET `wipe` = "1" WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - if($upd) - { - $uer = 'Сброс характеристик прошел успешно
    '; - }else{ - $uer = 'Ошибка сброса...
    '; - } - } - } - if(($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4) || $u->info['admin']>0) - { - if(isset($_GET['molchMax']) && $u->newAct($_GET['sd4'])==true) - { - $upd = mysql_query('UPDATE `users` SET `molch3` = "'.$inf['molch1'].'" WHERE `id` = "'.$inf['id'].'" LIMIT 1'); - if($upd) - { - $uer = 'Все прошло успешно...
    '; - }else{ - $uer = 'Ошибка...
    '; - } - } - } +if ($inf['room'] == 303 && $u->info['admin'] == 0) { + unset($inf); } -if( $inf['room'] == 303 && $u->info['admin'] == 0 ) { - unset($inf); -} - -if(!isset($inf['id'])) -{ - die('Ошибка. Персонаж не найден.'); - die(' +if (!isset($inf['id'])) { + die('Ошибка. Персонаж не найден.'); + die( + ' @@ -154,2142 +197,2537 @@ if(!isset($inf['id'])) Произошла ошибка:
    Указанный персонаж не найден...

    Назад


    -

    © '.$c['title'].'

    - '.$c['counters'].' - '); +

    © ' . $c['title'] . '

    + ' . $c['counters'] . ' + ' + ); } -if($u->info['align'] > 1 && $u->info['align'] < 2) { - -}elseif($u->info['align'] > 3 && $u->info['align'] < 4) { - -}elseif($inf['redirect'] != '0' && $u->info['admin'] == 0 && $u->info['id'] != $inf['id']) { - header('location: '.$inf['redirect']); - die(); +if ($u->info['align'] > 1 && $u->info['align'] < 2) { + +} elseif ($u->info['align'] > 3 && $u->info['align'] < 4) { + +} elseif ($inf['redirect'] != '0' && $u->info['admin'] == 0 && $u->info['id'] != $inf['id']) { + header('location: ' . $inf['redirect']); + die(); } -function zodiak($d,$m,$y) +function zodiak($d, $m, $y) { -$dr = $d; -switch($m) -{ - case '03': - $zodiac_id = 12; - if($dr > 20) $zodiac_id = 1; - break; - case '04': - $zodiac_id = 1; - if($dr > 19) $zodiac_id = 2; - break; - case '05': - $zodiac_id = 2; - if($dr > 20) $zodiac_id = 3; - break; - case '06': - $zodiac_id = 3; - if($dr > 21) $zodiac_id = 4; - break; - case '07': - $zodiac_id = 4; - if($dr > 22) $zodiac_id = 5; - break; - case '08': - $zodiac_id = 5; - if($dr > 22) $zodiac_id = 6; - break; - case '09': - $zodiac_id = 6; - if($dr > 22) $zodiac_id = 7; - break; - case '10': - $zodiac_id = 7; - if($dr > 22) $zodiac_id = 8; - break; - case '11': - $zodiac_id = 8; - if($dr > 21) $zodiac_id = 9; - break; - case '12': - $zodiac_id = 9; - if($dr > 21) $zodiac_id = 10; - break; - case '01': - $zodiac_id = 10; - if($dr > 19) $zodiac_id = 11; - break; - case '02': - $zodiac_id = 11; - if($dr > 18) $zodiac_id = 12; - break; - } - return $zodiac_id; + $dr = $d; + switch ($m) { + case '03': + $zodiac_id = 12; + if ($dr > 20) { + $zodiac_id = 1; + } + break; + case '04': + $zodiac_id = 1; + if ($dr > 19) { + $zodiac_id = 2; + } + break; + case '05': + $zodiac_id = 2; + if ($dr > 20) { + $zodiac_id = 3; + } + break; + case '06': + $zodiac_id = 3; + if ($dr > 21) { + $zodiac_id = 4; + } + break; + case '07': + $zodiac_id = 4; + if ($dr > 22) { + $zodiac_id = 5; + } + break; + case '08': + $zodiac_id = 5; + if ($dr > 22) { + $zodiac_id = 6; + } + break; + case '09': + $zodiac_id = 6; + if ($dr > 22) { + $zodiac_id = 7; + } + break; + case '10': + $zodiac_id = 7; + if ($dr > 22) { + $zodiac_id = 8; + } + break; + case '11': + $zodiac_id = 8; + if ($dr > 21) { + $zodiac_id = 9; + } + break; + case '12': + $zodiac_id = 9; + if ($dr > 21) { + $zodiac_id = 10; + } + break; + case '01': + $zodiac_id = 10; + if ($dr > 19) { + $zodiac_id = 11; + } + break; + case '02': + $zodiac_id = 11; + if ($dr > 18) { + $zodiac_id = 12; + } + break; + } + return $zodiac_id; } + $id_zodiak = null; -$bday = explode('.',$inf['bithday']); -if(isset($bday[0],$bday[1],$bday[2])) -{ -$id_zodiak = zodiak($bday[0],$bday[1],$bday[2]); +$bday = explode('.', $inf['bithday']); +if (isset($bday[0], $bday[1], $bday[2])) { + $id_zodiak = zodiak($bday[0], $bday[1], $bday[2]); } -if($id_zodiak==null) -{ - $id_zodiak = 1; +if ($id_zodiak == null) { + $id_zodiak = 1; } -$name_zodiak = array(1=>'Овен',2=>'Телец',3=>'Близнецы',4=>'Рак',5=>'Лев',6=>'Дева',7=>'Весы',8=>'Скорпион',9=>'Стрелец',10=>'Козерог',11=>'Водолей',12=>'Рыбы'); +$name_zodiak = [1 => 'Овен', 2 => 'Телец', 3 => 'Близнецы', 4 => 'Рак', 5 => 'Лев', 6 => 'Дева', 7 => 'Весы', 8 => 'Скорпион', 9 => 'Стрелец', 10 => 'Козерог', 11 => 'Водолей', 12 => 'Рыбы']; $name_zodiak = $name_zodiak[$id_zodiak]; function statInfo($s) { - global $st,$st2; - $st[$s] = 0+$st[$s]; - $st2[$s] = 0+$st2[$s]; - if($st[$s]!=$st2[$s]) - { - $s1 = '+'; - if($st2[$s]>$st[$s]) - { - $s1 = '-'; - } - -$cl = array( --2=>"#550000", --1=>"#990000", -0 =>"#000000", -33=>"#004000", -34=>"#006000", -35=>"#006100", -36=>"#006200", -37=>"#006300", -38=>"#006400", -39=>"#006500", -40=>"#006600", -41=>"#006700", -42=>"#006800", -43=>"#006900", -44=>"#006A00", -45=>"#006B00", -46=>"#006C00", -47=>"#006D00", -48=>"#006E00", -49=>"#006F00", -50=>"#007000", -51=>"#007100", -52=>"#007100", -53=>"#007200", -54=>"#007300", -55=>"#007400", -56=>"#007500", -57=>"#007600", -58=>"#007700", -59=>"#007800", -60=>"#007900", -61=>"#007A00", -62=>"#007B00", -63=>"#007C00", -64=>"#007D00", -65=>"#007E00", -66=>"#007F00", -67=>"#008000", -68=>"#008100", -69=>"#008200", -70=>"#008300", -71=>"#008400", -72=>"#008500", -73=>"#008600", -74=>"#008700", -75=>"#008700", -76=>"#008800", -77=>"#008900", -78=>"#008A00", -79=>"#008B00", -80=>"#008C00", -81=>"#008D00", -82=>"#008E00", -83=>"#008F00", -84=>"#009000", -85=>"#009100", -86=>"#009200", -87=>"#009300", -88=>"#009400", -89=>"#009500", -90=>"#009600", -91=>"#009700", -92=>"#009800", -93=>"#009900", -94=>"#009A00", -95=>"#009B00", -96=>"#009C00", -97=>"#009D00", -98=>"#009E00", -99=>"#009F00", -100=>"#00A000" -); - - - //$cl = array(0=>'#003C00',1=>'green',2=>'#0DAC0D',3=>'#752415',4=>''); - $si = 4; - if($s1=='-') - { - $si = 0; - } - $t = $st[$s]; - $j = $st[$s]-$st2[$s]; - $t = $t-$j; - if($j>0) - { - if($t==0) - { - $t = 1; - } - if($t==0) - { - $t = 1; - } - $d = $j*100/$t; - if($d<0 && $t+$j>=0) - { - $d = 100; - } - if($d < 33) - { - $si = 0; - }elseif($d > 100) - { - $si = 100; - } - }elseif($j<0) - { - $si = 3; - } - - if($st[$s] <- 0) { - $si = -1; - }elseif($st[$s] <= round($st2[$s])) { - $si = -2; - } - echo ''.$st[$s].' ('.$st2[$s].' '.$s1.' '.abs($st[$s]-$st2[$s]).')'; - }else{ - echo ''.$st[$s].''; - } + global $st, $st2; + $st[$s] = 0 + $st[$s]; + $st2[$s] = 0 + $st2[$s]; + if ($st[$s] != $st2[$s]) { + $s1 = '+'; + if ($st2[$s] > $st[$s]) { + $s1 = '-'; + } + + $cl = [ + -2 => "#550000", + -1 => "#990000", + 0 => "#000000", + 33 => "#004000", + 34 => "#006000", + 35 => "#006100", + 36 => "#006200", + 37 => "#006300", + 38 => "#006400", + 39 => "#006500", + 40 => "#006600", + 41 => "#006700", + 42 => "#006800", + 43 => "#006900", + 44 => "#006A00", + 45 => "#006B00", + 46 => "#006C00", + 47 => "#006D00", + 48 => "#006E00", + 49 => "#006F00", + 50 => "#007000", + 51 => "#007100", + 52 => "#007100", + 53 => "#007200", + 54 => "#007300", + 55 => "#007400", + 56 => "#007500", + 57 => "#007600", + 58 => "#007700", + 59 => "#007800", + 60 => "#007900", + 61 => "#007A00", + 62 => "#007B00", + 63 => "#007C00", + 64 => "#007D00", + 65 => "#007E00", + 66 => "#007F00", + 67 => "#008000", + 68 => "#008100", + 69 => "#008200", + 70 => "#008300", + 71 => "#008400", + 72 => "#008500", + 73 => "#008600", + 74 => "#008700", + 75 => "#008700", + 76 => "#008800", + 77 => "#008900", + 78 => "#008A00", + 79 => "#008B00", + 80 => "#008C00", + 81 => "#008D00", + 82 => "#008E00", + 83 => "#008F00", + 84 => "#009000", + 85 => "#009100", + 86 => "#009200", + 87 => "#009300", + 88 => "#009400", + 89 => "#009500", + 90 => "#009600", + 91 => "#009700", + 92 => "#009800", + 93 => "#009900", + 94 => "#009A00", + 95 => "#009B00", + 96 => "#009C00", + 97 => "#009D00", + 98 => "#009E00", + 99 => "#009F00", + 100 => "#00A000", + ]; + + + //$cl = array(0=>'#003C00',1=>'green',2=>'#0DAC0D',3=>'#752415',4=>''); + $si = 4; + if ($s1 == '-') { + $si = 0; + } + $t = $st[$s]; + $j = $st[$s] - $st2[$s]; + $t = $t - $j; + if ($j > 0) { + if ($t == 0) { + $t = 1; + } + if ($t == 0) { + $t = 1; + } + $d = $j * 100 / $t; + if ($d < 0 && $t + $j >= 0) { + $d = 100; + } + if ($d < 33) { + $si = 0; + } elseif ($d > 100) { + $si = 100; + } + } elseif ($j < 0) { + $si = 3; + } + + if ($st[$s] < -0) { + $si = -1; + } elseif ($st[$s] <= round($st2[$s])) { + $si = -2; + } + echo '' . $st[$s] . ' (' . $st2[$s] . ' ' . $s1 . ' ' . abs( + $st[$s] - $st2[$s] + ) . ')'; + } else { + echo '' . $st[$s] . ''; + } } -$room = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `id`="'.$inf['room'].'" LIMIT 1')); +$room = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `id`="' . $inf['room'] . '" LIMIT 1')); -if($inf['clan']>0) -{ - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="'.$inf['clan'].'" LIMIT 1')); -} - -if(isset($_GET['short'])) -{ - $n = ' -'; - $o = 0; - if($inf['online']>time()-520) - { - $o = 1; - } - $sh = ''; - $sh .= 'id='.$inf['id'].$n; - $sh .= 'login='.$inf['login'].$n; - $sh .= 'level='.$inf['level'].$n; - $sh .= 'align='.$inf['align'].$n; - $sh .= 'clan='.$pc['name_mini'].$n; - $sh .= 'sex='.$inf['sex'].$n; - $sh .= 'city='.$inf['city'].$n; - $sh .= 'city_reg='.$inf['cityreg'].$n; - $sh .= 'room_name='.$room['name'].$n; - $sh .= 'online='.$o.$n; - die($sh); +if ($inf['clan'] > 0) { + $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="' . $inf['clan'] . '" LIMIT 1')); } $nopal = false; -if( $u->info['align'] < $inf['align'] && $inf['align'] > 1 && $inf['align'] < 2 && $u->info['admin'] == 0 ) { - $nopal = true; -}elseif( $u->info['admin'] == 0 && $inf['admin'] > 0 ) { - $nopal = true; +if ($u->info['align'] < $inf['align'] && $inf['align'] > 1 && $inf['align'] < 2 && $u->info['admin'] == 0) { + $nopal = true; +} elseif ($u->info['admin'] == 0 && $inf['admin'] > 0) { + $nopal = true; } -if( $u->info['admin'] == 0 ) { - $nopal = true; +if ($u->info['admin'] == 0) { + $nopal = true; } -if( $inf['inTurnir'] > 0 && ($u->info['inTurnir'] == $inf['inTurnir'] || $u->info['admin'] > 0) ) { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$inf['inTurnir'].'" LIMIT 1')); - if( isset($bs['id']) && ( $bs['users'] <= 2 || $bs['type_btl'] == 1 ) ) { - $bs_rm = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$bs['type_map'].'" AND `x` = "'.$inf['x'].'" AND `y` = "'.$inf['y'].'" LIMIT 1')); - if( isset($bs_rm['id']) ) { - $room['name'] .= ' - '.$bs_rm['name']; - } - } +if ($inf['inTurnir'] > 0 && ($u->info['inTurnir'] == $inf['inTurnir'] || $u->info['admin'] > 0)) { + $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $inf['inTurnir'] . '" LIMIT 1')); + if (isset($bs['id']) && ($bs['users'] <= 2 || $bs['type_btl'] == 1)) { + $bs_rm = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "' . $bs['type_map'] . '" AND `x` = "' . $inf['x'] . '" AND `y` = "' . $inf['y'] . '" LIMIT 1' + ) + ); + if (isset($bs_rm['id'])) { + $room['name'] .= ' - ' . $bs_rm['name']; + } + } } ?> - -Информация о <? echo $inf['login']; ?> - - - - - - - - - - + .pg_btn1 { + background-image: url(https://img.new-combats.com/pg_btn_left.png); + width: 27px; + height: 78px; + cursor: pointer; + display: block; + } + + .pg_btn1:hover { + background-position: -27px; + cursor: pointer; + } + + .pg_btn1:active { + background-position: -55px; + cursor: pointer; + } + + .pg_btn2 { + background-image: url(https://img.new-combats.com/pg_btn_right.png); + background-position: -54px; + width: 27px; + height: 78px; + cursor: pointer; + display: block; + } + + .pg_btn2:hover { + background-position: -27px; + cursor: pointer; + } + + .pg_btn2:active { + background-position: 1px; + cursor: pointer; + } + + progress { + -webkit-appearance: none; + appearance: none; + } + + .prog0 { + width: 10em; + height: 1em; + } + + .prog0::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog0[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #09c, #7FFFD4); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .prog1 { + width: 10em; + height: 1em; + } + + .prog1::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog1[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #7FFFD4, #F4A460); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .prog2 { + width: 10em; + height: 1em; + } + + .prog2::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog2[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #F4A460, #FFC0CB); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .prog3 { + width: 10em; + height: 1em; + } + + .prog3::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog3[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #FFC0CB, #FFD700); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .prog4 { + width: 10em; + height: 1em; + } + + .prog4::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog4[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #FFD700, #FF0000); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .prog5 { + width: 10em; + height: 1em; + } + + .prog5::-webkit-progress-bar { + background-color: #eee; + border-radius: 2px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset; + } + + .prog5[value]::-webkit-progress-value { + background-image: -webkit-linear-gradient(-45deg, + transparent 33%, rgba(0, 0, 0, .1) 33%, + rgba(0, 0, 0, .1) 66%, transparent 66%), + -webkit-linear-gradient(top, + rgba(255, 255, 255, .25), + rgba(0, 0, 0, .25)), + -webkit-linear-gradient(left, #FF0000, #FF0000); + + border-radius: 2px; + background-size: 35px 20px, 100% 100%, 100% 100%; + } + + .dvfirs { + overflow: hidden; + white-space: nowrap; + float: left; + margin-left: 20px; + width: 350px; + text-align: center; + } + + .dvsec { + overflow: hidden; + white-space: nowrap; + float: left; + width: 140px; + } + + .dvtre { + overflow: hidden; + white-space: nowrap; + float: left; + width: 60px; + } + + - + -'.$uer.'

    '; } ?> +' . $uer . '
    '; +} ?> - - -
    - - - + '; + } + echo '

    -
    getStats($inf['id'],1,0,true); $st2 = $st[1]; $st = $st[0]; - - //if( $u->info['admin'] > 0 ) { - // echo '
    Мощность персонажа: '.$st['reting'].'
    '; - //} - - $rgd = $u->regen($inf['id'],$st,1); $us = $u->getInfoPers($inf['id'],1,$st); if( isset($bs['id']) && $bs['type_btl'] == 2 && ($u->info['x'] != $inf['x'] || $u->info['y'] != $inf['y'])) { $us[0] = '








    Информация скрыта,
    Вы в разных комнатах.






    '; } if($us!=false){ echo $us[0]; }else{ echo 'information is lost.'; } ?>
    - -
    - 1, - 1 => 1, - 2 => 3, - 3 => 3, - 4 => 3, - 5 => 7, - 6 => 7, - 7 => 7, - 8 => 14, - 9 => 14, - 10 => 30, - 11 => 30, - 12 => 30, - 13 => 30, - 14 => 30, - 15 => 30, - 16 => 60, - 17 => 60, - 18 => 60, - 19 => 60, - 20 => 60, - 21 => 60 -); +
    + + + - '; - } - echo '

    +
    getStats($inf['id'], 1, 0, true); + $st2 = $st[1]; + $st = $st[0]; -?> - - 0 ) { - if($inf['battle']>0) - { - $btl3 = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = '.$inf['battle'].'')); - if(isset($btl3['id']) && $btl3['time_over']==0) - { - echo '

    Персонаж сейчас в поединке
    '; - } - } - }elseif( $inf['room'] != 303 ) { - echo '
    '; - - - if($inf['online']>time()-520 && $inf['banned']==0 && $inf['invis']!=1 && $inf['invis'] < time()) - { - echo 'Персонаж сейчас находится в клубе.
    "'.$room['name'].'"'; - }else{ - if($inf['admin']==0 || $inf['admin']==2) - { - if($inf['online']==0) - { - $inf['online'] = $inf['timeREG']; - } - echo 'Персонаж не в клубе'; - if(date('Y',$inf['online']) == date('Y')) { - echo ', но был тут:
    '.date('d.m.Y H:i',$inf['online']).''; - $out = ''; - $time_still = time()-$inf['online']; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/604800); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - $out = $time_still.' сек.'; - } - echo '
    ('.$out.' назад)'; - } - }elseif($inf['admin']>0) - { - echo 'Персонаж не в клубе.'; - } - } - if($inf['inUser']>0 AND $inf['id']!=12059 ) - { - echo '
    Персонаж вселился в бота'; - } - if($inf['battle']>0) - { - $btl3 = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = '.$inf['battle'].'')); - if(isset($btl3['id']) && $btl3['time_over']==0) - { - echo '
    Персонаж сейчас в поединке'; - } - } - echo '
    '; - }else{ - if( $inf['res_x']-time() > 0 ) { - echo '
    Появится через '.($u->timeOut(($inf['res_x']-time()))).'
    '; - }else{ - echo '
    Появится в ближайшее время...
    '; - } - } - //Эффект админ - if($u->info['admin'] > 0) { - - if(isset($_GET['cancel_eff'])) { - mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.mysql_real_escape_string((int)$_GET['cancel_eff']).'" AND `uid` = "'.$inf['id'].'" LIMIT 1'); - die(''); - } - - function eff_adm($pl) { - global $u; - $r = ''; - if($pl['v1'] != 'priem') { - $eff = mysql_fetch_array(mysql_query('SELECT `id2`,`img`,`actionTime` FROM `eff_main` WHERE `id2` = "'.$pl['id_eff'].'" LIMIT 1')); - $pl['img2'] = $eff['img']; - $pl['name'] .= "\r".'Действует еще '.$u->timeOut($pl['timeUse']-time()+$eff['actionTime']).''; - } - $r .= ''; - return $r; - } - - $eff_adm = ''; - $sp = mysql_query('SELECT `id_eff`,`uid`,`id`,`name`,`img2`,`v1`,`v2`,`timeUse` FROM `eff_users` WHERE `uid` = "'.$inf['id'].'" AND `delete` = "0"'); - while($pl = mysql_fetch_array($sp)) { - $eff_adm .= eff_adm($pl); - } - if($eff_adm != '') { - echo '
    Эффекты на персонаже:
    '.$eff_adm.'
    '; - } - } - if($u->info['admin'] > 0) { - ?> -
    - - -
    -
    Показать модификаторы
    -
    - -
    - + + +
    info['admin'] > 0 ) { - $nodell = mysql_fetch_array(mysql_query('SELECT `id`,`inUser` FROM `users` WHERE `login` = "'.$inf['login'].'" ORDER BY `id` ASC LIMIT 1')); - $sp = mysql_query('SELECT `id`,`level`,`inTurnir`,`room`,`battle`,`inTurnirnew`,`inUser` FROM `users` WHERE `login` = "'.$inf['login'].'" AND `id` != "'.$inf['id'].'"'); - while( $pl = mysql_fetch_array($sp)) { - if( isset($_GET['del_copy']) && $_GET['del_copy'] == $pl['id'] ) { - if( $nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id'] ) { - mysql_query('UPDATE `users` SET `login` = "DELETE" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - }else{ - $nolog .= '
    '.$u->microLogin($pl['id'],1); - if( $nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id'] ) { - $nolog .= ' (персонажа можно удалить)'; - } - if( $pl['id'] == $nodell['id'] ) { - $nolog .= ' (основной персонаж)'; - } - $nolog .= '
    '; - } - } - if( $nolog != '' ) { - $nolog = 'Копии персонажа:'.$nolog.''; - echo $nolog; - } - - } - ?>
    Сила:
    - Ловкость:
    - Интуиция:
    - Выносливость:
    - 3 || $st['s5']!=0){ ?>Интеллект:
    - 6 || $st['s6']!=0){ ?>Мудрость:
    - 9 || $st['s7']!=0){ ?>Духовность:
    - 11 || $st['s8']!=0){ ?>Воля:
    - 14 || $st['s9']!=0){ ?>Свобода духа:
    - 19 || $st['s10']!=0){ ?>Божественность:
    - 0 ) { ?> - Энергия:
    - - Рейтинг сегодня:
    -
    -
    -
    - info['admin'] > 0 ) { echo 'Уровень:'; }else{ echo 'Уровень:'; } ?>
    - - Побед: '.number_format($inf['win'], 0, ",", " ").''; } ?>
    - Поражений:
    - Ничьих:
    - - - Орден Алхимиков'; if($inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '
    '; } ?> - Орден Рекламного Развития'; if($inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '
    '; } ?> - regen($inf['id'], $st, 1); + $us = $u->getInfoPers($inf['id'], 1, $st); + if (isset($bs['id']) && $bs['type_btl'] == 2 && ($u->info['x'] != $inf['x'] || $u->info['y'] != $inf['y'])) { + $us[0] = '








    Информация скрыта,
    Вы в разных комнатах.






    '; + } + if ($us != false) { + echo $us[0]; + } else { + echo 'information is lost.'; + } ?>
    + +
    +
    + + 1, + 1 => 1, + 2 => 3, + 3 => 3, + 4 => 3, + 5 => 7, + 6 => 7, + 7 => 7, + 8 => 14, + 9 => 14, + 10 => 30, + 11 => 30, + 12 => 30, + 13 => 30, + 14 => 30, + 15 => 30, + 16 => 60, + 17 => 60, + 18 => 60, + 19 => 60, + 20 => 60, + 21 => 60, + ]; - if($inf['clan']>0) - { - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="'.$inf['clan'].'" LIMIT 1')); - if(isset($pc['id'])) - { - $pc['img'] = $pc['name_mini'].'.gif'; - if($inf['clan_prava']=='glava') - { - $inf['mod_zvanie'] = '- Глава клана'; - }elseif($inf['mod_zvanie']!='') - { - $inf['mod_zvanie'] = '- '.htmlspecialchars($inf['mod_zvanie'],NULL,'cp1251'); - $inf['mod_zvanie'] = str_replace('<b>','',$inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</b>','',$inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('<u>','',$inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</u>','',$inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('<i>','',$inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</i>','',$inf['mod_zvanie']); + ?> + + 0) { + if ($inf['battle'] > 0) { + $btl3 = mysql_fetch_array( + mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $inf['battle'] . '') + ); + if (isset($btl3['id']) && $btl3['time_over'] == 0) { + echo '

    Персонаж сейчас в поединке
    '; + } + } + } elseif ($inf['room'] != 303) { + echo '
    '; + + + if ($inf['online'] > time( + ) - 520 && $inf['banned'] == 0 && $inf['invis'] != 1 && $inf['invis'] < time()) { + echo 'Персонаж сейчас находится в клубе.
    "' . $room['name'] . '"'; + } else { + if ($inf['admin'] == 0 || $inf['admin'] == 2) { + if ($inf['online'] == 0) { + $inf['online'] = $inf['timeREG']; + } + echo 'Персонаж не в клубе'; + if (date('Y', $inf['online']) == date('Y')) { + echo ', но был тут:
    ' . date( + 'd.m.Y H:i', $inf['online'] + ) . ''; + $out = ''; + $time_still = time() - $inf['online']; + $tmp = floor($time_still / 2592000); + $id = 0; + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мес. "; + } + $time_still = $time_still - $tmp * 2592000; } - echo 'Клан: '.$pc['name'].' '.$inf['mod_zvanie'].'
    '; + $tmp = floor($time_still / 604800); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " нед. "; + } + $time_still = $time_still - $tmp * 604800; + } + $tmp = floor($time_still / 86400); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " дн. "; + } + $time_still = $time_still - $tmp * 86400; + } + $tmp = floor($time_still / 3600); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " ч. "; + } + $time_still = $time_still - $tmp * 3600; + } + $tmp = floor($time_still / 60); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мин. "; + } + } + if ($out == '') { + $out = $time_still . ' сек.'; + } + echo '
    (' . $out . ' назад)'; } + } elseif ($inf['admin'] > 0) { + echo 'Персонаж не в клубе.'; } - - if( $inf['admin'] == 0 && ( ($inf['align'] > 1 && $inf['align'] < 2) || ($inf['align'] > 3 && $inf['align'] < 4) ) ) { - echo 'Орден Модераторов
    '; - } - ?> - - '.$u->city_name[$inf['city2']].'
    '; } ?> - День рождения персонажа:
    - time() && true == false ) { ?> - Персонаж чист перед законом: до
    - Администратор
    '; - } - if($inf['redirect'] != '0' && ($u->info['admin'] > 0 || $u->info['id'] == $inf['id'])) { - echo 'Редирект: '.htmlspecialchars($inf['redirect']).'
    '; - } - if( $u->info['admin'] > 0 ) { - echo '
    Цена комплекта: '.(0+$st['prckr']).' кр.
    '; - echo 'Цена комплекта: '.(0+$st['preckr']).' eкр.
    '; - echo 'Уровень покупателя: '.(0+$st['pbe']).'
    '; - } - ?> - '.$pl['login'].' ['.$pl['level'].']'; - }else{ - $twk .= ''.$pl['login'].' ['.$pl['level'].']'; - } - } - } - if( $twk != '' ) { - echo 'Другие образы: '.$twk.'
    '; - } - ?> - 0 LIMIT 1')); - if ($pk[0]>0) - { - echo 'Персонаж покупал еврокредиты на сумму : '.$pk[0].' ЕКР
    '; - } - //История имен - $names = ''; - $sp = mysql_query('SELECT * FROM `lastnames` WHERE `uid` = "'.$inf['id'].'" ORDER BY `time` DESC'); - $i = 0; - while($pl = mysql_fetch_array($sp)) - { - if($i>0) - { - $names .= '                      '; + } + if ($inf['inUser'] > 0 and $inf['id'] != 12059) { + echo '
    Персонаж вселился в бота'; + } + if ($inf['battle'] > 0) { + $btl3 = mysql_fetch_array( + mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $inf['battle'] . '') + ); + if (isset($btl3['id']) && $btl3['time_over'] == 0) { + echo '
    Персонаж сейчас в поединке'; + } + } + echo '
    '; + } else { + if ($inf['res_x'] - time() > 0) { + echo '
    Появится через ' . ($u->timeOut( + ($inf['res_x'] - time()) + )) . '
    '; + } else { + echo '
    Появится в ближайшее время...
    '; + } + } + //Эффект админ + if ($u->info['admin'] > 0) { + + if (isset($_GET['cancel_eff'])) { + mysql_query( + 'UPDATE `eff_users` SET `delete` = "' . time( + ) . '" WHERE `id` = "' . mysql_real_escape_string( + (int)$_GET['cancel_eff'] + ) . '" AND `uid` = "' . $inf['id'] . '" LIMIT 1' + ); + die(''); + } + + function eff_adm($pl) + { + global $u; + $r = ''; + if ($pl['v1'] != 'priem') { + $eff = mysql_fetch_array( + mysql_query( + 'SELECT `id2`,`img`,`actionTime` FROM `eff_main` WHERE `id2` = "' . $pl['id_eff'] . '" LIMIT 1' + ) + ); + $pl['img2'] = $eff['img']; + $pl['name'] .= "\r" . 'Действует еще ' . $u->timeOut( + $pl['timeUse'] - time() + $eff['actionTime'] + ) . ''; + } + $r .= ''; + return $r; + } + + $eff_adm = ''; + $sp = mysql_query( + 'SELECT `id_eff`,`uid`,`id`,`name`,`img2`,`v1`,`v2`,`timeUse` FROM `eff_users` WHERE `uid` = "' . $inf['id'] . '" AND `delete` = "0"' + ); + while ($pl = mysql_fetch_array($sp)) { + $eff_adm .= eff_adm($pl); + } + if ($eff_adm != '') { + echo '
    Эффекты на персонаже:
    ' . $eff_adm . '
    '; + } + } + if ($u->info['admin'] > 0) { + ?> +
    + + +
    +
    Показать + модификаторы
    +
    + +
    + + - -
    info['admin'] > 0) { + $nodell = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . $inf['login'] . '" ORDER BY `id` ASC LIMIT 1' + ) + ); + $sp = mysql_query( + 'SELECT `id`,`level`,`inTurnir`,`room`,`battle`,`inTurnirnew`,`inUser` FROM `users` WHERE `login` = "' . $inf['login'] . '" AND `id` != "' . $inf['id'] . '"' + ); + while ($pl = mysql_fetch_array($sp)) { + if (isset($_GET['del_copy']) && $_GET['del_copy'] == $pl['id']) { + if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { + mysql_query( + 'UPDATE `users` SET `login` = "DELETE" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } + } else { + $nolog .= '
    ' . $u->microLogin($pl['id'], 1); + if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { + $nolog .= ' (персонажа можно удалить)'; + } + if ($pl['id'] == $nodell['id']) { + $nolog .= ' (основной персонаж)'; + } + $nolog .= '
    '; + } + } + if ($nolog != '') { + $nolog = 'Копии персонажа:' . $nolog . ''; + echo $nolog; + } + } - $algnt = mysql_fetch_array(mysql_query('SELECT * FROM `users_align` WHERE `uid` = "'.$inf['id'].'" AND (`delete` = 0 OR `delete` > "'.time().'") LIMIT 1')); - if(isset($algnt['id'])) { - if($algnt['align'] == 1) { - echo '
    Выбранная сторона: Свет'; - if( $algnt['delete'] > 0 ) { - echo ' (до '.date('d.m.Y H:i',$algnt['delete']).')'; - } - echo '
    '; - }elseif($algnt['align'] == 3) { - echo '
    Выбранная сторона: Тьма'; - if( $algnt['delete'] > 0 ) { - echo ' (до '.date('d.m.Y H:i',$algnt['delete']).')'; - } - echo '
    '; - }elseif($algnt['align'] == 7) { - echo '
    Выбранная сторона: Нейтрал'; - if( $algnt['delete'] > 0 ) { - echo ' (до '.date('d.m.Y H:i',$algnt['delete']).')'; - } - echo '
    '; - } - } - if( $st['silver'] > 0 ) { - echo '
    '; - echo 'Благословление Ангелов: '; - echo '
    '; - } - - if($inf['win_t'] > 0) { ?> -
    - Побед в турнирах:
    - Поражений в турнирах:
    - - - - info['align'] == 50 ) { - $bnk = ''; $bmn1 = 0; $bmn2 = 0; - $sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$inf['id'].'"'); - while($pl = mysql_fetch_array($sp)) { - if($pl['useNow'] > 0) { - $bnk .= '
    '; - }else{ - $bnk .= '
    '; - } - $bnk .= '  • '.$pl['id'].''; - $bnk .= '
    '; - } - if($bnk != '') { - echo '
    Банковские счета:  '.$bnk.'
    '; - } - echo '
    '; - } - ?> -
    -
    - - - '; - } - } - - $sp = mysql_query('SELECT * FROM `users_ico` WHERE `uid` = "'.$inf['id'].'" AND (`endTime` = 0 OR `endTime` > '.time().') LIMIT 100'); - while($pl = mysql_fetch_array($sp)) - { - $stlico = ''; - - if( $pl['type'] == 2 ) { - $stlico .= 'width:37px;height:37xp;padding:2px;'; - } - - if($stlico != '') { - $stlico = 'style="'.$stlico.'"'; - } - $icon = ' '; - - if( $pl['href'] != '#' && $pl['href'] != '' ) { - $ico[$pl['type']] .= ''.$icon.''; - }else{ - $ico[$pl['type']] .= $icon; - } - } - unset($icon); - - - if($inf['vip']==1) { - $ico[1] .= ' '; - } - - //сильвер - if($st['silver']>0) { - $ico[1] .= ' '; - } +
    Сила:
    + Ловкость:
    + Интуиция:
    + Выносливость:
    + 3 || $st['s5'] != 0) { ?> + Интеллект:
    + 6 || $st['s6'] != 0) { ?> + Мудрость:
    + 9 || $st['s7'] != 0) { ?> + Духовность:
    + 11 || $st['s8'] != 0) { ?>Воля:
    + 14 || $st['s9'] != 0) { ?>Свобода + духа:
    + 19 || $st['s10'] != 0) { ?> + Божественность:
    + 0) { ?> + Энергия:
    + + Рейтинг сегодня:
    +
    +
    +
    + info['admin'] > 0) { + echo 'Уровень:'; + } else { + echo 'Уровень:'; + } ?>
    + + Побед: ' . number_format( + $inf['win'], 0, ",", " " + ) . ''; + } ?>
    + Поражений:
    + Ничьих:
    + - $irep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "'.$inf['id'].'" LIMIT 1')); - if(isset($irep['id'])) - { - //Водосток - if($irep['repdreamscity']>9999) - { - $ico[1] .= ''; - }elseif($irep['repdreamscity']>4999) - { - $ico[1] .= ''; - } - elseif($irep['repdreamscity']>999) - { - $ico[1] .= ''; - } - - //Храм знаний - if($irep['rep1']>9999) - { - $ico[1] .= ''; - }elseif($irep['rep1']>999) - { - $ico[1] .= ''; - }elseif($irep['rep1']>99) - { - $ico[1] .= ''; - } - - //Алтарь крови - if($irep['rep2']>99) - { - $ico[1] .= ''; - } - - //Излом хаоса - if($irep['repizlom']>24999) - { - $ico[1] .= ''; - }elseif($irep['repizlom']>9999) - { - $ico[1] .= ''; - }elseif($irep['repizlom']>999) - { - $ico[1] .= ''; - }elseif($irep['repizlom']>99) - { - $ico[1] .= ''; - } - - - //capitalcity - if($irep['repcapitalcity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repcapitalcity']>9999) - { - $ico[1] .= ''; - } - - //angelscity - if($irep['repangelscity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repangelscity']>9999) - { - $ico[1] .= ''; - } - - //demonscity - if($irep['repdemonscity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repdemonscity']>9999) - { - $ico[1] .= ''; - } - - //devilscity - if($irep['repdevilscity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repdevilscity']>9999) - { - $ico[1] .= ''; - } - - //suncity - if($irep['repsuncity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repsuncity']>9999) - { - $ico[1] .= ''; - } - //Гора легиона (сука как она меня заебала) by R - if($irep['repabandonedplain']>9999) - { - $ico[1] .= ''; - }elseif($irep['repabandonedplain']>999) - { - $ico[1] .= ''; - } - - //emeraldscity - if($irep['repemeraldscity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repemeraldscity']>9999) - { - $ico[1] .= ''; - } - - //sandcity - if($irep['repsandcity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repsandcity']>9999) - { - $ico[1] .= ''; - } - - //mooncity - if($irep['repmooncity']>24999) - { - $ico[1] .= ''; - }elseif($irep['repmooncity']>9999) - { - $ico[1] .= ''; - } - if($inf['referals'] >= 3000) // значок за рефов - { - $ico[1] .= ''; - }elseif($inf['referals'] > 1500) - { - $ico[1] .= ''; - }elseif($inf['referals'] > 600) - { - $ico[1] .= ''; - } - } + Орден Алхимиков'; + if ($inf['mod_zvanie'] != '') { + echo ' - ' . $inf['mod_zvanie']; + } + echo '
    '; + } ?> + Орден Рекламного Развития'; + if ($inf['mod_zvanie'] != '') { + echo ' - ' . $inf['mod_zvanie']; + } + echo '
    '; + } ?> + '; - foreach ($ai->getTypes() as $type) { - $tmp_1 = $ai->getInfo($inf['id']); - if (!empty($tmp_1[$type])) { - $ico[3].= '
    '.$tmp_1['name'.$type].'
    Ранг '.$tmp_1['klas'.$type].' :
    '.$tmp_1['name'.$type].'
    '; - } - } + if ($inf['clan'] > 0) { + $pc = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `clan` WHERE `id`="' . $inf['clan'] . '" LIMIT 1' + ) + ); + if (isset($pc['id'])) { + $pc['img'] = $pc['name_mini'] . '.gif'; + if ($inf['clan_prava'] == 'glava') { + $inf['mod_zvanie'] = '- Глава клана'; + } elseif ($inf['mod_zvanie'] != '') { + $inf['mod_zvanie'] = '- ' . htmlspecialchars( + $inf['mod_zvanie'], null, 'cp1251' + ); + $inf['mod_zvanie'] = str_replace( + '<b>', '', $inf['mod_zvanie'] + ); + $inf['mod_zvanie'] = str_replace( + '</b>', '', $inf['mod_zvanie'] + ); + $inf['mod_zvanie'] = str_replace( + '<u>', '', $inf['mod_zvanie'] + ); + $inf['mod_zvanie'] = str_replace( + '</u>', '', $inf['mod_zvanie'] + ); + $inf['mod_zvanie'] = str_replace( + '<i>', '', $inf['mod_zvanie'] + ); + $inf['mod_zvanie'] = str_replace( + '</i>', '', $inf['mod_zvanie'] + ); + } + echo 'Клан: ' . $pc['name'] . ' ' . $inf['mod_zvanie'] . '
    '; + } + } - if ($inf['id'] == 26212831) { - $ico[3].= '
    Запретное знание
    Ранг 4 :
    Запретное знание
    '; - } + if ($inf['admin'] == 0 && (($inf['align'] > 1 && $inf['align'] < 2) || ($inf['align'] > 3 && $inf['align'] < 4))) { + echo 'Орден Модераторов
    '; + } + ?> + + ' . $u->city_name[$inf['city2']] . '
    '; + } ?> + День рождения персонажа:
    + time()) { ?> + Персонаж чист перед законом: до +
    + Администратор
    '; + } + if ($inf['redirect'] != '0' && ($u->info['admin'] > 0 || $u->info['id'] == $inf['id'])) { + echo 'Редирект: ' . htmlspecialchars($inf['redirect']) . '
    '; + } + if ($u->info['admin'] > 0) { + echo '
    Цена комплекта: ' . (0 + $st['prckr']) . ' кр.
    '; + echo 'Цена комплекта: ' . (0 + $st['preckr']) . ' eкр.
    '; + echo 'Уровень покупателя: ' . (0 + $st['pbe']) . '
    '; + } + ?> + ' . $pl['login'] . ' [' . $pl['level'] . ']'; + } else { + $twk .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; + } + } + } + if ($twk != '') { + echo 'Другие образы: ' . $twk . '
    '; + } + ?> + 0) { + $names .= '                      '; + } + $names .= '\'' . $pl['login'] . '\' до ' . date( + 'd.m.Y H:i', $pl['time'] + ) . '
    '; + $i++; + } + if ($names != '') { + echo 'История имен: ' . $names . ''; + } + $algnt = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `users_align` WHERE `uid` = "' . $inf['id'] . '" AND (`delete` = 0 OR `delete` > "' . time( + ) . '") LIMIT 1' + ) + ); + if (isset($algnt['id'])) { + if ($algnt['align'] == 1) { + echo '
    Выбранная сторона: Свет'; + if ($algnt['delete'] > 0) { + echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; + } + echo '
    '; + } elseif ($algnt['align'] == 3) { + echo '
    Выбранная сторона: Тьма'; + if ($algnt['delete'] > 0) { + echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; + } + echo '
    '; + } elseif ($algnt['align'] == 7) { + echo '
    Выбранная сторона: Нейтрал'; + if ($algnt['delete'] > 0) { + echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; + } + echo '
    '; + } + } + if ($st['silver'] > 0) { + echo '
    '; + echo 'Благословление Ангелов: '; + echo '
    '; + } - $ico[3].='
    '; - } - + if ($inf['win_t'] > 0) { + ?> +
    + Побед в турнирах: +
    + Поражений в турнирах:
    + + + info['align'] == 50) { + $bnk = ''; + $bmn1 = 0; + $bmn2 = 0; + $sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "' . $inf['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['useNow'] > 0) { + $bnk .= '
    '; + } else { + $bnk .= '
    '; + } + $bnk .= '  • ' . $pl['id'] . ''; + $bnk .= '
    '; + } + if ($bnk != '') { + echo '
    Банковские счета:  ' . $bnk . '
    '; + } + echo '
    '; + } + ?> +
    +
    + + + 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/604800); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - } - return $out; - } - - if( $ico[1] != '' ) { - echo $ico[1]; - } - - echo ''; - if($inf['jail']>time()) - { - echo '
    Персонаж находится в заточении еще '.timeOut($inf['jail']-time()).' '; - } - if(isset($st['puti'])) - { - echo '
    Персонаж не может передвигаться еще '.timeOut($st['puti']-time()).' '; - } - if($inf['molch1']>time()) - { - echo '
    На персонажа наложено заклятие молчания. Будет молчать еще '.timeOut($inf['molch1']-time()).' '; - } - if($inf['molch2']>time()) - { - echo '
    На персонажа наложено заклятие молчания на форуме. Будет молчать еще '.timeOut($inf['molch2']-time()).' '; - } - if($inf['clan_delay']>time()) - { - echo '
    У персонажа запрет на вступление в кланы ещё: '.timeOut($inf['clan_delay']-time()).' '; - } - if($inf['info_delete'] > time() || $inf['info_delete'] == 1) - { - echo '
    На персонажа наложено заклятие обезличивания.'; - if( $inf['info_delete'] > 1 ) { - echo ' Будет обезличен еще '.timeOut($inf['info_delete']-time()).''; - } - } + $ico = []; - //Если у персонажа есть травмы, физ. и маг. травмы - $sp = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$inf['id'].'" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6'); - while($pl = mysql_fetch_array($sp)) - { - echo '
    У персонажа - "'.$pl['name'].'" еще '.$u->timeOut($pl['timeUse']-time()+$pl['timeAce']); - } - - //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек. - if($inf['level']>=4) - { - $nn = 0; - while($nn Персонаж ослаблен из-за смерти в бою, еще '.timeOut($st['effects'][$nn]['timeUse']+$st['effects'][$nn]['timeAce']+$osl['actionTime']-time()).' '; - $nn = count($st['effects'])+1; - } - $nn++; - } - } - - echo '
    '; + if ($inf['marry'] != 0) { + $marry = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login` FROM `users` WHERE `id` = "' . $inf['marry'] . '" LIMIT 1' + ) + ); + if (isset($marry['id'])) { + $mrtxt = ''; + if ($inf['sex'] == 0) { + $mrtxt = 'Женат на'; + } else { + $mrtxt = 'Замужем за'; + } + $ico[1] .= ''; + } + } - if( $ico[3] != '' ) { - echo '
    Достижения персонажа:
    '.$ico[3].'
    '; - } + $sp = mysql_query( + 'SELECT * FROM `users_ico` WHERE `uid` = "' . $inf['id'] . '" AND (`endTime` = 0 OR `endTime` > ' . time( + ) . ') LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $stlico = ''; - unset($ico); - - if(($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) || $inf['banned']>0 || $inf['jail']>time()) - { - $to = ''; - if($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) - { - $to = 'хаос'; - } - if($inf['banned']>0) - { - if($to='') - { - $to = 'блок'; - }else{ - $to = $to.'/блок'; - } - } - $fm = mysql_fetch_array(mysql_query('SELECT `id`,`hb`,`text` FROM `users_delo` WHERE `uid` = "'.$inf['id'].'" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1')); - echo '
    '; - if(isset($fm['id'])) - { - $from = 'паладинов'; - if($fm['hb']==2) - { - $from = 'Ангелов'; - }elseif($fm['hb']==3) - { - $from = 'тарманов'; - } - echo 'Сообщение от модераторов:
    '; - echo ''.$fm['text'].'
    '; - } - if($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1)) - { - if($inf['haos']==1) - { - echo 'Хаос бессрочно.'; - }else{ - echo 'Хаос еще '.timeOut($inf['haos']-time()).''; - } - } - echo '
    '; - } - - //подарки - if(($inf['info_delete']info['align']>1 && $u->info['align']<2 || $u->info['align']>3 && $u->info['align']<4 || $u->info['admin']>0 || $u->info['nadmin']>0)){ - $gs = array('','',''); $glim = 1000; $i = 0; - $ij1 = 1; - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "38" OR `im`.`type` = "64" OR `iu`.`data` LIKE "%|giftsee=1%") AND `iu`.`uid` = "'.$inf['id'].'" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT '.$glim); - while($pl = mysql_fetch_array($sp)) - { - if(stristr($pl['data'], 'gift_id')) { - $po = $u->lookStats($pl['data']); - $pl_gift = $po['gift_id']; - if( $pl_gift > 0 ) { - $pl_gift = mysql_fetch_array(mysql_query('SELECT `name`,`img`,`id` FROM `users_gifts` WHERE `id` = "'.mysql_real_escape_string($pl_gift).'" LIMIT 1')); - if( isset($pl_gift['id']) ) { - //Именной подарок - $pl['name'] = $pl_gift['name']; - $pl['img'] = $pl_gift['img']; - } - } - } - //подарки - if( $pl['gift'] == 1 ) { - $pl['gift2'] = 'Невидимка'; - }else{ - $pl['gift2'] = $pl['gift']; - } - $gs[0] .= ''; - $ij1++; - } - $ij2 = 1; - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "63" OR `im`.`type` = "37" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "'.$inf['id'].'" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT '.$glim); - while($pl = mysql_fetch_array($sp)) - { - //if($pl['type'] == 63 || $pl['type'] == 37) { - //открытки - if( $pl['gift'] == 1 ) { - $pl['gift2'] = 'Невидимка'; - }else{ - $pl['gift2'] = $pl['gift']; - } - $gs[1] .= ''; - //} - $ij2++; - } - $ij3 = 1; - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `im`.`type` = 28 AND `iu`.`uid` = "'.$inf['id'].'" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT '.$glim); - while($pl = mysql_fetch_array($sp)) - { - if($pl['type'] == 28) { - //Букеты - if( $pl['gift'] == 1 ) { - $pl['gift2'] = 'Невидимка'; - }else{ - $pl['gift2'] = $pl['gift']; - } - $gs[2] .= ''; - } - $ij3++; - } - - if($gs[0]!='' || $gs[1]!='' || $gs[2]!=''){ - if($gs[2] != '') { - $gs[2] = '
    Букеты:

    '.$gs[2].'
    '.$gs[2].'
    Подарки:

    '.$gs[0].'
    '.$gs[1].'
    '; - $ij4 = mysql_fetch_array(mysql_query('SELECT COUNT(`iu`.`id`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = 28 OR `im`.`type` = 63 OR `im`.`type` = 38 OR `im`.`type` = 64 OR `im`.`type` = 37 OR `iu`.`data` LIKE "%|giftsee=1%" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "'.$inf['id'].'" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" LIMIT 1')); - $ij4 = $ij4[0]; - if($ij1+$ij2+$ij3 < $ij4) { - if(!isset($_GET['maxgift'])){ - echo 'Нажмите сюда, чтобы увидеть все подарки...'; - }else{ - echo 'Нажмите сюда, чтобы скрыть подарки'; - } - } - } - - } - if( $inf['no_ip'] == 'trupojor' && $u->info['admin'] > 0 ) { - if( isset($_GET['emonster']) ) { - - $monster = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "'.mysql_real_escape_string($inf['id']).'" LIMIT 1')); - - if(isset($_POST['bot_sroom'])) { - $monster['start_room'] = (int)$_POST['bot_sroom']; - - $monster['start_day'] = (int)$_POST['bot_sday']; - $monster['start_dd'] = (int)$_POST['bot_sdd']; - $monster['start_mm'] = (int)$_POST['bot_smm']; - $monster['start_hh'] = (int)$_POST['bot_shh']; - $monster['start_min'] = (int)$_POST['bot_smin']; - - $monster['back_day'] = (int)$_POST['bot_bday']; - $monster['back_dd'] = (int)$_POST['bot_bdd']; - $monster['back_mm'] = (int)$_POST['bot_bmm']; - $monster['back_hh'] = (int)$_POST['bot_bhh']; - $monster['back_min'] = (int)$_POST['bot_bmin']; - - $monster['start_text'] = $_POST['bot_stext']; - $monster['back_text'] = $_POST['bot_btext']; - $monster['win_text'] = $_POST['bot_wintext']; - $monster['lose_text'] = $_POST['bot_losetext']; - $monster['nich_text'] = $_POST['bot_nichtext']; - - $monster['win_back'] = $_POST['bot_winback']; - $monster['time_restart'] = $_POST['bot_trs']; - - $monster['win_itm'] = $_POST['bot_winitm']; - $monster['win_money1'] = $_POST['bot_winmoney1']; - $monster['win_money2'] = $_POST['bot_winmoney2']; - $monster['win_exp'] = $_POST['bot_winexp']; - $monster['win_eff'] = $_POST['bot_wineff']; - $monster['win_ico'] = $_POST['bot_winico']; - - $monster['lose_itm'] = $_POST['bot_loseitm']; - $monster['lose_money1'] = $_POST['bot_losemoney1']; - $monster['lose_money2'] = $_POST['bot_losemoney2']; - $monster['lose_exp'] = $_POST['bot_loseexp']; - $monster['lose_eff'] = $_POST['bot_loseeff']; - $monster['lose_ico'] = $_POST['bot_loseico']; - - if( !isset($monster['id']) ) { - mysql_query('INSERT INTO `aaa_monsters` ( + if ($pl['type'] == 2) { + $stlico .= 'width:37px;height:37xp;padding:2px;'; + } + + if ($stlico != '') { + $stlico = 'style="' . $stlico . '"'; + } + $icon = ' '; + + if ($pl['href'] != '#' && $pl['href'] != '') { + $ico[$pl['type']] .= '' . $icon . ''; + } else { + $ico[$pl['type']] .= $icon; + } + } + unset($icon); + + + if ($inf['vip'] == 1) { + $ico[1] .= ' '; + } + + //сильвер + if ($st['silver'] > 0) { + $ico[1] .= ' '; + } + + $irep = mysql_fetch_array( + mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $inf['id'] . '" LIMIT 1') + ); + if (isset($irep['id'])) { + //Водосток + if ($irep['repdreamscity'] > 9999) { + $ico[1] .= ''; + } elseif ($irep['repdreamscity'] > 4999) { + $ico[1] .= ''; + } elseif ($irep['repdreamscity'] > 999) { + $ico[1] .= ''; + } + + //Храм знаний + if ($irep['rep1'] > 9999) { + $ico[1] .= ''; + } elseif ($irep['rep1'] > 999) { + $ico[1] .= ''; + } elseif ($irep['rep1'] > 99) { + $ico[1] .= ''; + } + + //Алтарь крови + if ($irep['rep2'] > 99) { + $ico[1] .= ''; + } + + //Излом хаоса + if ($irep['repizlom'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repizlom'] > 9999) { + $ico[1] .= ''; + } elseif ($irep['repizlom'] > 999) { + $ico[1] .= ''; + } elseif ($irep['repizlom'] > 99) { + $ico[1] .= ''; + } + + + //capitalcity + if ($irep['repcapitalcity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repcapitalcity'] > 9999) { + $ico[1] .= ''; + } + + //angelscity + if ($irep['repangelscity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repangelscity'] > 9999) { + $ico[1] .= ''; + } + + //demonscity + if ($irep['repdemonscity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repdemonscity'] > 9999) { + $ico[1] .= ''; + } + + //devilscity + if ($irep['repdevilscity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repdevilscity'] > 9999) { + $ico[1] .= ''; + } + + //suncity + if ($irep['repsuncity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repsuncity'] > 9999) { + $ico[1] .= ''; + } + //Гора легиона (сука как она меня заебала) by R + if ($irep['repabandonedplain'] > 9999) { + $ico[1] .= ''; + } elseif ($irep['repabandonedplain'] > 999) { + $ico[1] .= ''; + } + + //emeraldscity + if ($irep['repemeraldscity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repemeraldscity'] > 9999) { + $ico[1] .= ''; + } + + //sandcity + if ($irep['repsandcity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repsandcity'] > 9999) { + $ico[1] .= ''; + } + + //mooncity + if ($irep['repmooncity'] > 24999) { + $ico[1] .= ''; + } elseif ($irep['repmooncity'] > 9999) { + $ico[1] .= ''; + } + if ($inf['referals'] >= 3000) // значок за рефов + { + $ico[1] .= ''; + } elseif ($inf['referals'] > 1500) { + $ico[1] .= ''; + } elseif ($inf['referals'] > 600) { + $ico[1] .= ''; + } + } + + if ($inf['banned'] == 0) { + $ai = new \Insallah\Achievements($u); + $ico[3] .= '
    '; + + foreach ($ai->getTypes() as $type) { + $tmp_1 = $ai->getInfo($inf['id']); + if (!empty($tmp_1[$type])) { + $ico[3] .= '
    ' . $tmp_1['name' . $type] . '
    Ранг ' . $tmp_1['klas' . $type] . ' :
    ' . $tmp_1['name' . $type] . '
    '; + } + } + + $ico[3] .= '
    '; + } + + + function timeOut($ttm, $travm = false) + { + if ($travm == false) { + $out = ''; + $time_still = $ttm; + $tmp = floor($time_still / 2592000); + $id = 0; + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мес. "; + } + $time_still = $time_still - $tmp * 2592000; + } + $tmp = floor($time_still / 604800); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " нед. "; + } + $time_still = $time_still - $tmp * 604800; + } + $tmp = floor($time_still / 86400); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " дн. "; + } + $time_still = $time_still - $tmp * 86400; + } + $tmp = floor($time_still / 3600); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " ч. "; + } + $time_still = $time_still - $tmp * 3600; + } + $tmp = floor($time_still / 60); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мин. "; + } + } + if ($out == '') { + if ($time_still < 0) { + $time_still = 0; + } + $out = $time_still . ' сек.'; + } + } + return $out; + } + + if ($ico[1] != '') { + echo $ico[1]; + } + + echo ''; + if ($inf['jail'] > time()) { + echo '
    Персонаж находится в заточении еще ' . timeOut( + $inf['jail'] - time() + ) . ' '; + } + if (isset($st['puti'])) { + echo '
    Персонаж не может передвигаться еще ' . timeOut( + $st['puti'] - time() + ) . ' '; + } + if ($inf['molch1'] > time()) { + echo '
    На персонажа наложено заклятие молчания. Будет молчать еще ' . timeOut( + $inf['molch1'] - time() + ) . ' '; + } + if ($inf['molch2'] > time()) { + echo '
    На персонажа наложено заклятие молчания на форуме. Будет молчать еще ' . timeOut( + $inf['molch2'] - time() + ) . ' '; + } + if ($inf['clan_delay'] > time()) { + echo '
    У персонажа запрет на вступление в кланы ещё: ' . timeOut( + $inf['clan_delay'] - time() + ) . ' '; + } + if ($inf['info_delete'] > time() || $inf['info_delete'] == 1) { + echo '
    На персонажа наложено заклятие обезличивания.'; + if ($inf['info_delete'] > 1) { + echo ' Будет обезличен еще ' . timeOut($inf['info_delete'] - time()) . ''; + } + } + + //Если у персонажа есть травмы, физ. и маг. травмы + $sp = mysql_query( + 'SELECT * FROM `eff_users` WHERE `uid` = "' . $inf['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6' + ); + while ($pl = mysql_fetch_array($sp)) { + echo '
    У персонажа - "' . $pl['name'] . '" еще ' . $u->timeOut( + $pl['timeUse'] - time() + $pl['timeAce'] + ); + } + + //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек. + if ($inf['level'] >= 4) { + $nn = 0; + while ($nn < count($st['effects'])) { + if ($st['effects'][$nn]['id_eff'] == 5) { + + $osl = mysql_fetch_array( + mysql_query( + 'SELECT `id2`,`actionTime` FROM `eff_main` WHERE `id2` = "5" LIMIT 1' + ) + ); + echo '
    Персонаж ослаблен из-за смерти в бою, еще ' . timeOut( + $st['effects'][$nn]['timeUse'] + $st['effects'][$nn]['timeAce'] + $osl['actionTime'] - time( + ) + ) . ' '; + $nn = count($st['effects']) + 1; + } + $nn++; + } + } + + echo '
    '; + + if ($ico[3] != '') { + echo '
    Достижения персонажа:
    ' . $ico[3] . '
    '; + } + + unset($ico); + + if ( + ( + $inf['align'] >= 2 && + $inf['align'] < 3 && + ( + $inf['haos'] > time() || + $inf['haos'] == 1 + ) + ) || + $inf['banned'] > 0 || + $inf['jail'] > time()) { + $to = ''; + if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time( + ) || $inf['haos'] == 1)) { + $to = 'хаос'; + } + if ($inf['banned'] > 0) { + if ($to = '') { + $to = 'блок'; + } else { + $to = $to . '/блок'; + } + } + $fm = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`hb`,`text` FROM `users_delo` WHERE `uid` = "' . $inf['id'] . '" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1' + ) + ); + echo '
    '; + if (isset($fm['id'])) { + $from = 'паладинов'; + if ($fm['hb'] == 2) { + $from = 'Ангелов'; + } elseif ($fm['hb'] == 3) { + $from = 'тарманов'; + } + echo 'Сообщение от модераторов:
    '; + echo '' . $fm['text'] . '
    '; + } + if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time( + ) || $inf['haos'] == 1)) { + if ($inf['haos'] == 1) { + echo 'Хаос бессрочно.'; + } else { + echo 'Хаос еще ' . timeOut($inf['haos'] - time()) . ''; + } + } + echo '
    '; + } + + //подарки + if (($inf['info_delete'] < time( + ) && $inf['info_delete'] != 1) || ($u->info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0 || $u->info['nadmin'] > 0)) { + $gs = ['', '', '']; + $glim = 1000; + $i = 0; + $ij1 = 1; + $sp = mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "38" OR `im`.`type` = "64" OR `iu`.`data` LIKE "%|giftsee=1%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim + ); + while ($pl = mysql_fetch_array($sp)) { + if (stristr($pl['data'], 'gift_id')) { + $po = $u->lookStats($pl['data']); + $pl_gift = $po['gift_id']; + if ($pl_gift > 0) { + $pl_gift = mysql_fetch_array( + mysql_query( + 'SELECT `name`,`img`,`id` FROM `users_gifts` WHERE `id` = "' . mysql_real_escape_string( + $pl_gift + ) . '" LIMIT 1' + ) + ); + if (isset($pl_gift['id'])) { + //Именной подарок + $pl['name'] = $pl_gift['name']; + $pl['img'] = $pl_gift['img']; + } + } + } + //подарки + if ($pl['gift'] == 1) { + $pl['gift2'] = 'Невидимка'; + } else { + $pl['gift2'] = $pl['gift']; + } + $gs[0] .= ''; + $ij1++; + } + $ij2 = 1; + $sp = mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "63" OR `im`.`type` = "37" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim + ); + while ($pl = mysql_fetch_array($sp)) { + //if($pl['type'] == 63 || $pl['type'] == 37) { + //открытки + if ($pl['gift'] == 1) { + $pl['gift2'] = 'Невидимка'; + } else { + $pl['gift2'] = $pl['gift']; + } + $gs[1] .= ''; + //} + $ij2++; + } + $ij3 = 1; + $sp = mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `im`.`type` = 28 AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim + ); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['type'] == 28) { + //Букеты + if ($pl['gift'] == 1) { + $pl['gift2'] = 'Невидимка'; + } else { + $pl['gift2'] = $pl['gift']; + } + $gs[2] .= ''; + } + $ij3++; + } + + if ($gs[0] != '' || $gs[1] != '' || $gs[2] != '') { + if ($gs[2] != '') { + $gs[2] = '
    Букеты:

    ' . $gs[2] . '
    ' . $gs[2] . '
    Подарки:

    ' . $gs[0] . '
    ' . $gs[1] . '
    '; + $ij4 = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`iu`.`id`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = 28 OR `im`.`type` = 63 OR `im`.`type` = 38 OR `im`.`type` = 64 OR `im`.`type` = 37 OR `iu`.`data` LIKE "%|giftsee=1%" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' + ) + ); + $ij4 = $ij4[0]; + if ($ij1 + $ij2 + $ij3 < $ij4) { + if (!isset($_GET['maxgift'])) { + echo 'Нажмите сюда, чтобы увидеть все подарки...'; + } else { + echo 'Нажмите сюда, чтобы скрыть подарки'; + } + } + } + + } + if ($inf['no_ip'] == 'trupojor' && $u->info['admin'] > 0) { + if (isset($_GET['emonster'])) { + + $monster = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `aaa_monsters` WHERE `uid` = "' . mysql_real_escape_string( + $inf['id'] + ) . '" LIMIT 1' + ) + ); + + if (isset($_POST['bot_sroom'])) { + $monster['start_room'] = (int)$_POST['bot_sroom']; + + $monster['start_day'] = (int)$_POST['bot_sday']; + $monster['start_dd'] = (int)$_POST['bot_sdd']; + $monster['start_mm'] = (int)$_POST['bot_smm']; + $monster['start_hh'] = (int)$_POST['bot_shh']; + $monster['start_min'] = (int)$_POST['bot_smin']; + + $monster['back_day'] = (int)$_POST['bot_bday']; + $monster['back_dd'] = (int)$_POST['bot_bdd']; + $monster['back_mm'] = (int)$_POST['bot_bmm']; + $monster['back_hh'] = (int)$_POST['bot_bhh']; + $monster['back_min'] = (int)$_POST['bot_bmin']; + + $monster['start_text'] = $_POST['bot_stext']; + $monster['back_text'] = $_POST['bot_btext']; + $monster['win_text'] = $_POST['bot_wintext']; + $monster['lose_text'] = $_POST['bot_losetext']; + $monster['nich_text'] = $_POST['bot_nichtext']; + + $monster['win_back'] = $_POST['bot_winback']; + $monster['time_restart'] = $_POST['bot_trs']; + + $monster['win_itm'] = $_POST['bot_winitm']; + $monster['win_money1'] = $_POST['bot_winmoney1']; + $monster['win_money2'] = $_POST['bot_winmoney2']; + $monster['win_exp'] = $_POST['bot_winexp']; + $monster['win_eff'] = $_POST['bot_wineff']; + $monster['win_ico'] = $_POST['bot_winico']; + + $monster['lose_itm'] = $_POST['bot_loseitm']; + $monster['lose_money1'] = $_POST['bot_losemoney1']; + $monster['lose_money2'] = $_POST['bot_losemoney2']; + $monster['lose_exp'] = $_POST['bot_loseexp']; + $monster['lose_eff'] = $_POST['bot_loseeff']; + $monster['lose_ico'] = $_POST['bot_loseico']; + + if (!isset($monster['id'])) { + mysql_query( + 'INSERT INTO `aaa_monsters` ( `uid`,`start_room`,`start_day`,`back_day`,`start_dd`,`start_mm`,`start_hh`,`start_min`,`back_min`,`back_dd`,`back_mm`,`back_hh`, `start_text`,`back_text`,`win_text`,`lose_text`,`win_money1`,`win_money2`,`lose_money`,`lose_money2`,`win_exp`,`lose_exp`,`win_itm`, `lose_itm`,`win_eff`,`lose_eff`,`win_ico`,`lose_ico`,`win_back`,`time_restart`,`nich_text` ) VALUES ( - "'.mysql_real_escape_string($inf['id']).'", - "'.mysql_real_escape_string($monster['start_room']).'", - "'.mysql_real_escape_string($monster['start_day']).'", - "'.mysql_real_escape_string($monster['back_day']).'", - "'.mysql_real_escape_string($monster['start_dd']).'", - "'.mysql_real_escape_string($monster['start_mm']).'", - "'.mysql_real_escape_string($monster['start_hh']).'", - "'.mysql_real_escape_string($monster['start_min']).'", - "'.mysql_real_escape_string($monster['back_min']).'", - "'.mysql_real_escape_string($monster['back_dd']).'", - "'.mysql_real_escape_string($monster['back_mm']).'", - "'.mysql_real_escape_string($monster['back_hh']).'", - "'.mysql_real_escape_string($monster['start_text']).'", - "'.mysql_real_escape_string($monster['back_text']).'", - "'.mysql_real_escape_string($monster['win_text']).'", - "'.mysql_real_escape_string($monster['lose_text']).'", - "'.mysql_real_escape_string($monster['win_money1']).'", - "'.mysql_real_escape_string($monster['win_money2']).'", - "'.mysql_real_escape_string($monster['lose_money']).'", - "'.mysql_real_escape_string($monster['lose_money2']).'", - "'.mysql_real_escape_string($monster['win_exp']).'", - "'.mysql_real_escape_string($monster['lose_exp']).'", - "'.mysql_real_escape_string($monster['win_itm']).'", - "'.mysql_real_escape_string($monster['lose_itm']).'", - "'.mysql_real_escape_string($monster['win_eff']).'", - "'.mysql_real_escape_string($monster['lose_eff']).'", - "'.mysql_real_escape_string($monster['win_ico']).'", - "'.mysql_real_escape_string($monster['lose_ico']).'", - "'.mysql_real_escape_string($monster['win_back']).'", - "'.mysql_real_escape_string($monster['time_restart']).'", - "'.mysql_real_escape_string($monster['nich_text']).'" - ) '); - }else{ - mysql_query('UPDATE `aaa_monsters` SET - `uid` = "'.mysql_real_escape_string($inf['id']).'", - `start_room` = "'.mysql_real_escape_string($monster['start_room']).'", - `start_day` = "'.mysql_real_escape_string($monster['start_day']).'", - `back_day` = "'.mysql_real_escape_string($monster['back_day']).'", - `start_dd` = "'.mysql_real_escape_string($monster['start_dd']).'", - `start_mm` = "'.mysql_real_escape_string($monster['start_mm']).'", - `start_hh` = "'.mysql_real_escape_string($monster['start_hh']).'", - `start_min` = "'.mysql_real_escape_string($monster['start_min']).'", - `back_min` = "'.mysql_real_escape_string($monster['back_min']).'", - `back_dd` = "'.mysql_real_escape_string($monster['back_dd']).'", - `back_mm` = "'.mysql_real_escape_string($monster['back_mm']).'", - `back_hh` = "'.mysql_real_escape_string($monster['back_hh']).'", - `start_text` = "'.mysql_real_escape_string($monster['start_text']).'", - `back_text` = "'.mysql_real_escape_string($monster['back_text']).'", - `win_text` = "'.mysql_real_escape_string($monster['win_text']).'", - `lose_text` = "'.mysql_real_escape_string($monster['lose_text']).'", - `win_money1` = "'.mysql_real_escape_string($monster['win_money1']).'", - `win_money2` = "'.mysql_real_escape_string($monster['win_money2']).'", - `lose_money` = "'.mysql_real_escape_string($monster['lose_money']).'", - `lose_money2` = "'.mysql_real_escape_string($monster['lose_money2']).'", - `win_exp` = "'.mysql_real_escape_string($monster['win_exp']).'", - `lose_exp` = "'.mysql_real_escape_string($monster['lose_exp']).'", - `win_itm` = "'.mysql_real_escape_string($monster['win_itm']).'", - `lose_itm` = "'.mysql_real_escape_string($monster['lose_itm']).'", - `win_eff` = "'.mysql_real_escape_string($monster['win_eff']).'", - `lose_eff` = "'.mysql_real_escape_string($monster['lose_eff']).'", - `win_ico` = "'.mysql_real_escape_string($monster['win_ico']).'", - `lose_ico` = "'.mysql_real_escape_string($monster['lose_ico']).'", - `win_back` = "'.mysql_real_escape_string($monster['win_back']).'", - `time_restart` = "'.mysql_real_escape_string($monster['time_restart']).'", - `nich_text` = "'.mysql_real_escape_string($monster['nich_text']).'" - WHERE `id` = "'.mysql_real_escape_string($monster['id']).'" LIMIT 1'); - } - - echo 'Новые данные были успешно сохранены!'; - } - - ?> - Параметры монстра:
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Место появления (id комнаты): - -   -
    Время ожидания после поражения бота: мин.
    Исчезнет после своей победы: -
    Появляется, - ДН - - Д - - - М - - Ч - - Мин - -
    Исчезает,    ДН - - Д - - - М - - Ч - - Мин -
    Текст появления (Логин бота {b}, Логины игроков {u}):
    Текст исчезновения:
    Текст победы игрока:
    Текст поражения игрока:
    Текст ничьей:
    Награда (победа игрока):
    Кр.:
    Екр.:
    Опыт (За 100% НР монстра):
    Предметы (id@kolvo@data, ...):
    Эффект:
    Подвиги:
    Награда (поражение игрока):
    Кр.:
    Екр.:
    Опыт:
    Предметы:
    Эффект:
    Подвиги:
    -
    - -
    -

    -
    -
    -
    Скрыть
    -
    - -
    -
    Настройка монстра
    -
    -info['align']>=1.1 && $u->info['align']<=1.99 && $inf['admin']<1) || ($u->info['align']>=3.05 && $u->info['align']<=3.99 && $inf['admin']<1) || $u->info['admin']>0 || $u->info['nadmin']>0)) - { - $mults = ''; - $bIP = array(); - - $spl = mysql_query('SELECT * FROM `mults` WHERE (`uid` = "'.$inf['id'].'" OR `uid2` = "'.$inf['id'].'") AND `uid`!="0" AND `uid2`!="0"'); - while($pls = mysql_fetch_array($spl)) - { - $usr = $pls['uid']; - if($usr==$inf['id']) - { - $usr = $pls['uid2']; - } - if( $pls['id'] == 2495806 ) { - - }elseif(!isset($bIP[$usr]) && $usr!=$inf['id']) - { - $si = mysql_fetch_array(mysql_query('SELECT `id`,`admin`,`online` FROM `users` WHERE `id` = "'.mysql_real_escape_string($usr).'" AND `login` != "delete" LIMIT 1')); - if(isset($si['id'])) - { - if($si['admin']==0) { - if( $si['online'] > time() - 520 ) { - $mults .= ''.$u->microLogin($si['id'],1).', '; - }else{ - $mults .= $u->microLogin($si['id'],1).', '; - } - } - } - } - } - - if($nopal) { - //echo '

    Вы не можете просматривать информацию старшего по званию...

    '; - } elseif ($u->info['admin']==0 && (($u->info['admin']==0 && (floor($u->info['align'])==1 && $inf['align']>=3.01 && $inf['align']<=3.99) || (floor($u->info['align'])==3 && $inf['align']>=1.1 && $inf['align']<=1.99)) || ($u->info['admin']==0 && $inf['admin']>0))) - { - echo '

    Персонаж носит вражескую склонность...

    '; - }else{ - echo '

    За игроком замечены следующие темные делишки:
    '; - if(!isset($_GET['mod_inf'])) { - echo 'Показать личное дело'; - }else{ - //Личное дело персонажа - $log = mysql_query('SELECT * FROM `users_delo` WHERE `uid`="'.$inf['id'].'" AND `type`="0" ORDER by `id` DESC LIMIT 21'); - $i = 0; - while ($log_w = mysql_fetch_array($log)) - { - echo ''.date("d.m.Y H:i:s",$log_w['time']).' '.$log_w['text'].'
    '; - $i++; - } - echo 'Скрыть личное дело'; - } - echo '

    '; - //Информация для паладинов\тарманов\ангелов - if(($u->info['align']>=1.4 && $u->info['align']<=1.99 && $u->info['align']!=1.6 && $u->info['align']!=1.75 && $inf['admin']<1) || ($u->info['align']>=3.05 && $u->info['align']<=3.99 && $u->info['align']!=3.06 && $inf['admin']<1) || $u->info['admin']>0) - { - if ((int)$u->info['align']==1) - { - $rang = 'Паладинов'; - } elseif ((int)$u->info['align']==3) - { - $rang = 'Тарманов'; - } else - { - $rang = 'Ангелов'; - } + "' . mysql_real_escape_string($inf['id']) . '", + "' . mysql_real_escape_string($monster['start_room']) . '", + "' . mysql_real_escape_string($monster['start_day']) . '", + "' . mysql_real_escape_string($monster['back_day']) . '", + "' . mysql_real_escape_string($monster['start_dd']) . '", + "' . mysql_real_escape_string($monster['start_mm']) . '", + "' . mysql_real_escape_string($monster['start_hh']) . '", + "' . mysql_real_escape_string($monster['start_min']) . '", + "' . mysql_real_escape_string($monster['back_min']) . '", + "' . mysql_real_escape_string($monster['back_dd']) . '", + "' . mysql_real_escape_string($monster['back_mm']) . '", + "' . mysql_real_escape_string($monster['back_hh']) . '", + "' . mysql_real_escape_string($monster['start_text']) . '", + "' . mysql_real_escape_string($monster['back_text']) . '", + "' . mysql_real_escape_string($monster['win_text']) . '", + "' . mysql_real_escape_string($monster['lose_text']) . '", + "' . mysql_real_escape_string($monster['win_money1']) . '", + "' . mysql_real_escape_string($monster['win_money2']) . '", + "' . mysql_real_escape_string($monster['lose_money']) . '", + "' . mysql_real_escape_string($monster['lose_money2']) . '", + "' . mysql_real_escape_string($monster['win_exp']) . '", + "' . mysql_real_escape_string($monster['lose_exp']) . '", + "' . mysql_real_escape_string($monster['win_itm']) . '", + "' . mysql_real_escape_string($monster['lose_itm']) . '", + "' . mysql_real_escape_string($monster['win_eff']) . '", + "' . mysql_real_escape_string($monster['lose_eff']) . '", + "' . mysql_real_escape_string($monster['win_ico']) . '", + "' . mysql_real_escape_string($monster['lose_ico']) . '", + "' . mysql_real_escape_string($monster['win_back']) . '", + "' . mysql_real_escape_string($monster['time_restart']) . '", + "' . mysql_real_escape_string($monster['nich_text']) . '" + ) ' + ); + } else { + mysql_query( + 'UPDATE `aaa_monsters` SET + `uid` = "' . mysql_real_escape_string($inf['id']) . '", + `start_room` = "' . mysql_real_escape_string($monster['start_room']) . '", + `start_day` = "' . mysql_real_escape_string($monster['start_day']) . '", + `back_day` = "' . mysql_real_escape_string($monster['back_day']) . '", + `start_dd` = "' . mysql_real_escape_string($monster['start_dd']) . '", + `start_mm` = "' . mysql_real_escape_string($monster['start_mm']) . '", + `start_hh` = "' . mysql_real_escape_string($monster['start_hh']) . '", + `start_min` = "' . mysql_real_escape_string($monster['start_min']) . '", + `back_min` = "' . mysql_real_escape_string($monster['back_min']) . '", + `back_dd` = "' . mysql_real_escape_string($monster['back_dd']) . '", + `back_mm` = "' . mysql_real_escape_string($monster['back_mm']) . '", + `back_hh` = "' . mysql_real_escape_string($monster['back_hh']) . '", + `start_text` = "' . mysql_real_escape_string($monster['start_text']) . '", + `back_text` = "' . mysql_real_escape_string($monster['back_text']) . '", + `win_text` = "' . mysql_real_escape_string($monster['win_text']) . '", + `lose_text` = "' . mysql_real_escape_string($monster['lose_text']) . '", + `win_money1` = "' . mysql_real_escape_string($monster['win_money1']) . '", + `win_money2` = "' . mysql_real_escape_string($monster['win_money2']) . '", + `lose_money` = "' . mysql_real_escape_string($monster['lose_money']) . '", + `lose_money2` = "' . mysql_real_escape_string($monster['lose_money2']) . '", + `win_exp` = "' . mysql_real_escape_string($monster['win_exp']) . '", + `lose_exp` = "' . mysql_real_escape_string($monster['lose_exp']) . '", + `win_itm` = "' . mysql_real_escape_string($monster['win_itm']) . '", + `lose_itm` = "' . mysql_real_escape_string($monster['lose_itm']) . '", + `win_eff` = "' . mysql_real_escape_string($monster['win_eff']) . '", + `lose_eff` = "' . mysql_real_escape_string($monster['lose_eff']) . '", + `win_ico` = "' . mysql_real_escape_string($monster['win_ico']) . '", + `lose_ico` = "' . mysql_real_escape_string($monster['lose_ico']) . '", + `win_back` = "' . mysql_real_escape_string($monster['win_back']) . '", + `time_restart` = "' . mysql_real_escape_string($monster['time_restart']) . '", + `nich_text` = "' . mysql_real_escape_string($monster['nich_text']) . '" + WHERE `id` = "' . mysql_real_escape_string($monster['id']) . '" LIMIT 1' + ); + } - if($u->info['admin'] == 1) { - echo 'Комната: '.$inf['room'].'
    '; - } - if((int)$inf['host_reg'] >= 1){ - $inf['ref'] = $u->microLogin((int)$inf['host_reg'],1); - }else{ - $inf['ref'] = '--'; - } - if(!isset($inf['ipReg'])){ $inf['ipReg'] = '--'; } - echo ' + echo 'Новые данные были успешно сохранены!'; + } + + ?> + Параметры монстра:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Место появления (id комнаты): + +   +
    Время ожидания после поражения бота: мин. +
    Исчезнет после своей победы: +
    +
    +
    Появляется, + ДН + + Д + + + М + + Ч + + Мин + +
    Исчезает,    ДН + + Д + + + М + + Ч + + Мин +
    +
    +
    Текст появления (Логин бота {b}, Логины игроков {u}):
    Текст исчезновения:
    Текст победы игрока:
    Текст поражения игрока:
    Текст ничьей:
    +
    + Награда (победа игрока):
    Кр.:
    Екр.:
    Опыт (За 100% НР монстра):
    Предметы (id@kolvo@data, ...):
    Эффект:
    Подвиги:
    +
    + Награда (поражение игрока):
    Кр.:
    Екр.:
    Опыт:
    Предметы:
    Эффект:
    Подвиги:
    +
    + +
    +

    +
    +
    +
    Скрыть
    +
    + +
    +
    Настройка монстра
    +
    + info['align'] >= 1.1 && $u->info['align'] <= 1.99 && $inf['admin'] < 1) || ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $inf['admin'] < 1) || $u->info['admin'] > 0 || $u->info['nadmin'] > 0)) { + $mults = ''; + $bIP = []; + + $spl = mysql_query( + 'SELECT * FROM `mults` WHERE (`uid` = "' . $inf['id'] . '" OR `uid2` = "' . $inf['id'] . '") AND `uid`!="0" AND `uid2`!="0"' + ); + while ($pls = mysql_fetch_array($spl)) { + $usr = $pls['uid']; + if ($usr == $inf['id']) { + $usr = $pls['uid2']; + } + if ($pls['id'] == 2495806) { + + } elseif (!isset($bIP[$usr]) && $usr != $inf['id']) { + $si = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`admin`,`online` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $usr + ) . '" AND `login` != "delete" LIMIT 1' + ) + ); + if (isset($si['id'])) { + if ($si['admin'] == 0) { + if ($si['online'] > time() - 520) { + $mults .= '' . $u->microLogin( + $si['id'], 1 + ) . ', '; + } else { + $mults .= $u->microLogin($si['id'], 1) . ', '; + } + } + } + } + } + + if ($nopal) { + //echo '

    Вы не можете просматривать информацию старшего по званию...

    '; + } elseif ($u->info['admin'] == 0 && (($u->info['admin'] == 0 && (floor( + $u->info['align'] + ) == 1 && $inf['align'] >= 3.01 && $inf['align'] <= 3.99) || (floor( + $u->info['align'] + ) == 3 && $inf['align'] >= 1.1 && $inf['align'] <= 1.99)) || ($u->info['admin'] == 0 && $inf['admin'] > 0))) { + echo '

    Персонаж носит вражескую склонность...

    '; + } else { + echo '

    За игроком замечены следующие темные делишки:
    '; + if (!isset($_GET['mod_inf'])) { + echo 'Показать личное дело'; + } else { + //Личное дело персонажа + $log = mysql_query( + 'SELECT * FROM `users_delo` WHERE `uid`="' . $inf['id'] . '" AND `type`="0" ORDER by `id` DESC LIMIT 21' + ); + $i = 0; + while ($log_w = mysql_fetch_array($log)) { + echo '' . date( + "d.m.Y H:i:s", $log_w['time'] + ) . ' ' . $log_w['text'] . '
    '; + $i++; + } + echo 'Скрыть личное дело'; + } + echo '

    '; + //Информация для паладинов\тарманов\ангелов + if (($u->info['align'] >= 1.4 && $u->info['align'] <= 1.99 && $u->info['align'] != 1.6 && $u->info['align'] != 1.75 && $inf['admin'] < 1) || ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $u->info['align'] != 3.06 && $inf['admin'] < 1) || $u->info['admin'] > 0) { + if ((int)$u->info['align'] == 1) { + $rang = 'Паладинов'; + } elseif ((int)$u->info['align'] == 3) { + $rang = 'Тарманов'; + } else { + $rang = 'Ангелов'; + } + + if ($u->info['admin'] == 1) { + echo 'Комната: ' . $inf['room'] . '
    '; + } + if ((int)$inf['host_reg'] >= 1) { + $inf['ref'] = $u->microLogin((int)$inf['host_reg'], 1); + } else { + $inf['ref'] = '--'; + } + if (!isset($inf['ipReg'])) { + $inf['ipReg'] = '--'; + } + echo '
    - Только для '.$rang.'
    - День рождения: '.$inf['bithday'].'
    '; - - if($inf['vip']==1) { - echo 'VIP персонаж
    '; - } - - if($u->info['admin'] > 0) { - if( $inf['activ'] == 0 ) { - echo ''; - } - - $mls = mysql_fetch_array(mysql_query('SELECT * FROM `users_rbk` WHERE `email` = "'.mysql_real_escape_string($inf['mail']).'" LIMIT 1')); - if(isset($mls['name'])) { - echo 'E-mail: '.$inf['mail'].' (РАССЫЛКА)'; - }else{ - echo 'E-mail: '.$inf['mail'].''; - } - if( $inf['activ'] == 0 ) { - echo '   &   '.$inf['send'].'
    '; - echo '
    '; - }else{ - echo '
    '; - } - }else{ - if( $inf['activ'] == 0 ) { - echo 'Персонаж активирован'; - }else{ - echo 'Персонаж не активирован'; - } - echo '
    '; - } - if( $inf['no_ip'] != 0 ) { - $inf['ipReg'] = $inf['no_ip']; - $inf['ip'] = $inf['no_ip']; - } - echo 'Персонажа пригласили: '.$inf['ref'].'
    - Последний раз заходил в клуб: '.date('d.m.Y H:i',$inf['online']).'
    - '.$pr['login'].'IP при регистрации: '.$inf['ipReg'].'
    '; - if($inf['no_ip'] == '' || $u->info['admin']>0) { - echo 'IP последние: '.$inf['ip'].''; - $auth = mysql_query('SELECT * FROM `logs_auth` WHERE `uid`="'.$inf['id'].'" AND `type`="1" ORDER by `id` DESC LIMIT 10'); - $country = ''; - while ($auth_w = mysql_fetch_array($auth)) { - echo '
    '.$auth_w['ip'].' ('.date('d.m.Y H:i',$auth_w['time']).')'; - } - }else{ - echo 'IP последние: '.$inf['no_ip'].''; - } - - -function user_browser($agent) { - preg_match("/(MSIE|Opera|Firefox|Chrome|Version|Opera Mini|Netscape|Konqueror|SeaMonkey|Camino|Minefield|Iceweasel|K-Meleon|Maxthon)(?:\/| )([0-9.]+)/", $agent, $browser_info); // регулярное выражение, которое позволяет отпределить 90% браузеров - list(,$browser,$version) = $browser_info; // получаем данные из массива в переменную - if (preg_match("/Opera ([0-9.]+)/i", $agent, $opera)) return 'Opera '.$opera[1]; // определение _очень_старых_ версий Оперы (до 8.50), при желании можно убрать - if ($browser == 'MSIE') { // если браузер определён как IE - preg_match("/(Maxthon|Avant Browser|MyIE2)/i", $agent, $ie); // проверяем, не разработка ли это на основе IE - if ($ie) return $ie[1].' based on IE '.$version; // если да, то возвращаем сообщение об этом - return 'IE '.$version; // иначе просто возвращаем IE и номер версии - } - if ($browser == 'Firefox') { // если браузер определён как Firefox - preg_match("/(Flock|Navigator|Epiphany)\/([0-9.]+)/", $agent, $ff); // проверяем, не разработка ли это на основе Firefox - if ($ff) return $ff[1].' '.$ff[2]; // если да, то выводим номер и версию - } - if ($browser == 'Opera' && $version == '9.80') return 'Opera '.substr($agent,-5); // если браузер определён как Opera 9.80, берём версию Оперы из конца строки - if ($browser == 'Version') return 'Safari '.$version; // определяем Сафари - if (!$browser && strpos($agent, 'Gecko')) return 'Browser based on Gecko'; // для неопознанных браузеров проверяем, если они на движке Gecko, и возращаем сообщение об этом - return $browser.' '.$version; // для всех остальных возвращаем браузер и версию -} - - - echo' + Только для ' . $rang . '
    + День рождения: ' . $inf['bithday'] . '
    '; + + if ($inf['vip'] == 1) { + echo 'VIP персонаж
    '; + } + + if ($u->info['admin'] > 0) { + if ($inf['activ'] == 0) { + echo ''; + } + + $mls = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `users_rbk` WHERE `email` = "' . mysql_real_escape_string( + $inf['mail'] + ) . '" LIMIT 1' + ) + ); + if (isset($mls['name'])) { + echo 'E-mail: ' . $inf['mail'] . ' (РАССЫЛКА)'; + } else { + echo 'E-mail: ' . $inf['mail'] . ''; + } + if ($inf['activ'] == 0) { + echo '   &   ' . $inf['send'] . '
    '; + echo '
    '; + } else { + echo '
    '; + } + } else { + if ($inf['activ'] == 0) { + echo 'Персонаж активирован'; + } else { + echo 'Персонаж не активирован'; + } + echo '
    '; + } + if ($inf['no_ip'] != 0) { + $inf['ipReg'] = $inf['no_ip']; + $inf['ip'] = $inf['no_ip']; + } + echo 'Персонажа пригласили: ' . $inf['ref'] . '
    + Последний раз заходил в клуб: ' . date('d.m.Y H:i', $inf['online']) . '
    + ' . $pr['login'] . 'IP при регистрации: ' . $inf['ipReg'] . '
    '; + if ($inf['no_ip'] == '' || $u->info['admin'] > 0) { + echo 'IP последние: ' . $inf['ip'] . ''; + $auth = mysql_query( + 'SELECT * FROM `logs_auth` WHERE `uid`="' . $inf['id'] . '" AND `type`="1" ORDER by `id` DESC LIMIT 10' + ); + $country = ''; + while ($auth_w = mysql_fetch_array($auth)) { + echo '
    ' . $auth_w['ip'] . ' (' . date( + 'd.m.Y H:i', $auth_w['time'] + ) . ')'; + } + } else { + echo 'IP последние: ' . $inf['no_ip'] . ''; + } + + + function user_browser($agent) + { + preg_match( + "/(MSIE|Opera|Firefox|Chrome|Version|Opera Mini|Netscape|Konqueror|SeaMonkey|Camino|Minefield|Iceweasel|K-Meleon|Maxthon)(?:\/| )([0-9.]+)/", + $agent, $browser_info + ); // регулярное выражение, которое позволяет отпределить 90% браузеров + list(, $browser, $version) = $browser_info; // получаем данные из массива в переменную + if (preg_match("/Opera ([0-9.]+)/i", $agent, $opera)) { + return 'Opera ' . $opera[1]; + } // определение _очень_старых_ версий Оперы (до 8.50), при желании можно убрать + if ($browser == 'MSIE') { // если браузер определён как IE + preg_match( + "/(Maxthon|Avant Browser|MyIE2)/i", $agent, $ie + ); // проверяем, не разработка ли это на основе IE + if ($ie) { + return $ie[1] . ' based on IE ' . $version; + } // если да, то возвращаем сообщение об этом + return 'IE ' . $version; // иначе просто возвращаем IE и номер версии + } + if ($browser == 'Firefox') { // если браузер определён как Firefox + preg_match( + "/(Flock|Navigator|Epiphany)\/([0-9.]+)/", $agent, $ff + ); // проверяем, не разработка ли это на основе Firefox + if ($ff) { + return $ff[1] . ' ' . $ff[2]; + } // если да, то выводим номер и версию + } + if ($browser == 'Opera' && $version == '9.80') { + return 'Opera ' . substr($agent, -5); + } // если браузер определён как Opera 9.80, берём версию Оперы из конца строки + if ($browser == 'Version') { + return 'Safari ' . $version; + } // определяем Сафари + if (!$browser && strpos($agent, 'Gecko')) { + return 'Browser based on Gecko'; + } // для неопознанных браузеров проверяем, если они на движке Gecko, и возращаем сообщение об этом + return $browser . ' ' . $version; // для всех остальных возвращаем браузер и версию + } + + + echo '
    - Браузер: '.user_browser($inf['dateEnter']).'
    + Браузер: ' . user_browser($inf['dateEnter']) . '
    '; - - if($inf['no_ip'] == '' || $u->info['admin']>0) { - if($mults!='' && $inf['admin']==0){ - $mults = trim($mults,', '); - echo 'Другие ники этого бойца: '.$mults.'
    '; - } - } - - $referalos = ''; - $rfs = 0; - - $sp = mysql_query('SELECT `id`,`login`,`ip`,`ipreg`,`timereg`,`online` FROM `users` WHERE `host_reg` = "'.$inf['id'].'" AND `activ` = "0" ORDER BY `timereg` DESC'); - while( $pl = mysql_fetch_array($sp) ) { - $referalos .= '
    Дата рег.: '.date('d.m.Y H:i',$pl['timereg']).' / Был тут: '.date('d.m.Y H:i',$pl['online']).'   '.$u->microLogin($pl['id'],1).' ( '.$pl['ip'].' , '.$pl['ipreg'].' )'; - $rfs++; - } - - if( $referalos == '' ) { - $referalos = 'Отсутствуют'; - } - echo '
    Рефералы бойца:'.$referalos.'
    '; - if($u->info['admin']>0) - { - echo 'Доп. возможности: сбросить характеристики
    '; - $on1 = mysql_fetch_array(mysql_query('SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "'.$inf['id'].'" LIMIT 1')); - echo 'Время в онлайне (всего): '.timeOut($on1['time_all']).'
    Время в онлайне (сегодня): '.timeOut($on1['time_today']).'
    '; - } - if($inf['molch3'] time()) - { - echo 'Запретить персонажу отправлять сообщения с молчанкой
    '; - } - - echo' - Опыт: '.$inf['exp'].'
    - Число неиспользованных UP-ов: '.$inf['ability'].'
    - Кредитов: '.$inf['money'].'
    ЕвроКредитов: '.$inf['money2'].'
    Зубов: '.$u->zuby($inf['money4']).''; - $bnk = ''; $bmn1 = 0; $bmn2 = 0; - $sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$inf['id'].'"'); - while($pl = mysql_fetch_array($sp)) { - if($pl['useNow'] > 0) { - $bnk .= '
    '; - }else{ - $bnk .= '
    '; - } - $bnk .= '  • '.$pl['id'].''; - $bnk .= ''.$pl['money1'].' кр.'; - $bnk .= ''.$pl['money2'].' екр.'; - if($u->info['admin'] > 0) { - $bnk .= 'Пароль: '.htmlspecialchars($pl['pass'],NULL,'cp1251').''; - } - if($pl['moneyBuy'] > 0) { - $ds = 'Персонаж покупал еврокредиты  Сумма : '.$pl['moneyBuy'].'
    '; - } - $bmn1 += $pl['money1']; - $bmn2 += $pl['money2']; - $bnk .= '
    '; - } - $pk = mysql_fetch_array(mysql_query('SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "'.$inf['id'].'" AND `good` > 0 LIMIT 1')); - echo '
    Персонаж покупал еврокредиты  Сумма : '.$pk[0].' ЕКР
    '; - if($bnk != '') { - echo '
    Банковские счета:'.$bnk.'   Деньги (Всего в банке):   '.$bmn1.' кр.     '.$bmn2.' екр.
    '.$ds; - } - if($u->info['admin']>0 && $inf['admin']>0) { - echo '
    admin: '.$inf['admin'].''; - } - if($inf['active']!=''){ - echo '
    Внимание!Если персонаж не получает письма с активацией отправте ему письмо вручную.'; - echo '
    '; - echo "

    "; - } - echo '
    '; - } - } - } - ?> -
    -
    - - - - -
    -
    -
    - - = 0) { ?> - - 1 && $inf['align']<2) { ?> - /' target='_blank'>
    - /' target='_blank'>Орден Света - =3.01 && $inf['align']<=3.99) { ?> - /'>
    - /' target='_blank'>Армада - =2 && $inf['align']<3) { ?> - /'>
    - /' target='_blank'>Цитадель Хаоса - -
    - Новости
    - -
    - - + + if ($inf['no_ip'] == '' || $u->info['admin'] > 0) { + if ($mults != '' && $inf['admin'] == 0) { + $mults = trim($mults, ', '); + echo 'Другие ники этого бойца: ' . $mults . '
    '; + } + } + + $referalos = ''; + $rfs = 0; + + $sp = mysql_query( + 'SELECT `id`,`login`,`ip`,`ipreg`,`timereg`,`online` FROM `users` WHERE `host_reg` = "' . $inf['id'] . '" AND `activ` = "0" ORDER BY `timereg` DESC' + ); + while ($pl = mysql_fetch_array($sp)) { + $referalos .= '
    Дата рег.: ' . date( + 'd.m.Y H:i', $pl['timereg'] + ) . ' / Был тут: ' . date( + 'd.m.Y H:i', $pl['online'] + ) . '   ' . $u->microLogin( + $pl['id'], 1 + ) . ' ( ' . $pl['ip'] . ' , ' . $pl['ipreg'] . ' )'; + $rfs++; + } + + if ($referalos == '') { + $referalos = 'Отсутствуют'; + } + echo '
    Рефералы бойца:' . $referalos . '
    '; + if ($u->info['admin'] > 0) { + echo 'Доп. возможности: сбросить характеристики
    '; + $on1 = mysql_fetch_array( + mysql_query( + 'SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1' + ) + ); + echo 'Время в онлайне (всего): ' . timeOut( + $on1['time_all'] + ) . '
    Время в онлайне (сегодня): ' . timeOut( + $on1['time_today'] + ) . '
    '; + } + if ($inf['molch3'] < time() && $inf['molch1'] > time()) { + echo 'Запретить персонажу отправлять сообщения с молчанкой
    '; + } + + echo ' + Опыт: ' . $inf['exp'] . '
    + Число неиспользованных UP-ов: ' . $inf['ability'] . '
    + Кредитов: ' . $inf['money'] . '
    ЕвроКредитов: ' . $inf['money2'] . '
    Зубов: ' . $u->zuby( + $inf['money4'] + ) . ''; + $bnk = ''; + $bmn1 = 0; + $bmn2 = 0; + $sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "' . $inf['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['useNow'] > 0) { + $bnk .= '
    '; + } else { + $bnk .= '
    '; + } + $bnk .= '  • ' . $pl['id'] . ''; + $bnk .= '' . $pl['money1'] . ' кр.'; + $bnk .= '' . $pl['money2'] . ' екр.'; + if ($u->info['admin'] > 0) { + $bnk .= 'Пароль: ' . htmlspecialchars( + $pl['pass'], null, 'cp1251' + ) . ''; + } + if ($pl['moneyBuy'] > 0) { + $ds = 'Персонаж покупал еврокредиты  Сумма : ' . $pl['moneyBuy'] . '
    '; + } + $bmn1 += $pl['money1']; + $bmn2 += $pl['money2']; + $bnk .= '
    '; + } + $pk = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $inf['id'] . '" AND `good` > 0 LIMIT 1' + ) + ); + echo '
    Персонаж покупал еврокредиты  Сумма : ' . $pk[0] . ' ЕКР
    '; + if ($bnk != '') { + echo '
    Банковские счета:' . $bnk . '   Деньги (Всего в банке):   ' . $bmn1 . ' кр.     ' . $bmn2 . ' екр.
    ' . $ds; + } + if ($u->info['admin'] > 0 && $inf['admin'] > 0) { + echo '
    admin: ' . $inf['admin'] . ''; + } + if ($inf['active'] != '') { + echo '
    Внимание!Если персонаж не получает письма с активацией отправте ему письмо вручную.'; + echo '
    '; + echo "

    "; + } + echo '
    '; + } + } + } + ?> + +
    + + + + +
    +
    +
    + + = 0) { ?> + + 1 && $inf['align'] < 2) { ?> + /' target='_blank'> +
    + /' target='_blank'>Орден + Света + = 3.01 && $inf['align'] <= 3.99) { ?> + /'> +
    + /' target='_blank'>Армада + = 2 && $inf['align'] < 3) { ?> + /'> +
    + /' target='_blank'>Цитадель + Хаоса + + +
    + Новости
    + +
    +
    + + + + -info['align'] > 1 && $u->info['align'] < 2 ) { - $moder = 1; +if ($u->info['align'] > 1 && $u->info['align'] < 2) { + $moder = 1; } -if( $u->info['align'] > 3 && $u->info['align'] < 4 ) { - $moder = 2; +if ($u->info['align'] > 3 && $u->info['align'] < 4) { + $moder = 2; } -if($inf['level'] < 8 && $inf['admin'] == 0 && $u->info['admin'] == 0 && $moder == 0) { -?> -
    -

    Обезличен до достижения 8 уровня

    -info['admin'] == 0 && $moder == 0) { + ?> +
    +

    Обезличен до достижения 8 уровня

    + +

    Персонаж обезличен 1) { + echo 'до ' . date('d.m.Y H:i', $inf['info_delete']) . '.'; + } else { + echo '.'; + } ?>

    + info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0) { + echo '
    '; + } +} +if ($inf['info_delete'] == 0 || (($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0)) { ?> -

    Персонаж обезличен 1){ echo 'до '.date('d.m.Y H:i',$inf['info_delete']).'.'; }else{ echo '.'; } ?>

    -info['align']>1 && $u->info['align']<2 || $u->info['align']>3 && $u->info['align']<4 || $u->info['admin']>0) - { - echo '
    '; - } -} -if($inf['info_delete']==0 || (($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4) || $u->info['admin']>0)) -{ -?> -
    -
    -

    Анкетные данные

    - -Имя:
    -Пол: -
    - -Город:
    -0 && $inf['icq_hide']==0){ echo 'ICQ: '.$inf['icq'].'
    '; } ?> -Skype: '.$inf['skype'].'
    '; } ?> -4) { -$url = ((substr($inf['homepage'],0,4)=='https'?"":"https://").$inf['homepage']); -?> -Домашняя страница:
    - -Девиз:
    - -Увлечения / хобби:
    -',$inf['hobby']); - } - if($inf['info_delete']!=0) - { - echo '
    '; - } -} -echo '

    '.$c['counters_noFrm'].'
    '; -?> +
    +
    +

    Анкетные данные

    + + Имя:
    + Пол: +
    + + Город:
    + 0 && $inf['icq_hide'] == 0) { + echo 'ICQ: ' . $inf['icq'] . '
    '; + } ?> + Skype: ' . $inf['skype'] . '
    '; + } ?> + 4) { + $url = ((substr($inf['homepage'], 0, 4) == 'https' ? "" : "https://") . $inf['homepage']); + ?> + Домашняя страница: +
    + + Девиз:
    + + Увлечения / хобби:
    + ', $inf['hobby']); + } + if ($inf['info_delete'] != 0) { + echo '
    '; + } + } + echo '

    ' . $c['counters_noFrm'] . '
    '; + ?>

    -
    -

    +
    +

    diff --git a/item_edit_data.php b/item_edit_data.php index d33dd05d..6dad0f69 100644 --- a/item_edit_data.php +++ b/item_edit_data.php @@ -1,4 +1,5 @@ info['admin'] > 0 ) { - - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($_GET['edit_item_data']).'" LIMIT 1')); - if(isset($itm['id'])) { - if(isset($_POST['newdata'])) { - mysql_query('UPDATE `items_main_data` SET `data` = "'.mysql_real_escape_string($_POST['newdata']).'" WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1'); - die(''); - } - echo '
    Номер предмета: '.$itm['items_id'].'

    '; - } -}else{ - header('location: https://new-combats.com/'); +if (!$u->info['admin']) { + header('location: https://new-combats.com/'); + exit(); +} +$itm = mysql_fetch_array( + mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = ' . (int)$_GET['edit_item_data']) +); +if (isset($itm['id'])) { + if (isset($_POST['newdata'])) { + mysql_query( + 'UPDATE `items_main_data` SET `data` = "' . mysql_real_escape_string( + $_POST['newdata'] + ) . '" WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1' + ); + die(''); + } + echo '
    Номер предмета: ' . $itm['items_id'] . '

    '; } - -?> \ No newline at end of file diff --git a/items_editor.php b/items_editor.php index 9a33f346..70e9dadb 100644 --- a/items_editor.php +++ b/items_editor.php @@ -1,4 +1,5 @@ info['admin'] == 0 ) { - header('location: /index.php'); +if (!$u->info['admin']) { + header('location: /index.php'); } -if( isset($_POST['it_name']) ) { - //Добавляем предмет - $error = ''; - -/* -Array -( -[it_name] => Кастет -Когти медведя- -[it_img] => old/kastet2.gif -[it_type] => 18 -[it_massa] => 2 -[it_price1] => 3 -[it_price2] => -[it_iznos] => 20 -[it_slot] => 3 -[it_inRazdel] => 1 -[it_info] => -[it_group_max] => -[it_geni] => 1 -[it_srok] => -[it_max_text] => -[it_ndata] => -[it_data_value] => |sv_minAtack=2|sv_maxAtack=4 -[button] => Отправить предмет в базу -) -*/ - - if( (int)$_POST['it_group_max'] > 0 ) { - $_POST['it_group'] = 1; - } - - $ins = mysql_query('INSERT INTO `items_main` +if (isset($_POST['it_name'])) { + //Добавляем предмет + $error = ''; + + /* + Array + ( + [it_name] => Кастет -Когти медведя- + [it_img] => old/kastet2.gif + [it_type] => 18 + [it_massa] => 2 + [it_price1] => 3 + [it_price2] => + [it_iznos] => 20 + [it_slot] => 3 + [it_inRazdel] => 1 + [it_info] => + [it_group_max] => + [it_geni] => 1 + [it_srok] => + [it_max_text] => + [it_ndata] => + [it_data_value] => |sv_minAtack=2|sv_maxAtack=4 + [button] => Отправить предмет в базу + ) + */ + + if ((int)$_POST['it_group_max'] > 0) { + $_POST['it_group'] = 1; + } + + $ins = mysql_query( + 'INSERT INTO `items_main` (`name`,`img`,`type`,`massa`,`price1`,`price2`,`iznosMAXi`,`inslot`, `inRazdel`,`info`,`group`,`group_max`,`geni`,`srok`,`max_text`,`2h`,`2too`) VALUES ( - "'.mysql_real_escape_string($_POST['it_name']).'", - "'.mysql_real_escape_string($_POST['it_img']).'", - "'.mysql_real_escape_string($_POST['it_type']).'", - "'.mysql_real_escape_string($_POST['it_massa']).'", - "'.mysql_real_escape_string($_POST['it_price1']).'", - "'.mysql_real_escape_string($_POST['it_price2']).'", - "'.mysql_real_escape_string($_POST['it_iznos']).'", - "'.mysql_real_escape_string($_POST['it_slot']).'", - "'.mysql_real_escape_string($_POST['it_inRazdel']).'", - "'.mysql_real_escape_string($_POST['it_info']).'", - "'.mysql_real_escape_string($_POST['it_group']).'", - "'.mysql_real_escape_string($_POST['it_group_max']).'", - "'.mysql_real_escape_string($_POST['it_geni']).'", - "'.mysql_real_escape_string($_POST['it_srok']).'", - "'.mysql_real_escape_string($_POST['it_max_text']).'", - "'.mysql_real_escape_string($_POST['it_2h']).'", - "'.mysql_real_escape_string($_POST['it_2too']).'" - )'); - - if( $ins ) { - $iid = mysql_insert_id(); - $ins = mysql_query('INSERT INTO `items_main_data` (`items_id`,`data`) VALUES ( - "'.$iid.'","'.mysql_real_escape_string($_POST['it_data_value']).'" - )'); - if( !$ins ) { - $error = 'Неудалось добавить Er::(2)!'; - }else{ - $error = $iid.' Предмет добавлен!'; - } - }else{ - $error = 'Неудалось добавить Er::(1)!'; - } - - - if( $error == '' ) { - $error = 'Что-то не так...'; - } - die(''.$error.''); + "' . mysql_real_escape_string($_POST['it_name']) . '", + "' . mysql_real_escape_string($_POST['it_img']) . '", + "' . mysql_real_escape_string($_POST['it_type']) . '", + "' . mysql_real_escape_string($_POST['it_massa']) . '", + "' . mysql_real_escape_string($_POST['it_price1']) . '", + "' . mysql_real_escape_string($_POST['it_price2']) . '", + "' . mysql_real_escape_string($_POST['it_iznos']) . '", + "' . mysql_real_escape_string($_POST['it_slot']) . '", + "' . mysql_real_escape_string($_POST['it_inRazdel']) . '", + "' . mysql_real_escape_string($_POST['it_info']) . '", + "' . mysql_real_escape_string($_POST['it_group']) . '", + "' . mysql_real_escape_string($_POST['it_group_max']) . '", + "' . mysql_real_escape_string($_POST['it_geni']) . '", + "' . mysql_real_escape_string($_POST['it_srok']) . '", + "' . mysql_real_escape_string($_POST['it_max_text']) . '", + "' . mysql_real_escape_string($_POST['it_2h']) . '", + "' . mysql_real_escape_string($_POST['it_2too']) . '" + )' + ); + + if ($ins) { + $iid = mysql_insert_id(); + $ins = mysql_query( + 'INSERT INTO `items_main_data` (`items_id`,`data`) VALUES ( + "' . $iid . '","' . mysql_real_escape_string($_POST['it_data_value']) . '" + )' + ); + if (!$ins) { + $error = 'Неудалось добавить Er::(2)!'; + } else { + $error = $iid . ' Предмет добавлен!'; + } + } else { + $error = 'Неудалось добавить Er::(1)!'; + } + + + if ($error == '') { + $error = 'Что-то не так...'; + } + die('' . $error . ''); } - //Редактор предметов +//Редактор предметов ?> - - -Редактор предметов - - + - + //Требует + if (this.it_data_pr.tr != undefined) { + var i = 0; + while (i <= this.it_data_pr.tr) { + var npar = $('#par_tr_' + i).val(); + if (npar != undefined && $('#val_tr_' + i).val() != '') { + html += '|tr_' + npar + '=' + $('#val_tr_' + i).val(); + } + i++; + } + } + //Действует на + if (this.it_data_pr.add != undefined) { + var i = 0; + while (i <= this.it_data_pr.add) { + var npar = $('#par_add_' + i).val(); + if (npar != undefined && $('#val_add_' + i).val() != '') { + html += '|add_' + npar + '=' + $('#val_add_' + i).val(); + } + i++; + } + } + //Свойства + if (this.it_data_pr.sv != undefined) { + var i = 0; + while (i <= this.it_data_pr.sv) { + var npar = $('#par_sv_' + i).val(); + if (npar != undefined && $('#val_sv_' + i).val() != '') { + html += '|sv_' + npar + '=' + $('#val_sv_' + i).val(); + } + i++; + } + } + //Остальное + if (this.it_data_pr.all != undefined) { + var i = 0; + while (i <= this.it_data_pr.all) { + var npar = $('#par_all_' + i).val(); + if (npar != undefined && $('#val_all_' + i).val() != '') { + html += '|' + npar + '=' + $('#val_all_' + i).val(); + } + i++; + } + } + + $('#it_data_value').val(html); + }, + it_data_pr: {}, + newpar: function (id) { + var html = ''; + if (this.it_data_pr[id] == undefined) { + this.it_data_pr[id] = 0; + } else { + this.it_data_pr[id]++; + } + + html += ''; + + html = '
        x     ' + html + '
    '; + $('#it_data_' + id).html($('#it_data_' + id).html() + html); + }, + delpar: function (id, num) { + $('#new_par_' + id + '_' + num + '').remove(); + }, + compl: function () { + var html = '', html_l = '', html_r = ''; + + //Собираем данные + this.data = { + 'name': $('#it_name').val(), + 'img': $('#it_img').val() + + }; + + //Левая часть + html_l += ''; + + //Правая часть + html_r = '' + this.data.name + ''; + + //Собираем + html = '' + + '' + + '' + + '' + + '
    ' + + '' + + '' + + '' + + '' + + '' + + '
    ' + html_l + '' + html_r + '
    ' + + '
    '; + + $('#etitm').html(html); + } + }; + + - - - - -
    - - - - + - - -
      - +
    + + + + + + +
      + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название
    Изображение
    Тип +
    Масса
    Судьба
    Артефакт
    Двуручное
    В обе руки
    Цена (кр)
    Цена (екр)
    Долговечность
    Слот
    Раздел инвентаря
    Информация
    Группировка
    Поколение
    Срок годности (сек.)
    Макс. текст (символов)
    Доп.дата
    ITEMS_MAIN_DATA:
    + +
      
    +
    +
    +
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название
    Изображение
    Тип -
    Масса
    Судьба
    Артефакт
    Двуручное
    В обе руки
    Цена (кр)
    Цена (екр)
    Долговечность
    Слот
    Раздел инвентаря
    Информация
    Группировка
    Поколение
    Срок годности (сек.)
    Макс. текст (символов)
    Доп.дата
    ITEMS_MAIN_DATA:
    - -
      
    -
    +
    + +
    + + Требования: [+] +
    + +
    + + Действует на: [+] +
    + +
    + + Свойства: [+] +
    + +
    + + Остальное: [+] +
    + +
    + +
    +   +
    - -
    - -
    - - Требования: [+] -
    - -
    - - Действует на: [+] -
    - -
    - - Свойства: [+] -
    - -
    - - Остальное: [+] -
    - -
    - -
    -   -
    -
    + + \ No newline at end of file diff --git a/items_info.php b/items_info.php index f27850fa..971fe933 100644 --- a/items_info.php +++ b/items_info.php @@ -1,665 +1,1077 @@ 0, - 26 => 1, - 30 => 2, - 29 => 3, - 5 => 4, - 6 => 4, - 2 => 5, - 3 => 6, - 15 => 7, - 12 => 8, - 7 => 9, - 14 => 10, - 8 => 11, - 4 => 12, - 1 => 13, - //28 => 14, - 20 => 15, - 18 => 16, - 21 => 17, - 22 => 18, - 19 => 19, - 28 => 20, - //00 => 21, - //00 => 22, - 38 => 23, - 39 => 23, - 37 => 23, - 13 => 24, - 11 => 25, - 10 => 26, - 9 => 27, - 62 => 22, - 67 => 28, // 67 разное - 32 => 22, // 32 ингридиенты, маг.предметы - 34 => 28 // 34 ключи, разное -); +$rt = [ + 22 => 0, + 26 => 1, + 30 => 2, + 29 => 3, + 5 => 4, + 6 => 4, + 2 => 5, + 3 => 6, + 15 => 7, + 12 => 8, + 7 => 9, + 14 => 10, + 8 => 11, + 4 => 12, + 1 => 13, + //28 => 14, + 20 => 15, + 18 => 16, + 21 => 17, + 22 => 18, + 19 => 19, + 28 => 20, + //00 => 21, + //00 => 22, + 38 => 23, + 39 => 23, + 37 => 23, + 13 => 24, + 11 => 25, + 10 => 26, + 9 => 27, + 62 => 22, + 67 => 28, // 67 разное + 32 => 22, // 32 ингридиенты, маг.предметы + 34 => 28 // 34 ключи, разное +]; /* Пользователь */ -if (isset($_COOKIE['login'])) -{ -$u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_COOKIE['login']).'" AND `pass` = "'.mysql_real_escape_string($_COOKIE['pass']).'" LIMIT 1')); +if (isset($_COOKIE['login'])) { + $u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_COOKIE['login']) . '" AND `pass` = "' . mysql_real_escape_string($_COOKIE['pass']) . '" LIMIT 1')); } /* Предмет */ -$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($_GET['id']).'" LIMIT 1')); +$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($_GET['id']) . '" LIMIT 1')); - function timeOut($ttm) { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - /* +function timeOut($ttm) +{ + $out = ''; + $time_still = $ttm; + $tmp = floor($time_still / 2592000); + $id = 0; + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мес. "; + } + $time_still = $time_still - $tmp * 2592000; + } + /* $tmp = floor($time_still/604800); - if ($tmp > 0) - { + if ($tmp > 0) + { $id++; if ($id<3) {$out .= $tmp." нед. ";} $time_still = $time_still-$tmp*604800; } */ - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - return $out; - } - - function lookStats($m) - { - $ist = array(); - $di = explode('|',$m); - $i = 0; $de = false; - while($i 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " дн. "; + } + $time_still = $time_still - $tmp * 86400; + } + $tmp = floor($time_still / 3600); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " ч. "; + } + $time_still = $time_still - $tmp * 3600; + } + $tmp = floor($time_still / 60); + if ($tmp > 0) { + $id++; + if ($id < 3) { + $out .= $tmp . " мин. "; + } + } + if ($out == '') { + if ($time_still < 0) { + $time_still = 0; + } + $out = $time_still . ' сек.'; + } + return $out; } -if(!isset($itm['id'])) { - $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($_GET['id']).'" LIMIT 1')); - if(!isset($itd['id'])) { - $itd = array(); - }else{ - $itd = lookStats($itd['data']); - } -}else{ - $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1')); - $itd = lookStats($itd['data']); +function lookStats($m) +{ + $ist = []; + $di = explode('|', $m); + $i = 0; + $de = false; + while ($i < count($di)) { + $de = explode('=', $di[$i]); + if (isset($de[0], $de[1])) { + if (!isset($ist[$de[0]])) { + $ist[$de[0]] = 0; + } + $ist[$de[0]] = $de[1]; + } + $i++; + } + return $ist; } -$items = array( - 'tr' => array('lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','a1','a2','a3','a4','a5','a6','a7','mg1','mg2','mg3','mg4','mg5','mg6','mg7','mall','m2all','aall'), - 'add' => array('min_heal_proc','no_yv1','no_bl1','no_pr1','no_yv2','no_bl2','no_pr2','silver','pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','yron_min','yron_max','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','m21','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','speed_dungeon','antm3'), - 'sv' => array('pza','pza1','pza2','pza3','pza4','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','m21','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','min_use_mp','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack','free_stats','tya1','tya2','tya3','tya4','tym1','tym2','tym3','tym4','tym5','tym6','tym7') - ); - -$is = array('oza'=>'Защита от урона','oza1'=>'Защита от колющего урона','oza2'=>'Защита от рубящего урона','oza3'=>'Защита от дробящего урона','oza4'=>'Защита от режущего урона','hpAll'=>'Уровень жизни (HP)','mpAll'=>'Уровень маны','sex'=>'Пол','lvl'=>'Уровень','s1'=>'Сила','s2'=>'Ловкость','s3'=>'Интуиция','s4'=>'Выносливость','s5'=>'Интелект','s6'=>'Мудрость','s7'=>'Духовность','s8'=>'Воля','s9'=>'Свобода духа','s10'=>'Божественность','m1'=>'Мф. критического удара (%)','m2'=>'Мф. против критического удара (%)','m3'=>'Мф. мощности критического удара (%)','m4'=>'Мф. увертывания (%)','m5'=>'Мф. против увертывания (%)','m6'=>'Мф. контрудара (%)','m7'=>'Мф. парирования (%)','m8'=>'Мф. блока щитом (%)','m9'=>'Мф. пробоя брони (%)','m14'=>'Мф. абс. критического удара (%)','m15'=>'Мф. абс. увертывания (%)','m16'=>'Мф. абс. парирования (%)','m17'=>'Мф. абс. контрудара (%)','m18'=>'Мф. абс. блока щитом (%)','m19'=>'Мф. абс. магический промах (%)','m20'=>'Мф. удача (%)','m21'=>'Мф. абс. попадания (%)','a1'=>'Мастерство владения ножами, кинжалами','a2'=>'Мастерство владения топорами, секирами','a3'=>'Мастерство владения дубинами, молотами','a4'=>'Мастерство владения мечами','a5'=>'Мастерство владения магическими посохами','a6'=>'Мастерство владения луками','a7'=>'Мастерство владения арбалетами','aall'=>'Мастерство владения оружием','mall'=>'Мастерство владения магией стихий','m2all'=>'Мастерство владения магией','mg1'=>'Мастерство владения магией огня','mg2'=>'Мастерство владения магией воздуха','mg3'=>'Мастерство владения магией воды','mg4'=>'Мастерство владения магией земли','mg5'=>'Мастерство владения магией Света','mg6'=>'Мастерство владения магией Тьмы','mg7'=>'Мастерство владения серой магией','tj'=>'Тяжелая броня','lh'=>'Легкая броня','minAtack'=>'Минимальный урон','maxAtack'=>'Максимальный урон','m10'=>'Мф. мощности урона','m11'=>'Мф. мощности магии стихий','m11a'=>'Мф. мощности магии','pa1'=>'Мф. мощности колющего урона','pa2'=>'Мф. мощности рубящего урона','pa3'=>'Мф. мощности дробящий урона','pa4'=>'Мф. мощности режущий урона','pm1'=>'Мф. мощности магии огня','pm2'=>'Мф. мощности магии воздуха','pm3'=>'Мф. мощности магии воды','pm4'=>'Мф. мощности магии земли','pm5'=>'Мф. мощности магии Света','pm6'=>'Мф. мощности магии Тьмы','pm7'=>'Мф. мощности серой магии','za'=>'Защита от урона','zm'=>'Защита от магии стихий','zma'=>'Защита от магии','za1'=>'Защита от колющего урона','za2'=>'Защита от рубящего урона','za3'=>'Защита от дробящий урона','za4'=>'Защита от режущий урона','zm1'=>'Защита от магии огня','zm2'=>'Защита от магии воздуха','zm3'=>'Защита от магии воды','zm4'=>'Защита от магии земли','zm5'=>'Защита от магии Света','zm6'=>'Защита от магии Тьмы','zm7'=>'Защита от серой магии','pza'=>'Понижение защиты от урона','pzm'=>'Понижение защиты от магии','pza1'=>'Понижение защиты от колющего урона','min_heal_proc'=>'Эффект лечения (%)','silver'=>'Премиум','notravma'=>'Защита от травм','yron_min'=>'Минимальный урон','yron_max'=>'Максимальный урон','pza2'=>'Понижение защиты от рубящего урона','pza3'=>'Понижение защиты от дробящего урона','pza4'=>'Понижение защиты от режущего урона','pzm1'=>'Понижение защиты от магии огня','pzm2'=>'Понижение защиты от магии воздуха','pzm3'=>'Понижение защиты от магии воды','pzm4'=>'Понижение защиты от магии земли','pzm5'=>'Понижение защиты от магии Света','pzm6'=>'Понижение защиты от магии Тьмы','pzm7'=>'Понижение защиты от серой магии','speedhp'=>'Регенерация здоровья (НР)','speedmp'=>'Регенерация маны (МР)','tya1'=>'Колющие атаки','tya2'=>'Рубящие атаки','tya3'=>'Дробящие атаки','tya4'=>'Режущие атаки','tym1'=>'Огненные атаки','tym2'=>'Электрические атаки','tym3'=>'Ледяные атаки','tym4'=>'Земляные атаки','tym5'=>'Атаки Света','tym6'=>'Атаки Тьмы','tym7'=>'Серые атаки','min_use_mp'=>'Уменьшает расход маны','pog'=>'Поглощение урона','maxves'=>'Увеличивает рюкзак','zona'=>'Дополнительная зона атаки','zaproc'=>'Блокировка физического Урона(%)','zmproc'=>'Блокировка магического Урона (%)','speed_dungeon'=>'Скорость перемещения по пещерам','free_stats'=>'Свободных распределений','antm3'=>'Мф. против мощности крит. удара'); - -if( !file_exists('img.new-combats.com/i/encicl/pict_'.$rz[$rt[$itm['type']]][0].'.jpg') == true ) { - //subject - $rz[$rt[$itm['type']]][0] = 'subject'; +if (!isset($itm['id'])) { + $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . mysql_real_escape_string($_GET['id']) . '" LIMIT 1')); + if (!isset($itd['id'])) { + $itd = []; + } else { + $itd = lookStats($itd['data']); + } +} else { + $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1')); + $itd = lookStats($itd['data']); } -if( !isset($rz[$rt[$itm['type']]][1])) { - $rz[$rt[$itm['type']]][1] = 'Прочие предметы'; +$items = [ + 'tr' => [ + 'lvl', + 's1', + 's2', + 's3', + 's4', + 's5', + 's6', + 's7', + 's8', + 's9', + 's10', + 'a1', + 'a2', + 'a3', + 'a4', + 'a5', + 'a6', + 'a7', + 'mg1', + 'mg2', + 'mg3', + 'mg4', + 'mg5', + 'mg6', + 'mg7', + 'mall', + 'm2all', + 'aall', + ], + 'add' => [ + 'min_heal_proc', + 'no_yv1', + 'no_bl1', + 'no_pr1', + 'no_yv2', + 'no_bl2', + 'no_pr2', + 'silver', + 'pza', + 'pza1', + 'pza2', + 'pza3', + 'pza4', + 'pzm', + 'pzm1', + 'pzm2', + 'pzm3', + 'pzm4', + 'pzm5', + 'pzm6', + 'pzm7', + 'yron_min', + 'yron_max', + 'notravma', + 'min_zonb', + 'min_zona', + 'nokrit', + 'pog', + 'min_use_mp', + 'za1proc', + 'za2proc', + 'za3proc', + 'za4proc', + 'zaproc', + 'zmproc', + 'zm1proc', + 'zm2proc', + 'zm3proc', + 'zm4proc', + 'shopSale', + 's1', + 's2', + 's3', + 's4', + 's5', + 's6', + 's7', + 's8', + 's9', + 's10', + 'aall', + 'a1', + 'a2', + 'a3', + 'a4', + 'a5', + 'a6', + 'a7', + 'm2all', + 'mall', + 'mg1', + 'mg2', + 'mg3', + 'mg4', + 'mg5', + 'mg6', + 'mg7', + 'hpAll', + 'mpAll', + 'm1', + 'm2', + 'm3', + 'm4', + 'm5', + 'm6', + 'm7', + 'm8', + 'm9', + 'm14', + 'm15', + 'm16', + 'm17', + 'm18', + 'm19', + 'm20', + 'm21', + 'pa1', + 'pa2', + 'pa3', + 'pa4', + 'pm1', + 'pm2', + 'pm3', + 'pm4', + 'pm5', + 'pm6', + 'pm7', + 'za', + 'za1', + 'za2', + 'za3', + 'za4', + 'zma', + 'zm', + 'zm1', + 'zm2', + 'zm3', + 'zm4', + 'zm5', + 'zm6', + 'zm7', + 'mib1', + 'mab1', + 'mib2', + 'mab2', + 'mib3', + 'mab3', + 'mib4', + 'mab4', + 'speedhp', + 'speedmp', + 'm10', + 'm11', + 'zona', + 'zonb', + 'maxves', + 'minAtack', + 'maxAtack', + 'speed_dungeon', + 'antm3', + ], + 'sv' => [ + 'pza', + 'pza1', + 'pza2', + 'pza3', + 'pza4', + 'notravma', + 'min_zonb', + 'min_zona', + 'nokrit', + 'pog', + 'min_use_mp', + 'za1proc', + 'za2proc', + 'za3proc', + 'za4proc', + 'zaproc', + 'zmproc', + 'zm1proc', + 'zm2proc', + 'zm3proc', + 'zm4proc', + 'shopSale', + 's1', + 's2', + 's3', + 's4', + 's5', + 's6', + 's7', + 's8', + 's9', + 's10', + 'aall', + 'a1', + 'a2', + 'a3', + 'a4', + 'a5', + 'a6', + 'a7', + 'm2all', + 'mall', + 'mg1', + 'mg2', + 'mg3', + 'mg4', + 'mg5', + 'mg6', + 'mg7', + 'hpAll', + 'mpAll', + 'm1', + 'm2', + 'm3', + 'm4', + 'm5', + 'm6', + 'm7', + 'm8', + 'm9', + 'm14', + 'm15', + 'm16', + 'm17', + 'm18', + 'm19', + 'm20', + 'm21', + 'pa1', + 'pa2', + 'pa3', + 'pa4', + 'pm1', + 'pm2', + 'pm3', + 'pm4', + 'pm5', + 'pm6', + 'pm7', + 'min_use_mp', + 'za', + 'za1', + 'za2', + 'za3', + 'za4', + 'zma', + 'zm', + 'zm1', + 'zm2', + 'zm3', + 'zm4', + 'zm5', + 'zm6', + 'zm7', + 'mib1', + 'mab1', + 'mib2', + 'mab2', + 'mib3', + 'mab3', + 'mib4', + 'mab4', + 'speedhp', + 'speedmp', + 'm10', + 'm11', + 'zona', + 'zonb', + 'maxves', + 'minAtack', + 'maxAtack', + 'free_stats', + 'tya1', + 'tya2', + 'tya3', + 'tya4', + 'tym1', + 'tym2', + 'tym3', + 'tym4', + 'tym5', + 'tym6', + 'tym7', + ], +]; + +$is = [ + 'oza' => 'Защита от урона', + 'oza1' => 'Защита от колющего урона', + 'oza2' => 'Защита от рубящего урона', + 'oza3' => 'Защита от дробящего урона', + 'oza4' => 'Защита от режущего урона', + 'hpAll' => 'Уровень жизни (HP)', + 'mpAll' => 'Уровень маны', + 'sex' => 'Пол', + 'lvl' => 'Уровень', + 's1' => 'Сила', + 's2' => 'Ловкость', + 's3' => 'Интуиция', + 's4' => 'Выносливость', + 's5' => 'Интелект', + 's6' => 'Мудрость', + 's7' => 'Духовность', + 's8' => 'Воля', + 's9' => 'Свобода духа', + 's10' => 'Божественность', + 'm1' => 'Мф. критического удара (%)', + 'm2' => 'Мф. против критического удара (%)', + 'm3' => 'Мф. мощности критического удара (%)', + 'm4' => 'Мф. увертывания (%)', + 'm5' => 'Мф. против увертывания (%)', + 'm6' => 'Мф. контрудара (%)', + 'm7' => 'Мф. парирования (%)', + 'm8' => 'Мф. блока щитом (%)', + 'm9' => 'Мф. пробоя брони (%)', + 'm14' => 'Мф. абс. критического удара (%)', + 'm15' => 'Мф. абс. увертывания (%)', + 'm16' => 'Мф. абс. парирования (%)', + 'm17' => 'Мф. абс. контрудара (%)', + 'm18' => 'Мф. абс. блока щитом (%)', + 'm19' => 'Мф. абс. магический промах (%)', + 'm20' => 'Мф. удача (%)', + 'm21' => 'Мф. абс. попадания (%)', + 'a1' => 'Мастерство владения ножами, кинжалами', + 'a2' => 'Мастерство владения топорами, секирами', + 'a3' => 'Мастерство владения дубинами, молотами', + 'a4' => 'Мастерство владения мечами', + 'a5' => 'Мастерство владения магическими посохами', + 'a6' => 'Мастерство владения луками', + 'a7' => 'Мастерство владения арбалетами', + 'aall' => 'Мастерство владения оружием', + 'mall' => 'Мастерство владения магией стихий', + 'm2all' => 'Мастерство владения магией', + 'mg1' => 'Мастерство владения магией огня', + 'mg2' => 'Мастерство владения магией воздуха', + 'mg3' => 'Мастерство владения магией воды', + 'mg4' => 'Мастерство владения магией земли', + 'mg5' => 'Мастерство владения магией Света', + 'mg6' => 'Мастерство владения магией Тьмы', + 'mg7' => 'Мастерство владения серой магией', + 'tj' => 'Тяжелая броня', + 'lh' => 'Легкая броня', + 'minAtack' => 'Минимальный урон', + 'maxAtack' => 'Максимальный урон', + 'm10' => 'Мф. мощности урона', + 'm11' => 'Мф. мощности магии стихий', + 'm11a' => 'Мф. мощности магии', + 'pa1' => 'Мф. мощности колющего урона', + 'pa2' => 'Мф. мощности рубящего урона', + 'pa3' => 'Мф. мощности дробящий урона', + 'pa4' => 'Мф. мощности режущий урона', + 'pm1' => 'Мф. мощности магии огня', + 'pm2' => 'Мф. мощности магии воздуха', + 'pm3' => 'Мф. мощности магии воды', + 'pm4' => 'Мф. мощности магии земли', + 'pm5' => 'Мф. мощности магии Света', + 'pm6' => 'Мф. мощности магии Тьмы', + 'pm7' => 'Мф. мощности серой магии', + 'za' => 'Защита от урона', + 'zm' => 'Защита от магии стихий', + 'zma' => 'Защита от магии', + 'za1' => 'Защита от колющего урона', + 'za2' => 'Защита от рубящего урона', + 'za3' => 'Защита от дробящий урона', + 'za4' => 'Защита от режущий урона', + 'zm1' => 'Защита от магии огня', + 'zm2' => 'Защита от магии воздуха', + 'zm3' => 'Защита от магии воды', + 'zm4' => 'Защита от магии земли', + 'zm5' => 'Защита от магии Света', + 'zm6' => 'Защита от магии Тьмы', + 'zm7' => 'Защита от серой магии', + 'pza' => 'Понижение защиты от урона', + 'pzm' => 'Понижение защиты от магии', + 'pza1' => 'Понижение защиты от колющего урона', + 'min_heal_proc' => 'Эффект лечения (%)', + 'silver' => 'Премиум', + 'notravma' => 'Защита от травм', + 'yron_min' => 'Минимальный урон', + 'yron_max' => 'Максимальный урон', + 'pza2' => 'Понижение защиты от рубящего урона', + 'pza3' => 'Понижение защиты от дробящего урона', + 'pza4' => 'Понижение защиты от режущего урона', + 'pzm1' => 'Понижение защиты от магии огня', + 'pzm2' => 'Понижение защиты от магии воздуха', + 'pzm3' => 'Понижение защиты от магии воды', + 'pzm4' => 'Понижение защиты от магии земли', + 'pzm5' => 'Понижение защиты от магии Света', + 'pzm6' => 'Понижение защиты от магии Тьмы', + 'pzm7' => 'Понижение защиты от серой магии', + 'speedhp' => 'Регенерация здоровья (НР)', + 'speedmp' => 'Регенерация маны (МР)', + 'tya1' => 'Колющие атаки', + 'tya2' => 'Рубящие атаки', + 'tya3' => 'Дробящие атаки', + 'tya4' => 'Режущие атаки', + 'tym1' => 'Огненные атаки', + 'tym2' => 'Электрические атаки', + 'tym3' => 'Ледяные атаки', + 'tym4' => 'Земляные атаки', + 'tym5' => 'Атаки Света', + 'tym6' => 'Атаки Тьмы', + 'tym7' => 'Серые атаки', + 'min_use_mp' => 'Уменьшает расход маны', + 'pog' => 'Поглощение урона', + 'maxves' => 'Увеличивает рюкзак', + 'zona' => 'Дополнительная зона атаки', + 'zaproc' => 'Блокировка физического Урона(%)', + 'zmproc' => 'Блокировка магического Урона (%)', + 'speed_dungeon' => 'Скорость перемещения по пещерам', + 'free_stats' => 'Свободных распределений', + 'antm3' => 'Мф. против мощности крит. удара', +]; + +if (!file_exists('img.new-combats.com/i/encicl/pict_' . $rz[$rt[$itm['type']]][0] . '.jpg') == true) { + //subject + $rz[$rt[$itm['type']]][0] = 'subject'; } - + +if (!isset($rz[$rt[$itm['type']]][1])) { + $rz[$rt[$itm['type']]][1] = 'Прочие предметы'; +} + ?> - -Бойцовский клуб | Библиотека <? if(isset($itm['id'])) { ?> | <?=$rz[$rt[$itm['type']]][1]?> | <?=$itm['name']?><? } ?> - - + } + + .inup3 { + border: 1px dashed #D3CAA0; + font-size: 12px; + + } + + A:link { + FONT-WEIGHT: bold; + COLOR: #5B3E33; + TEXT-DECORATION: none + } + + A:visited { + FONT-WEIGHT: bold; + COLOR: #633525; + TEXT-DECORATION: none + } + + A:active { + FONT-WEIGHT: bold; + COLOR: #77684d; + TEXT-DECORATION: none + } + + A:hover { + COLOR: #000000; + TEXT-DECORATION: underline + } + + img { + border: none; + } + - - - + + +
    - - - -
    + + + + +
    +
    - - - - - - - - + + + + +
    -

    -
    -

    » Предметы / / -

    - -

    - -
    - - - - - - - - - - - - - - - - -
      
    -
    - -

     

    -
    - - - - - - - - - - -
    - - - - - - - - - - - -
    - - -Редактировать предмет    '; - echo $crd; - } + + + + + + + + -
    + +

    +
    +

    » Предметы / / + +

    + +

    + +
    + + + + + + + + + + + + + + + + +
    +   + +   +
    +
    + +

     

    +
    + + + + + +
    - if($itm['massa']>0) - { - echo '(Масса: '.$itm['massa'].') '; - } - if(isset($itd['art']) && $itd['art'] > 0) - { - echo 'Артефактная вещь '; - } + + + - - -
    + + + Редактировать предмет    '; + echo $crd; + } - if(isset($po['sudba']) && $po['sudba'] > 0) - { - echo ' '; - } + if ($itm['massa'] > 0) { + echo '(Масса: ' . $itm['massa'] . ') '; + } + if (isset($itd['art']) && $itd['art'] > 0) { + echo 'Артефактная вещь '; + } - if($itm['price1'] > 0) { - echo '
    Цена: '.$itm['price1'].' кр.'; - } + if (isset($po['sudba']) && $po['sudba'] > 0) { + echo ' '; + } - if($itm['price2'] > 0) { - echo '
    Цена: '.$itm['price2'].' екр.'; - } + if ($itm['price1'] > 0) { + echo '
    Цена: ' . $itm['price1'] . ' кр.'; + } - if($itm['iznosMAXi'] >= 999999999) { - echo '
    Долговечность: неразрушимо'; - }elseif($itm['iznosMAXi'] > 0) { - echo '
    Долговечность: 0/'.$itm['iznosMAXi'].''; - } + if ($itm['price2'] > 0) { + echo '
    Цена: ' . $itm['price2'] . ' екр.'; + } + + if ($itm['iznosMAXi'] >= 999999999) { + echo '
    Долговечность: неразрушимо'; + } elseif ($itm['iznosMAXi'] > 0) { + echo '
    Долговечность: 0/' . $itm['iznosMAXi'] . ''; + } - //Срок годности предмета - if(isset($itd['srok']) && $itd['srok'] > 0) - { - $itm['srok'] = $itd['srok']; - } - if($itm['srok'] > 0) - { - echo '
    Срок годности: '.timeOut($itm['srok']); - } - - //Продолжительность действия магии: - if((int)$itm['magic_inci'] > 0) - { - $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.((int)$itm['magic_inci']).'" LIMIT 1')); - if(isset($efi['id2']) && $efi['actionTime']>0) - { - echo '
    Продолжительность действия: '.timeOut($efi['actionTime']); - } - } + //Срок годности предмета + if (isset($itd['srok']) && $itd['srok'] > 0) { + $itm['srok'] = $itd['srok']; + } + if ($itm['srok'] > 0) { + echo '
    Срок годности: ' . timeOut($itm['srok']); + } + + //Продолжительность действия магии: + if ((int)$itm['magic_inci'] > 0) { + $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . ((int)$itm['magic_inci']) . '" LIMIT 1')); + if (isset($efi['id2']) && $efi['actionTime'] > 0) { + echo '
    Продолжительность действия: ' . timeOut($efi['actionTime']); + } + } -/* требования */ -$tr = ''; + /* требования */ + $tr = ''; -$t = $items['tr']; -$x = 0; -while($xТребуется минимальное:'.$tr; -} + if ($tr != '') { + echo '
    Требуется минимальное:' . $tr; + } -/* действует на */ -$tr = ''; + /* действует на */ + $tr = ''; -$t = $items['add']; -$x = 0; -while($x'головы',2=>'корпуса',3=>'пояса',4=>'ног'); - while($i<=4) - { - if(isset($itd['add_mab'.$i]) && $itd['add_mab'.$i]>0) - { - if($itd['add_mab'.$i]==$itd['add_mib'.$i]) - { - $z = '+'; - if($itd['add_mab'.$i]<0) - { - $z = ''; - } - $tr .= '
    • Броня '.$bn[$i].': '.$z.''.$itd['add_mab'.$i]; - }else{ - $tr .= '
    • Броня '.$bn[$i].': '.$itd['add_mib'.$i].'-'.$itd['add_mab'.$i]; - } - } - $i++; - } -if($tr != '') { - echo '
    Действует на:'.$tr; -} -/* свойства предмета */ -$tr = ''; + //действует на (броня) + $i = 1; + $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; + while ($i <= 4) { + if (isset($itd['add_mab' . $i]) && $itd['add_mab' . $i] > 0) { + if ($itd['add_mab' . $i] == $itd['add_mib' . $i]) { + $z = '+'; + if ($itd['add_mab' . $i] < 0) { + $z = ''; + } + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $itd['add_mab' . $i]; + } else { + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $itd['add_mib' . $i] . '-' . $itd['add_mab' . $i]; + } + } + $i++; + } + if ($tr != '') { + echo '
    Действует на:' . $tr; + } + /* свойства предмета */ + $tr = ''; - if(isset($itd['sv_yron_min'],$itd['sv_yron_max'])) - { - $tr .= '
    • Урон: '.$itd['sv_yron_min'].' - '.$itd['sv_yron_max']; - } - $x = 0; - while($x0) - { - $x = 1; - while($x<=$itd['zonb']) - { - $tr .= '+'; - $x++; - } - }else{ - $tr .= '—'; - } - } + if (isset($itd['sv_yron_min'], $itd['sv_yron_max'])) { + $tr .= '
    • Урон: ' . $itd['sv_yron_min'] . ' - ' . $itd['sv_yron_max']; + } + $x = 0; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($itd['sv_' . $n])) { + $z = '+'; + if ($itd['sv_' . $n] < 0) { + $z = ''; + } + $tr .= '
    • ' . $is[$n] . ': ' . $z . '' . $itd['sv_' . $n]; + } + $x++; + } + if ($itm['2too'] == 1) { + $tr .= '
    • Второе оружие'; + } + if ($itm['2h'] == 1) { + $tr .= '
    • Двуручное оружие'; + } + if (isset($itd['zonb'])) { + $tr .= '
    •Зоны блокирования: '; + if ($itd['zonb'] > 0) { + $x = 1; + while ($x <= $itd['zonb']) { + $tr .= '+'; + $x++; + } + } else { + $tr .= '—'; + } + } -if($tr != '') { - echo '
    Свойства предмета:'.$tr; -} + if ($tr != '') { + echo '
    Свойства предмета:' . $tr; + } -/* особенности */ -$tr = ''; + /* особенности */ + $tr = ''; - $x = 1; - while($x<=4) - { - if(isset($itd['tya'.$x]) && $itd['tya'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tya'.$x]>9) - { - $tyc = 'Редки'; - } - if($itd['tya'.$x]>24) - { - $tyc = 'Малы'; - } - if($itd['tya'.$x]>49) - { - $tyc = 'Временами'; - } - if($itd['tya'.$x]>74) - { - $tyc = 'Регулярны'; - } - if($itd['tya'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tya'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tya'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x<=7) - { - if(isset($itd['tym'.$x]) && $itd['tym'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tym'.$x]>9) - { - $tyc = 'Редки'; - } - if($itd['tym'.$x]>24) - { - $tyc = 'Малы'; - } - if($itd['tym'.$x]>49) - { - $tyc = 'Временами'; - } - if($itd['tym'.$x]>74) - { - $tyc = 'Регулярны'; - } - if($itd['tym'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tym'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tym'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x <= 4) - { - if(isset($itd['add_oza'.$x]) && $itd['add_oza'.$x]>0) - { - $tyc = 'Слабая'; - if($itd['add_oza'.$x] == 4) - { - $tyc = 'Посредственная'; - } - if($itd['add_oza'.$x] == 2) - { - $tyc = 'Нормальная'; - } - if($itd['add_oza'.$x] == 3) - { - $tyc = 'Хорошая'; - } - if($itd['add_oza'.$x] == 5) - { - $tyc = 'Великолепная'; - } - if($tyc != '') { - $tr .= '
    • '.$is['oza'.$x].': '.$tyc; - } - } - $x++; - } - if(isset($itd['free_stats']) && $itd['free_stats']>0){ - echo '
    Свободные распределения:
    • Возможных распределений: '.$itd['free_stats']; - } -if($tr != '') { - echo '
    Особенности:'.$tr; -} - $is2 = ''; + $x = 1; + while ($x <= 4) { + if (isset($itd['tya' . $x]) && $itd['tya' . $x] > 0) { + $tyc = 'Ничтожно редки'; + if ($itd['tya' . $x] > 9) { + $tyc = 'Редки'; + } + if ($itd['tya' . $x] > 24) { + $tyc = 'Малы'; + } + if ($itd['tya' . $x] > 49) { + $tyc = 'Временами'; + } + if ($itd['tya' . $x] > 74) { + $tyc = 'Регулярны'; + } + if ($itd['tya' . $x] > 89) { + $tyc = 'Часты'; + } + if ($itd['tya' . $x] >= 100) { + $tyc = 'Всегда'; + } + $tr .= '
    • ' . $is['tya' . $x] . ': ' . $tyc; + } + $x++; + } + $x = 1; + while ($x <= 7) { + if (isset($itd['tym' . $x]) && $itd['tym' . $x] > 0) { + $tyc = 'Ничтожно редки'; + if ($itd['tym' . $x] > 9) { + $tyc = 'Редки'; + } + if ($itd['tym' . $x] > 24) { + $tyc = 'Малы'; + } + if ($itd['tym' . $x] > 49) { + $tyc = 'Временами'; + } + if ($itd['tym' . $x] > 74) { + $tyc = 'Регулярны'; + } + if ($itd['tym' . $x] > 89) { + $tyc = 'Часты'; + } + if ($itd['tym' . $x] >= 100) { + $tyc = 'Всегда'; + } + $tr .= '
    • ' . $is['tym' . $x] . ': ' . $tyc; + } + $x++; + } + $x = 1; + while ($x <= 4) { + if (isset($itd['add_oza' . $x]) && $itd['add_oza' . $x] > 0) { + $tyc = 'Слабая'; + if ($itd['add_oza' . $x] == 4) { + $tyc = 'Посредственная'; + } + if ($itd['add_oza' . $x] == 2) { + $tyc = 'Нормальная'; + } + if ($itd['add_oza' . $x] == 3) { + $tyc = 'Хорошая'; + } + if ($itd['add_oza' . $x] == 5) { + $tyc = 'Великолепная'; + } + if ($tyc != '') { + $tr .= '
    • ' . $is['oza' . $x] . ': ' . $tyc; + } + } + $x++; + } + if (isset($itd['free_stats']) && $itd['free_stats'] > 0) { + echo '
    Свободные распределения:
    • Возможных распределений: ' . $itd['free_stats']; + } + if ($tr != '') { + echo '
    Особенности:' . $tr; + } + $is2 = ''; - if(isset($itd['complect'])) - { - $is2 .= '
    Дополнительная информация:'; - } - if(isset($itd['complect'])) - { - //не отображается - $com1 = array('name'=>'Неизвестный Комплект','x'=>0,'text'=>''); - $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "'.$itd['complect'].'" ORDER BY `x` ASC LIMIT 20'); - while($itmc = mysql_fetch_array($spc)) - { - $com1['name'] = $itmc['name']; - $com1['text'] .= '    • '.$itmc['x'].': '; - //действие комплекта - $i1c = 0; $i2c = 0; - $i1e = lookStats($itmc['data']); - while($i1c0) - { - $i3c = '+'.$i3c; - } - if($i2c>0) - { - $com1['text'] .= '    '.$is[$items['add'][$i1c]].': '.$i3c; - }else{ - $com1['text'] .= $is[$items['add'][$i1c]].': '.$i3c; - } - $com1['text'] .= '
    '; - $i2c++; - } - $i1c++; - } - unset($i1c,$i2c,$i3c); - $com1['x']++; - } - $is2 .= '
    • Часть комплекта: '.$com1['name'].'
    '; - $is2 .= $com1['text']; - $is2 .= ''; - } - - $is2 .= ''; - - if($itm['info']!='') - { - $is2 .= '
    Описание:
    '.$itm['info'].'
    '; - } - - if(isset($itd['info']) && $itd['info']!='') - { - $is2 .= '
    '.$itd['info'].'
    '; - } - - if(isset($itm['use_text']) && $itm['max_text']-$itm['use_text'] > 0) { - $is2 .= '
    Количество символов: '.($itm['max_text']-$itm['use_text']).'
    '; - } - - if(isset($itd['noremont']) && $itd['noremont']>0) - { - $is2 .= '
    Предмет не подлежит ремонту
    '; - } - - if(isset($itd['frompisher']) && $itd['frompisher']>0) - { - $is2 .= '
    Предмет из подземелья
    '; - } - - if(isset($itm['dn_delete']) && $itm['dn_delete']>0) - { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; - } - - $is2 .= '
    '; - -echo $is2; + if (isset($itd['complect'])) { + $is2 .= '
    Дополнительная информация:'; + } + if (isset($itd['complect'])) { + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "' . $itd['complect'] . '" ORDER BY `x` ASC LIMIT 20'); + while ($itmc = mysql_fetch_array($spc)) { + $com1['name'] = $itmc['name']; + $com1['text'] .= '    • ' . $itmc['x'] . ': '; + //действие комплекта + $i1c = 0; + $i2c = 0; + $i1e = lookStats($itmc['data']); + while ($i1c < count($items['add'])) { + if (isset($i1e[$items['add'][$i1c]])) { + $i3c = $i1e[$items['add'][$i1c]]; + if ($i3c > 0) { + $i3c = '+' . $i3c; + } + if ($i2c > 0) { + $com1['text'] .= '    ' . $is[$items['add'][$i1c]] . ': ' . $i3c; + } else { + $com1['text'] .= $is[$items['add'][$i1c]] . ': ' . $i3c; + } + $com1['text'] .= '
    '; + $i2c++; + } + $i1c++; + } + unset($i1c, $i2c, $i3c); + $com1['x']++; + } + $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; + $is2 .= $com1['text']; + $is2 .= ''; + } -?> -
    + $is2 .= ''; + + if ($itm['info'] != '') { + $is2 .= '
    Описание:
    ' . $itm['info'] . '
    '; + } + + if (isset($itd['info']) && $itd['info'] != '') { + $is2 .= '
    ' . $itd['info'] . '
    '; + } + + if (isset($itm['use_text']) && $itm['max_text'] - $itm['use_text'] > 0) { + $is2 .= '
    Количество символов: ' . ($itm['max_text'] - $itm['use_text']) . '
    '; + } + + if (isset($itd['noremont']) && $itd['noremont'] > 0) { + $is2 .= '
    Предмет не подлежит ремонту
    '; + } + + if (isset($itd['frompisher']) && $itd['frompisher'] > 0) { + $is2 .= '
    Предмет из подземелья
    '; + } + + if (isset($itm['dn_delete']) && $itm['dn_delete'] > 0) { + $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; + } + + $is2 .= '
    '; + + echo $is2; + + ?> +
    - -Требуется минимальное:
    • Уровень: 4
    • Выносливость: 16
    • Сила: 16
    Действует на:
    • Мф. увертывания (%): +30
    • Интуиция: +3
    • Сила: +5
    @@ -672,521 +1084,480 @@ echo $is2; Возможно усиление до 10го уровня
    */ -?> + ?> -
    -<?=$itm['name']?>
    +
    + <?= $itm['name'] ?> +
    -
    -

    - -

        
     
    -= 0 ) { - - if($rv == 1) { - //Костыли - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 26'); - }elseif($rv == 3) { - //Свитки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 29 AND `name` NOT LIKE "%Кристаллизатор%"'); - }elseif($rv == 2) { - //Эликсиры - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 30'); - }elseif($rv == 6) { - //Броня тяжелая - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 6'); - }elseif($rv == 32) { - //Броня легкая - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 5'); - }elseif($rv == 7) { - //Венки на голову - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 8) { - //Наручи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 3'); - }elseif($rv == 9) { - //Ботинки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 15'); - }elseif($rv == 10) { - //Перчатки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 12'); - }elseif($rv == 11) { - //Плащи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 7'); - }elseif($rv == 12) { - //Поножи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 14'); - }elseif($rv == 13) { - //Пояса - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 8'); - }elseif($rv == 14) { - //Рубахи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 4'); - }elseif($rv == 15) { - //Шлема - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 1'); - }elseif($rv == 16) { - //Елки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `name` LIKE "%Елка%"'); - }elseif($rv == 17) { - //Дубины - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 20'); - }elseif($rv == 18) { - //Кинжалы - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 18'); - }elseif($rv == 19) { - //Мечи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 21'); - }elseif($rv == 20) { - //Топоры - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 19'); - }elseif($rv == 21) { - //Посохи - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 22'); - }elseif($rv == 22) { - //Цветы - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32 AND `img` LIKE "f_%"'); - }elseif($rv == 23) { - //Компоненты - //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 24) { - //Маг.предметы - //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); - }elseif($rv == 25) { - //Подарки - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 38 OR `type` = 63'); - }elseif($rv == 26) { - //Руны - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 31'); - }elseif($rv == 27) { - //Прочие - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32'); - }elseif($rv == 28) { - //Щиты - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 13'); - }elseif($rv == 29) { - //Кольца - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 11'); - }elseif($rv == 30) { - //Ожерелья - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 10'); - }elseif($rv == 31) { - //Серьги - $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 9'); - } - - } - - - -?> - - - - - - - + -
    -

    » Предметы / -

    - -

    - '; - }else{ - - - while( $itm = mysql_fetch_array($sp) ) { - - //if(!isset($itm['id'])) { - $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1')); - $itd = lookStats($itd['data']); - - ?>
    - - - + + + + + + + +
    - - +
    - - - Редактировать предмет    '; - echo $crd; - } - if($itm['massa']>0) { - echo '(Масса: '.$itm['massa'].') '; - } - if(isset($itd['art']) && $itd['art'] > 0) - { - echo 'Артефактная вещь '; - } - - if(isset($po['sudba'])) - { - echo ' '; - } - - if($itm['price1'] > 0) { - echo '
    Цена: '.$itm['price1'].' кр.'; - } - - if($itm['price2'] > 0) { - echo '
    Цена: '.$itm['price2'].' екр.'; - } - - if($itm['iznosMAXi'] >= 999999999) { - echo '
    Долговечность: неразрушимо'; - }elseif($itm['iznosMAXi'] > 0) { - echo '
    Долговечность: 0/'.$itm['iznosMAXi'].''; - } +
    +

    + +

        
     
    + = 0) { + if ($rv == 1) { + //Костыли + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 26'); + } elseif ($rv == 3) { + //Свитки + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 29 AND `name` NOT LIKE "%Кристаллизатор%"'); + } elseif ($rv == 2) { + //Эликсиры + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 30'); + } elseif ($rv == 6) { + //Броня тяжелая + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 6'); + } elseif ($rv == 32) { + //Броня легкая + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 5'); + } elseif ($rv == 7) { + //Венки на голову + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); + } elseif ($rv == 8) { + //Наручи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 3'); + } elseif ($rv == 9) { + //Ботинки + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 15'); + } elseif ($rv == 10) { + //Перчатки + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 12'); + } elseif ($rv == 11) { + //Плащи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 7'); + } elseif ($rv == 12) { + //Поножи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 14'); + } elseif ($rv == 13) { + //Пояса + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 8'); + } elseif ($rv == 14) { + //Рубахи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 4'); + } elseif ($rv == 15) { + //Шлема + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 1'); + } elseif ($rv == 16) { + //Елки + $sp = mysql_query('SELECT * FROM `items_main` WHERE `name` LIKE "%Елка%"'); + } elseif ($rv == 17) { + //Дубины + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 20'); + } elseif ($rv == 18) { + //Кинжалы + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 18'); + } elseif ($rv == 19) { + //Мечи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 21'); + } elseif ($rv == 20) { + //Топоры + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 19'); + } elseif ($rv == 21) { + //Посохи + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 22'); + } elseif ($rv == 22) { + //Цветы + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32 AND `img` LIKE "f_%"'); + } elseif ($rv == 23) { + //Компоненты + //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); + } elseif ($rv == 24) { + //Маг.предметы + //$sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 2'); + } elseif ($rv == 25) { + //Подарки + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 38 OR `type` = 63'); + } elseif ($rv == 26) { + //Руны + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 31'); + } elseif ($rv == 27) { + //Прочие + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 32'); + } elseif ($rv == 28) { + //Щиты + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 13'); + } elseif ($rv == 29) { + //Кольца + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 11'); + } elseif ($rv == 30) { + //Ожерелья + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 10'); + } elseif ($rv == 31) { + //Серьги + $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 9'); + } + } - //Срок годности предмета - if(isset($itd['srok']) && $itd['srok'] > 0) - { - $itm['srok'] = $itd['srok']; - } - if($itm['srok'] > 0) - { - echo '
    Срок годности: '.timeOut($itm['srok']); - } - - //Продолжительность действия магии: - if((int)$itm['magic_inci'] > 0) - { - $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.((int)$itm['magic_inci']).'" LIMIT 1')); - if(isset($efi['id2']) && $efi['actionTime']>0) - { - echo '
    Продолжительность действия: '.timeOut($efi['actionTime']); - } - } + ?> + + + + + + + +
    + +

    » Предметы / +

    + +

    + '; + } else { + while ($itm = mysql_fetch_array($sp)) { + //if(!isset($itm['id'])) { + $itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1')); + $itd = lookStats($itd['data']); + + ?>
    + + + + + +
    + + + - - -
    + + + Редактировать предмет    '; + echo $crd; + } + if ($itm['massa'] > 0) { + echo '(Масса: ' . $itm['massa'] . ') '; + } + if (isset($itd['art']) && $itd['art'] > 0) { + echo 'Артефактная вещь '; + } + + if (isset($po['sudba'])) { + echo ' '; + } + + if ($itm['price1'] > 0) { + echo '
    Цена: ' . $itm['price1'] . ' кр.'; + } + + if ($itm['price2'] > 0) { + echo '
    Цена: ' . $itm['price2'] . ' екр.'; + } + + if ($itm['iznosMAXi'] >= 999999999) { + echo '
    Долговечность: неразрушимо'; + } elseif ($itm['iznosMAXi'] > 0) { + echo '
    Долговечность: 0/' . $itm['iznosMAXi'] . ''; + } -/* требования */ -$tr = ''; + //Срок годности предмета + if (isset($itd['srok']) && $itd['srok'] > 0) { + $itm['srok'] = $itd['srok']; + } + if ($itm['srok'] > 0) { + echo '
    Срок годности: ' . timeOut($itm['srok']); + } -$t = $items['tr']; -$x = 0; -while($x 0) { + $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . ((int)$itm['magic_inci']) . '" LIMIT 1')); + if (isset($efi['id2']) && $efi['actionTime'] > 0) { + echo '
    Продолжительность действия: ' . timeOut($efi['actionTime']); + } + } -if($tr != '') { - echo '
    Требуется минимальное:'.$tr; -} -/* действует на */ -$tr = ''; + /* требования */ + $tr = ''; -$t = $items['add']; -$x = 0; -while($x'головы',2=>'корпуса',3=>'пояса',4=>'ног'); - while($i<=4) - { - if(isset($itd['add_mab'.$i]) && $itd['add_mab'.$i]>0) - { - if($itd['add_mab'.$i]==$itd['add_mib'.$i]) - { - $z = '+'; - if($itd['add_mab'.$i]<0) - { - $z = ''; - } - $tr .= '
    • Броня '.$bn[$i].': '.$z.''.$itd['add_mab'.$i]; - }else{ - $tr .= '
    • Броня '.$bn[$i].': '.$itd['add_mib'.$i].'-'.$itd['add_mab'.$i]; - } - } - $i++; - } -if($tr != '') { - echo '
    Действует на:'.$tr; -} -/* свойства предмета */ -$tr = ''; + if ($tr != '') { + echo '
    Требуется минимальное:' . $tr; + } - if(isset($itd['sv_yron_min'],$itd['sv_yron_max'])) - { - $tr .= '
    • Урон: '.$itd['sv_yron_min'].' - '.$itd['sv_yron_max']; - } - $x = 0; - while($x0) - { - $x = 1; - while($x<=$itd['zonb']) - { - $tr .= '+'; - $x++; - } - }else{ - $tr .= '—'; - } - } + /* действует на */ + $tr = ''; -if($tr != '') { - echo '
    Свойства предмета:'.$tr; -} + $t = $items['add']; + $x = 0; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($itd['add_' . $n]) && isset($is[$n])) { + $z = '+'; + if ($itd['add_' . $n] < 1) { + $z = ''; + } + $tr .= '
    • ' . $is[$n] . ': ' . $z . $itd['add_' . $n]; + } + $x++; + } -/* особенности */ -$tr = ''; + //действует на (броня) + $i = 1; + $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; + while ($i <= 4) { + if (isset($itd['add_mab' . $i]) && $itd['add_mab' . $i] > 0) { + if ($itd['add_mab' . $i] == $itd['add_mib' . $i]) { + $z = '+'; + if ($itd['add_mab' . $i] < 0) { + $z = ''; + } + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $z . '' . $itd['add_mab' . $i]; + } else { + $tr .= '
    • Броня ' . $bn[$i] . ': ' . $itd['add_mib' . $i] . '-' . $itd['add_mab' . $i]; + } + } + $i++; + } + if ($tr != '') { + echo '
    Действует на:' . $tr; + } + /* свойства предмета */ + $tr = ''; - $x = 1; - while($x<=4) - { - if(isset($itd['tya'.$x]) && $itd['tya'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tya'.$x]>6) - { - $tyc = 'Редки'; - } - if($itd['tya'.$x]>14) - { - $tyc = 'Малы'; - } - if($itd['tya'.$x]>34) - { - $tyc = 'Временами'; - } - if($itd['tya'.$x]>79) - { - $tyc = 'Регулярны'; - } - if($itd['tya'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tya'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tya'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x<=7) - { - if(isset($itd['tym'.$x]) && $itd['tym'.$x]>0) - { - $tyc = 'Ничтожно редки'; - if($itd['tym'.$x]>6) - { - $tyc = 'Редки'; - } - if($itd['tym'.$x]>14) - { - $tyc = 'Малы'; - } - if($itd['tym'.$x]>34) - { - $tyc = 'Временами'; - } - if($itd['tym'.$x]>79) - { - $tyc = 'Регулярны'; - } - if($itd['tym'.$x]>89) - { - $tyc = 'Часты'; - } - if($itd['tym'.$x]>=100) - { - $tyc = 'Всегда'; - } - $tr .= '
    • '.$is['tym'.$x].': '.$tyc; - } - $x++; - } - $x = 1; - while($x <= 4) - { - if(isset($itd['add_oza'.$x]) && $itd['add_oza'.$x]>0) - { - $tyc = 'Слабая'; - if($itd['add_oza'.$x] == 4) - { - $tyc = 'Посредственная'; - } - if($itd['add_oza'.$x] == 2) - { - $tyc = 'Нормальная'; - } - if($itd['add_oza'.$x] == 3) - { - $tyc = 'Хорошая'; - } - if($itd['add_oza'.$x] == 5) - { - $tyc = 'Великолепная'; - } - if($tyc != '') { - $tr .= '
    • '.$is['oza'.$x].': '.$tyc; - } - } - $x++; - } - if(isset($itd['free_stats']) && $itd['free_stats']>0){ - echo '
    Свободные распределения:
    • Возможных распределений: '.$itd['free_stats']; - } -if($tr != '') { - echo '
    Особенности:'.$tr; -} - $is2 = ''; + if (isset($itd['sv_yron_min'], $itd['sv_yron_max'])) { + $tr .= '
    • Урон: ' . $itd['sv_yron_min'] . ' - ' . $itd['sv_yron_max']; + } + $x = 0; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($itd['sv_' . $n])) { + $z = '+'; + if ($itd['sv_' . $n] < 0) { + $z = ''; + } + $tr .= '
    • ' . $is[$n] . ': ' . $z . '' . $itd['sv_' . $n]; + } + $x++; + } + if ($itm['2too'] == 1) { + $tr .= '
    • Второе оружие'; + } + if ($itm['2h'] == 1) { + $tr .= '
    • Двуручное оружие'; + } + if (isset($itd['zonb'])) { + $tr .= '
    • Зоны блокирования: '; + if ($itd['zonb'] > 0) { + $x = 1; + while ($x <= $itd['zonb']) { + $tr .= '+'; + $x++; + } + } else { + $tr .= '—'; + } + } - if(isset($itd['complect'])) - { - $is2 .= '
    Дополнительная информация:'; - } - if(isset($itd['complect'])) - { - //не отображается - $com1 = array('name'=>'Неизвестный Комплект','x'=>0,'text'=>''); - $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "'.$itd['complect'].'" ORDER BY `x` ASC LIMIT 20'); - while($itmc = mysql_fetch_array($spc)) - { - $com1['name'] = $itmc['name']; - $com1['text'] .= '    • '.$itmc['x'].': '; - //действие комплекта - $i1c = 0; $i2c = 0; - $i1e = lookStats($itmc['data']); - while($i1c0) - { - $i3c = '+'.$i3c; - } - if($i2c>0) - { - $com1['text'] .= '    '.$is[$items['add'][$i1c]].': '.$i3c; - }else{ - $com1['text'] .= $is[$items['add'][$i1c]].': '.$i3c; - } - $com1['text'] .= '
    '; - $i2c++; - } - $i1c++; - } - unset($i1c,$i2c,$i3c); - $com1['x']++; - } - $is2 .= '
    • Часть комплекта: '.$com1['name'].'
    '; - $is2 .= $com1['text']; - $is2 .= ''; - } - - $is2 .= ''; - - if($itm['info']!='') - { - $is2 .= '
    Описание:
    '.$itm['info'].'
    '; - } - - if(isset($itd['info']) && $itd['info']!='') - { - $is2 .= '
    '.$itd['info'].'
    '; - } - - if(isset($itm['use_text']) && $itm['max_text']-$itm['use_text'] > 0) { - $is2 .= '
    Количество символов: '.($itm['max_text']-$itm['use_text']).'
    '; - } - - if(isset($itd['noremont']) && $itd['noremont']>0) - { - $is2 .= '
    Предмет не подлежит ремонту
    '; - } - - if(isset($itd['frompisher']) && $itd['frompisher']>0) - { - $is2 .= '
    Предмет из подземелья
    '; - } - - if(isset($itm['dn_delete']) && $itm['dn_delete']>0) - { - $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; - } - - $is2 .= '
    '; - -echo $is2; + if ($tr != '') { + echo '
    Свойства предмета:' . $tr; + } -?> -
    - 0) { + $tyc = 'Ничтожно редки'; + if ($itd['tya' . $x] > 6) { + $tyc = 'Редки'; + } + if ($itd['tya' . $x] > 14) { + $tyc = 'Малы'; + } + if ($itd['tya' . $x] > 34) { + $tyc = 'Временами'; + } + if ($itd['tya' . $x] > 79) { + $tyc = 'Регулярны'; + } + if ($itd['tya' . $x] > 89) { + $tyc = 'Часты'; + } + if ($itd['tya' . $x] >= 100) { + $tyc = 'Всегда'; + } + $tr .= '
    • ' . $is['tya' . $x] . ': ' . $tyc; + } + $x++; + } + $x = 1; + while ($x <= 7) { + if (isset($itd['tym' . $x]) && $itd['tym' . $x] > 0) { + $tyc = 'Ничтожно редки'; + if ($itd['tym' . $x] > 6) { + $tyc = 'Редки'; + } + if ($itd['tym' . $x] > 14) { + $tyc = 'Малы'; + } + if ($itd['tym' . $x] > 34) { + $tyc = 'Временами'; + } + if ($itd['tym' . $x] > 79) { + $tyc = 'Регулярны'; + } + if ($itd['tym' . $x] > 89) { + $tyc = 'Часты'; + } + if ($itd['tym' . $x] >= 100) { + $tyc = 'Всегда'; + } + $tr .= '
    • ' . $is['tym' . $x] . ': ' . $tyc; + } + $x++; + } + $x = 1; + while ($x <= 4) { + if (isset($itd['add_oza' . $x]) && $itd['add_oza' . $x] > 0) { + $tyc = 'Слабая'; + if ($itd['add_oza' . $x] == 4) { + $tyc = 'Посредственная'; + } + if ($itd['add_oza' . $x] == 2) { + $tyc = 'Нормальная'; + } + if ($itd['add_oza' . $x] == 3) { + $tyc = 'Хорошая'; + } + if ($itd['add_oza' . $x] == 5) { + $tyc = 'Великолепная'; + } + if ($tyc != '') { + $tr .= '
    • ' . $is['oza' . $x] . ': ' . $tyc; + } + } + $x++; + } + if (isset($itd['free_stats']) && $itd['free_stats'] > 0) { + echo '
    Свободные распределения:
    • Возможных распределений: ' . $itd['free_stats']; + } + if ($tr != '') { + echo '
    Особенности:' . $tr; + } + $is2 = ''; + + if (isset($itd['complect'])) { + $is2 .= '
    Дополнительная информация:'; + } + if (isset($itd['complect'])) { + //не отображается + $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; + $spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "' . $itd['complect'] . '" ORDER BY `x` ASC LIMIT 20'); + while ($itmc = mysql_fetch_array($spc)) { + $com1['name'] = $itmc['name']; + $com1['text'] .= '    • ' . $itmc['x'] . ': '; + //действие комплекта + $i1c = 0; + $i2c = 0; + $i1e = lookStats($itmc['data']); + while ($i1c < count($items['add'])) { + if (isset($i1e[$items['add'][$i1c]])) { + $i3c = $i1e[$items['add'][$i1c]]; + if ($i3c > 0) { + $i3c = '+' . $i3c; + } + if ($i2c > 0) { + $com1['text'] .= '    ' . $is[$items['add'][$i1c]] . ': ' . $i3c; + } else { + $com1['text'] .= $is[$items['add'][$i1c]] . ': ' . $i3c; + } + $com1['text'] .= '
    '; + $i2c++; + } + $i1c++; + } + unset($i1c, $i2c, $i3c); + $com1['x']++; + } + $is2 .= '
    • Часть комплекта: ' . $com1['name'] . '
    '; + $is2 .= $com1['text']; + $is2 .= ''; + } + + $is2 .= ''; + + if ($itm['info'] != '') { + $is2 .= '
    Описание:
    ' . $itm['info'] . '
    '; + } + + if (isset($itd['info']) && $itd['info'] != '') { + $is2 .= '
    ' . $itd['info'] . '
    '; + } + + if (isset($itm['use_text']) && $itm['max_text'] - $itm['use_text'] > 0) { + $is2 .= '
    Количество символов: ' . ($itm['max_text'] - $itm['use_text']) . '
    '; + } + + if (isset($itd['noremont']) && $itd['noremont'] > 0) { + $is2 .= '
    Предмет не подлежит ремонту
    '; + } + + if (isset($itd['frompisher']) && $itd['frompisher'] > 0) { + $is2 .= '
    Предмет из подземелья
    '; + } + + if (isset($itm['dn_delete']) && $itm['dn_delete'] > 0) { + $is2 .= '
    Предмет будет удален при выходе из подземелья
    '; + } + + $is2 .= '
    '; + + echo $is2; + + ?> +
    + Требуется минимальное:
    • Уровень: 4
    • Выносливость: 16
    • Сила: 16
    Действует на:
    • Мф. увертывания (%): +30
    • Интуиция: +3
    • Сила: +5
    @@ -1199,97 +1570,116 @@ echo $is2; Возможно усиление до 10го уровня
    */ -?>
    <?=$itm['name']?>
    + ?>
    <?= $itm['name'] ?>
    +
    + +

     

    +
    +

    + +

        
    - -

     

    -
    -

    - -

        
    - - - - Предметы
    - - - - - - -

    - Амуниция
    -    · Костыли 
    -    · Эликсиры и еда 
    - Заклинания
    -    · Заклинания 
    - Одежда
    -    · Тяжелая броня 
    -    · Легкая броня 
    -    · Венки 
    -    · Наручи 
    -    · Обувь 
    -    · Перчатки 
    -    · Плащи 
    -    · Поножи 
    -    · Пояса 
    -    · Рубахи 
    -    · Шлемы 
    - Оружие
    -    · Ёлки 
    -    · Дубины 
    -    · Кинжалы 
    -    · Мечи 
    -    · Топоры 
    -    · Посохи 
    -    · Цветы и Букеты 
    - Разное
    -    · Компоненты 
    -    · Магические предметы 
    -    · Подарки 
    -    · Руны 
    -    · Прочие предметы 
    - Щиты
    -    · Щиты 
    - Ювелирные товары
    -    · Кольца 
    -    · Ожерелья 
    -    · Серьги 
    -


    - - -
     
    - +
    + + + + Предметы
    + + + + + + +
    +
    + Амуниция
    +    · Костыли 
    +    · Эликсиры и еда 
    + Заклинания
    +    · Заклинания 
    + Одежда
    +    · Тяжелая броня 
    +    · Легкая броня 
    +    · Венки 
    +    · Наручи 
    +    · Обувь 
    +    · Перчатки 
    +    · Плащи 
    +    · Поножи 
    +    · Пояса 
    +    · Рубахи 
    +    · Шлемы 
    + Оружие
    +    · Ёлки 
    +    · Дубины 
    +    · Кинжалы 
    +    · Мечи 
    +    · Топоры 
    +    · Посохи 
    +    · Цветы и Букеты 
    + Разное
    +    · Компоненты 
    +    · Магические предметы 
    +    · Подарки 
    +    · Руны 
    +    · Прочие предметы 
    + Щиты
    +    · Щиты 
    + Ювелирные товары
    +    · Кольца 
    +    · Ожерелья 
    +    · Серьги 
    +


    + + +
     
    + - - - - - - - - + + + + + + + +
    -  -
    Copyright © «www.new-combats.com»

    +
    +   +
    +
    +
    + Copyright © «www.new-combats.com» +

    +
    diff --git a/jx/battle/log_text.php b/jx/battle/log_text.php index 91c22808..0ea2fb1c 100644 --- a/jx/battle/log_text.php +++ b/jx/battle/log_text.php @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/jx/battle/refresh.php b/jx/battle/refresh.php index 81680b2d..bec13767 100644 --- a/jx/battle/refresh.php +++ b/jx/battle/refresh.php @@ -12,8 +12,7 @@ if (!isset($CRON_CORE)) { if (isset($_GET['cron_core'])) { function getIPblock() { - if (isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; - return $_SERVER['REMOTE_ADDR']; + return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR']; } } @@ -24,17 +23,27 @@ if (!isset($CRON_CORE)) { function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date('H:i:s') . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity","INFINITY","6","1","-1")'); + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity","INFINITY","6","1","-1")' + ); } if (isset($_GET['cron_core'])) { $id = [ 'id' => $_GET['uid'], - 'pass' => $_GET['pass'] + 'pass' => $_GET['pass'], ]; if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) { - $uzr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string($id['id']) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1')); + $uzr = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $id['id'] + ) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1' + ) + ); if (isset($uzr['id'])) { $CRON_CORE = true; $_COOKIE['login'] = $uzr['login']; @@ -54,247 +63,249 @@ if (!isset($CRON_CORE)) { header('Content-Type: text/html; charset=windows-1251'); } -if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) { - if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem'])) { - if (isset($_POST['useitemon'])) { - $_POST['useitemon'] = iconv('UTF-8', 'windows-1251', $_POST['useitemon']); - } +if (($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) && (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem']))) { + if (isset($_POST['useitemon'])) { + $_POST['useitemon'] = iconv('UTF-8', 'windows-1251', $_POST['useitemon']); + } - unset($tm); - $js = ''; - require_once('../../_incl_data/class/__user.php'); - require_once('../../_incl_data/class/__magic.php'); - require_once('../../_incl_data/class/_cron_.php'); - require_once('../../_incl_data/class/__quest.php'); - - if ($u->info['battle'] == 0) { - $btl_last = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1')); - if (isset($btl_last['id']) && $u->info['battle'] == 0) { - echo ''; - $u->info['battle'] = $btl_last['id']; - $u->info['battle_lsto'] = true; - mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); - echo ''; - } - } - - if (!isset($CRON_CORE)) { - if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP'])) { - die($c['exit']); - } - } - - function json_fix_cyr($json_str) - { - return $json_str; - } - - $u->stats = $u->getStats($u->info['id'], 0); - - if (!isset($CRON_CORE)) { - if ($u->info['online'] < time() - 30) { - mysql_query("UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"); - } - } - - require_once('../../_incl_data/class/__battle.php'); - require_once('log_text.php'); - $btl->is = $u->is; - $btl->items = $u->items; - $btl->info = $btl->battleInfo($u->info['battle']); - if (!isset($btl->info['id'])) { - if ($u->info['battle'] == -1) { - //завершаем поединок - $upd = mysql_query('UPDATE `users` SET `battle` = "0",`online` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - if (!$upd) { - if (!isset($CRON_CORE)) { - die('Ошибка завершения поединка.'); - } - } else { - echo ''; - } - } else { - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'); - if (!isset($CRON_CORE)) { - die(''); - } - } - } else { - //получаем массив с игроками в бою - $btl->teamsTake(); - - if (isset($_POST['useitem']) && $btl->testUsersLive() == true) { - $magic->useItems((int)$_POST['useitem']); - if ($u->error != '') { - echo '
    ' . $u->error . '
    '; - } - } - - //заносим удары,приемы,эффекты и т.д. - //удар - if (isset($_POST['atack']) && isset($_POST['block'])) { - $btl->addAtack(); - } - //прием - if (isset($_POST['usepriem']) && $btl->testUsersLive() == true && isset($btl->users[$btl->uids[$u->info['enemy']]])) { - $priem->pruse($_POST['usepriem']); - } - //используем заклятие / пирожки - - - //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) - $btl->testActions(); - //} - //авто-смена противника, либо просто смена противника - if ($u->stats['hpNow'] >= 1) { - //ручная смена - if (isset($_POST['smn']) && $_POST['smn'] != 'none') { - /* ---------------- */ - $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); - $uidz = mysql_fetch_array(mysql_query('SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['smn']) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1')); - if ($uidz['inUser'] > 0) { - $uidz['id'] = $uidz['inUser']; - } - $rsm = $btl->smena($uidz['id'], false); - if ($rsm != 1) { - echo '
    ' . $rsm . '
    '; - } - unset($rsm); - $js .= 'smena_login = \'none\';'; - } - //авто-смена - if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - $btl->autoSmena(); - } - } else { - $btl->mainStatus = 3; - } - - //получаем данные о поединке - - //получаем данные о логе боя - - //Если бой сыгран - завершаем - if (!isset($_POST['usepriem'])) { - if ($btl->info['team_win'] == -1) { - $btl->testFinish(); - } else { - $btl->testFinish(); - } - } - if ($btl->info['team_win'] == -1) { - $js .= $btl->genTeams($u->info['id']); - } else { - $btl->mainStatus = 3; - $btl->e = $u->btl_txt; - } - - if ($btl->info['id'] == $u->info['lider']) { - $js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();'; - } else { - $js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();'; - } - - if (!isset($CRON_CORE)) { - $js .= $btl->myInfo($u->info['id'], 1); - //выводим данные - if ($btl->e != '') { - echo '
    ' . $btl->e . '
    '; - } - if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - if ($u->info['hpNow'] >= 1) { - $btl->mainStatus = 2; - } - } else { - if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { - $js .= $btl->myInfo($u->info['enemy'], 2); - } - } - if ($btl->info['izlom'] > 0) { - $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; - } - $i = 1; - while ($i <= 7) { - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; - } - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; - } - $i++; - } - $atk1 = 0; - if (!isset($CRON_CORE)) { - $rsys = $u->sys_see(0); - } - if ($rsys != '') { - $js .= $rsys; - } - unset($rsys); - if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { - $atk1 = 1; - } - } - - $rehtml = ''; - if (!isset($CRON_CORE)) { - $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; - //if(!isset($_POST['usepriem'])) { - $jslog = ''; - if ($u->info['design'] == 0) { - } else { - $jslog .= $btl->lookmLog(); - } - - $jslog .= $btl->lookLog(); - if ($jslog != '') { - $js = $jslog . $js; - } - unset($jslog); - - $tmr = round(($btl->info['timeout'] / 60), 2); - - - $dtxtn = ''; - - $rehtml .= ''; - - echo($rehtml); - - if ($btl->cached == true) { - $btl->clear_cache_start(); - } - - unset($atk1); - } - echo ''; + unset($tm); + $js = ''; + $u = User::start(); + $magic = new Magic(); + $priem = new Priems(); + if ($u->info['battle'] == 0) { + $btl_last = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' + ) + ); + if (isset($btl_last['id']) && $u->info['battle'] == 0) { + echo ''; + $u->info['battle'] = $btl_last['id']; + $u->info['battle_lsto'] = true; + mysql_query( + 'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); + echo ''; } } + + if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) { + die($c['exit']); + } + + function json_fix_cyr($json_str) + { + return $json_str; + } + + $u->stats = $u->getStats($u->info['id'], 0); + + if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); + } + + $btl = new Battle(); + require_once('log_text.php'); + $btl->is = $u->is; + $btl->items = $u->items; + $btl->info = $btl->battleInfo($u->info['battle']); + if (!isset($btl->info['id'])) { + if ($u->info['battle'] == -1) { + //завершаем поединок + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "0",`online` = "' . time( + ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + if (!$upd) { + if (!isset($CRON_CORE)) { + die('Ошибка завершения поединка.'); + } + } else { + echo ''; + } + } else { + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'); + if (!isset($CRON_CORE)) { + die(''); + } + } + } else { + //получаем массив с игроками в бою + $btl->teamsTake(); + + if (isset($_POST['useitem']) && $btl->testUsersLive()) { + $magic->useItems((int)$_POST['useitem']); + if ($u->error != '') { + echo '
    ' . $u->error . '
    '; + } + } + + //заносим удары,приемы,эффекты и т.д. + //удар + if (isset($_POST['atack']) && isset($_POST['block'])) { + $btl->addAtack(); + } + //прием + if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) { + $priem->pruse($_POST['usepriem']); + } + //используем заклятие / пирожки + + + //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) + $btl->testActions(); + //авто-смена противника, либо просто смена противника + if ($u->stats['hpNow'] >= 1) { + //ручная смена + if (isset($_POST['smn']) && $_POST['smn'] != 'none') { + /* ---------------- */ + $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); + $uidz = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $_POST['smn'] + ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' + ) + ); + if ($uidz['inUser'] > 0) { + $uidz['id'] = $uidz['inUser']; + } + $rsm = $btl->smena($uidz['id'], false); + if ($rsm != 1) { + echo '
    ' . $rsm . '
    '; + } + unset($rsm); + $js .= 'smena_login = \'none\';'; + } + //авто-смена + if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + $btl->autoSmena(); + } + } else { + $btl->mainStatus = 3; + } + + //получаем данные о поединке + + //получаем данные о логе боя + + //Если бой сыгран - завершаем + if (!isset($_POST['usepriem'])) { + $btl->testFinish(); + } + if ($btl->info['team_win'] == -1) { + $js .= $btl->genTeams($u->info['id']); + } else { + $btl->mainStatus = 3; + $btl->e = $u->btl_txt; + } + + if ($btl->info['id'] == $u->info['lider']) { + $js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();'; + } else { + $js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();'; + } + + if (!isset($CRON_CORE)) { + $js .= $btl->myInfo($u->info['id'], 1); + //выводим данные + if ($btl->e != '') { + echo '
    ' . $btl->e . '
    '; + } + if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + if ($u->info['hpNow'] >= 1) { + $btl->mainStatus = 2; + } + } else { + if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { + $js .= $btl->myInfo($u->info['enemy'], 2); + } + } + if ($btl->info['izlom'] > 0) { + $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + } + $i = 1; + while ($i <= 7) { + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; + } + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; + } + $i++; + } + $atk1 = 0; + $rsys = $u->sys_see(0); + if ($rsys != '') { + $js .= $rsys; + } + unset($rsys); + if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { + $atk1 = 1; + } + } + + $rehtml = ''; + if (!isset($CRON_CORE)) { + $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; + $jslog = ''; + if ($u->info['design'] != 0) { + $jslog .= $btl->lookmLog(); + } + + $jslog .= $btl->lookLog(); + if ($jslog != '') { + $js = $jslog . $js; + } + unset($jslog); + + $tmr = round(($btl->info['timeout'] / 60), 2); + + + $dtxtn = ''; + + $rehtml .= ''; + + echo($rehtml); + + if ($btl->cached) { + $btl->clear_cache_start(); + } + + unset($atk1); + } + echo ''; + + } } diff --git a/jx/battle/refresh_bot.php b/jx/battle/refresh_bot.php index dcd34667..e4d8bc23 100644 --- a/jx/battle/refresh_bot.php +++ b/jx/battle/refresh_bot.php @@ -1,259 +1,237 @@ '.$_SERVER['SERVER_ADDR']); -} -*/ - -define('GAME',true); +const GAME = true; require_once('../../_incl_data/class/__db_connect.php'); -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","-NIGHTmare-","6","1","-1")'); -} - -if(isset($_GET['cron_core'])) { - $id = array( - 'id' => $_GET['uid'], - 'pass' => $_GET['pass'] - ); - if(md5($id['id'].'_brfCOreW@!_'.$id['pass']) == $_GET['cron_core']) { - $uzr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "'.mysql_real_escape_string($id['id']).'" AND `pass` = "'.mysql_real_escape_string($id['pass']).'" LIMIT 1')); - if(isset($uzr['id'])) { - $CRON_CORE = true; - $_COOKIE['login'] = $uzr['login']; - $_COOKIE['pass'] = $uzr['pass']; - $_POST['id'] = 'reflesh'; - - - if(isset($_GET['atack'])) { - $_POST['atack'] = $_GET['atack']; - } - if(isset($_GET['block'])) { - $_POST['block'] = $_GET['block']; - } - if(isset($_GET['usepriem'])) { - $_POST['usepriem'] = $_GET['usepriem']; - } - if(isset($_GET['useitem'])) { - $_POST['useitem'] = $_GET['useitem']; - } - - } - unset($uzr); - } -} - -if(isset($CRON_CORE)) +function e($t) { - - if(isset($_POST['atack'],$_POST['block']) || (isset($_POST['id']) && $_POST['id']=='reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem'])) - { - if(isset($_POST['useitemon'])) { - $_POST['useitemon'] = iconv('UTF-8', 'windows-1251', $_POST['useitemon']); - } - //`session_start(); - $tm = microtime(); - $tm = explode(' ',$tm); - $tm = $tm[0]+$tm[1]; - - if(!isset($CRON_CORE)) { - require_once('../../_incl_data/__config.php'); - if($_SESSION['tbr']>$tm) - { - die(''); - }else{ - $_SESSION['tbr'] = $tm+0.350; - } - } - - unset($tm); - $js = ''; - require_once('../../_incl_data/class/__user.php'); - require_once('../../_incl_data/class/__magic.php'); - require_once('../../_incl_data/class/_cron_.php'); - require_once('../../_incl_data/class/__quest.php'); - - if(!isset($CRON_CORE)) { - if(!isset($u->info['id']) || ($u->info['joinIP']==1 && $u->info['ip']!=$_SERVER['HTTP_X_REAL_IP'])) - { - die($c['exit']); - } - } - - $u->stats = $u->getStats($u->info['id'],0); - - if(!isset($CRON_CORE)) { - if($u->info['online']is = $u->is; - $btl->items = $u->items; - $btl->info = $btl->battleInfo($u->info['battle']); - if(!isset($btl->info['id'])) - { - if($u->info['battle']==-1) - { - //завершаем поединок - $upd = mysql_query('UPDATE `users` SET `battle` = "0",`online` = "'.time().'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if(!$upd) - { - if(!isset($CRON_CORE)) { - die('Ошибка завершения поединка.'); - } - }else{ - echo ''; - } - }else{ - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$u->info['battle'].'" LIMIT 100'); - if(!isset($CRON_CORE)) { - die(''); - } - } - }else{ - //получаем массив с игроками в бою - $btl->teamsTake(); - - if(isset($_POST['useitem'])) { - $magic->useItems((int)$_POST['useitem']); - if($u->error!='') { - echo '
    '.$u->error.'
    '; - } - } - - //заносим удары,приемы,эффекты и т.д. - //удар - if(isset($_POST['atack']) && isset($_POST['block'])) - { - $btl->addAtack(); - } - //прием - if(isset($_POST['usepriem'])) - { - $priem->pruse($_POST['usepriem']); - } - //используем заклятие / пирожки - - - //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) - $btl->testActions(); - //авто-смена противника, либо просто смена противника - if($u->stats['hpNow']>=1) - { - //ручная смена - if(isset($_POST['smn']) && $_POST['smn']!='none') - { - /* ---------------- */ - $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); - $uidz = mysql_fetch_array(mysql_query('SELECT `id`,`inUser` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['smn']).'" AND `battle` = "'.$u->info['battle'].'" LIMIT 1')); - if($uidz['inUser']>0) - { - $uidz['id'] = $uidz['inUser']; - } - $rsm = $btl->smena($uidz['id'],false); - if($rsm!=1) - { - echo '
    '.$rsm.'
    '; - } - unset($rsm); - $js .= 'smena_login = \'none\';'; - } - //авто-смена - if($u->info['enemy']==0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow']<=0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) - { - $btl->autoSmena(); - } - }else{ - $btl->mainStatus = 3; - } - //получаем данные о поединке - - //получаем данные о логе боя - - //Если бой сыгран - завершаем - if($btl->info['team_win']==-1) - { - $btl->testFinish(); - }else{ - $btl->testFinish(); - } - if($btl->info['team_win']==-1) - { - $js .= $btl->genTeams($u->info['id']); - }else{ - $btl->mainStatus = 3; - $btl->e = $u->btl_txt; - } - - if(!isset($CRON_CORE)) { - $js .= $btl->myInfo($u->info['id'],1); - //выводим данные - if($btl->e!='') - { - echo '
    '.$btl->e.'
    '; - } - if(isset($btl->ga[$u->info['id']][$u->info['enemy']])) - { - if($u->info['hpNow']>=1) { - $btl->mainStatus = 2; - } - }else{ - if($u->info['enemy']!=0 && $btl->info['team_win']==-1 && $u->info['hpNow']>=1) - { - $js .= $btl->myInfo($u->info['enemy'],2); - } - } - if($btl->info['izlom']>0) - { - $js .= 'volna('.(1+$btl->info['izlomRoundSee']).');'; - } - $i = 1; - while($i<=7) - { - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$i]<0) - { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$i] = 0; - } - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$i]>25 && $i<7) - { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$i] = 25; - } - $i++; - } - $atk1 = 0; - if(!isset($CRON_CORE)) {$rsys = $u->sys_see(0);} - if($rsys != '') { - $js .= $rsys; - } - unset($rsys); - if(isset($btl->ga[$u->info['enemy']][$u->info['id']])) - { - $atk1 = 1; - } - } - - if( $btl->cached == true ) { - $btl->clear_cache_start(); - } - /* - echo ''; - */ - } - } + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ' (Критическая ошибка): ' . mysql_real_escape_string( + $t + ) . '","capitalcity","-NIGHTmare-","6","1","-1")' + ); +} + +if (isset($_GET['cron_core'])) { + $id = [ + 'id' => $_GET['uid'], + 'pass' => $_GET['pass'], + ]; + if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) { + $uzr = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $id['id'] + ) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1' + ) + ); + if (isset($uzr['id'])) { + $CRON_CORE = true; + $_COOKIE['login'] = $uzr['login']; + $_COOKIE['pass'] = $uzr['pass']; + $_POST['id'] = 'reflesh'; + + + if (isset($_GET['atack'])) { + $_POST['atack'] = $_GET['atack']; + } + if (isset($_GET['block'])) { + $_POST['block'] = $_GET['block']; + } + if (isset($_GET['usepriem'])) { + $_POST['usepriem'] = $_GET['usepriem']; + } + if (isset($_GET['useitem'])) { + $_POST['useitem'] = $_GET['useitem']; + } + + } + unset($uzr); + } +} + +if (isset($CRON_CORE) && (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem']))) { + if (isset($_POST['useitemon'])) { + $_POST['useitemon'] = iconv('UTF-8', 'windows-1251', $_POST['useitemon']); + } + //`session_start(); + $tm = microtime(); + $tm = explode(' ', $tm); + $tm = $tm[0] + $tm[1]; + + if (!isset($CRON_CORE)) { + require_once('../../_incl_data/__config.php'); + if ($_SESSION['tbr'] > $tm) { + die(''); + } else { + $_SESSION['tbr'] = $tm + 0.350; + } + } + + unset($tm); + $js = ''; + $u = User::start(); + $magic = new Magic(); + $priem = new Priems(); + + if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) { + die($c['exit']); + } + + $u->stats = $u->getStats($u->info['id'], 0); + + if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); + } + $btl = new Battle(); + require_once('log_text.php'); + $btl->is = $u->is; + $btl->items = $u->items; + $btl->info = $btl->battleInfo($u->info['battle']); + if (!isset($btl->info['id'])) { + if ($u->info['battle'] == -1) { + //завершаем поединок + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "0",`online` = "' . time( + ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + if (!$upd) { + if (!isset($CRON_CORE)) { + die('Ошибка завершения поединка.'); + } + } else { + echo ''; + } + } else { + mysql_query( + 'UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100' + ); + if (!isset($CRON_CORE)) { + die(''); + } + } + } else { + //получаем массив с игроками в бою + $btl->teamsTake(); + + if (isset($_POST['useitem'])) { + $magic->useItems((int)$_POST['useitem']); + if ($u->error != '') { + echo '
    ' . $u->error . '
    '; + } + } + + //заносим удары,приемы,эффекты и т.д. + //удар + if (isset($_POST['atack']) && isset($_POST['block'])) { + $btl->addAtack(); + } + //прием + if (isset($_POST['usepriem'])) { + $priem->pruse($_POST['usepriem']); + } + //используем заклятие / пирожки + + + //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) + $btl->testActions(); + //авто-смена противника, либо просто смена противника + if ($u->stats['hpNow'] >= 1) { + //ручная смена + if (isset($_POST['smn']) && $_POST['smn'] != 'none') { + /* ---------------- */ + $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); + $uidz = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $_POST['smn'] + ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' + ) + ); + if ($uidz['inUser'] > 0) { + $uidz['id'] = $uidz['inUser']; + } + $rsm = $btl->smena($uidz['id'], false); + if ($rsm != 1) { + echo '
    ' . $rsm . '
    '; + } + unset($rsm); + $js .= 'smena_login = \'none\';'; + } + //авто-смена + if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + $btl->autoSmena(); + } + } else { + $btl->mainStatus = 3; + } + //получаем данные о поединке + + //получаем данные о логе боя + + //Если бой сыгран - завершаем + $btl->testFinish(); + if ($btl->info['team_win'] == -1) { + $js .= $btl->genTeams($u->info['id']); + } else { + $btl->mainStatus = 3; + $btl->e = $u->btl_txt; + } + + if (!isset($CRON_CORE)) { + $js .= $btl->myInfo($u->info['id'], 1); + //выводим данные + if ($btl->e != '') { + echo '
    ' . $btl->e . '
    '; + } + if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + if ($u->info['hpNow'] >= 1) { + $btl->mainStatus = 2; + } + } else { + if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { + $js .= $btl->myInfo($u->info['enemy'], 2); + } + } + if ($btl->info['izlom'] > 0) { + $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + } + $i = 1; + while ($i <= 7) { + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; + } + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; + } + $i++; + } + $atk1 = 0; + $rsys = $u->sys_see(0); + if ($rsys != '') { + $js .= $rsys; + } + unset($rsys); + if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { + $atk1 = 1; + } + } + + if ($btl->cached) { + $btl->clear_cache_start(); + } + + } } -//unlink($lock_file); -?> \ No newline at end of file diff --git a/jx/battle/refresh_vip.php b/jx/battle/refresh_vip.php index 783c12d0..ade1da18 100644 --- a/jx/battle/refresh_vip.php +++ b/jx/battle/refresh_vip.php @@ -2,309 +2,263 @@ die(); -if(!isset($CRON_CORE)) { - define('GAME',true); - require_once('../../_incl_data/class/__db_connect.php'); -} - -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","INFINITY","6","1","-1")'); +if (!isset($CRON_CORE)) { + define('GAME', true); + require_once('../../_incl_data/class/__db_connect.php'); } -if(isset($_GET['cron_core'])) { - $id = array( - 'id' => $_GET['uid'], - 'pass' => $_GET['pass'] - ); - if(md5($id['id'].'_brfCOreW@!_'.$id['pass']) == $_GET['cron_core']) { - $uzr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "'.mysql_real_escape_string($id['id']).'" AND `pass` = "'.mysql_real_escape_string($id['pass']).'" LIMIT 1')); - if(isset($uzr['id'])) { - $CRON_CORE = true; - $_COOKIE['login'] = $uzr['login']; - $_COOKIE['pass'] = $uzr['pass']; - $_POST['id'] = 'reflesh'; - } - unset($uzr); - } -} - -if(!isset($CRON_CORE)) { - header( 'Expires: Mon, 26 Jul 1970 05:00:00 GMT' ); - header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); - header( 'Cache-Control: no-store, no-cache, must-revalidate' ); - header( 'Cache-Control: post-check=0, pre-check=0', false ); - header( 'Pragma: no-cache' ); - header( 'Content-Type: text/html; charset=windows-1251' ); - /*$lock_file = 'lock/battle_'.$_SERVER['HTTP_X_REAL_IP'].'.'.$_COOKIE['auth'].'.bk2'; - if ( !file_exists($lock_file) ) { - //$fp_lock = fopen($lock_file, 'w'); - //flock($fp_lock, LOCK_EX); - } else { - //unlink($lock_file); - //die('
    Не удалось отправить запрос, повторите попытку снова...
    '); - }*/ -} - -if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) +function e($t) { - if(isset($_POST['atack'],$_POST['block']) || (isset($_POST['id']) && $_POST['id']=='reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem'])) - { - if(isset($_POST['useitemon'])) { - $_POST['useitemon'] = iconv('UTF-8', 'windows-1251', $_POST['useitemon']); - } - session_start(); - $tm = microtime(); - $tm = explode(' ',$tm); - $tm = $tm[0]+$tm[1]; - - if(!isset($CRON_CORE)) { - require_once('../../_incl_data/__config.php'); - if($_SESSION['tbr']>$tm) - { - die(''); - }else{ - $_SESSION['tbr'] = $tm+0.350; - } - } - - unset($tm); - $js = ''; - require_once('../../_incl_data/class/__user.php'); - require_once('../../_incl_data/class/__magic.php'); - require_once('../../_incl_data/class/_cron_.php'); - require_once('../../_incl_data/class/__quest.php'); - - if(!isset($CRON_CORE)) { - if(!isset($u->info['id']) || ($u->info['joinIP']==1 && $u->info['ip']!=$_SERVER['HTTP_X_REAL_IP'])) - { - die($c['exit']); - } - } - - function json_fix_cyr($json_str) { - /* $cyr_chars = array ( - '\u0430' => 'а', '\u0410' => 'А', - '\u0431' => 'б', '\u0411' => 'Б', - '\u0432' => 'в', '\u0412' => 'В', - '\u0433' => 'г', '\u0413' => 'Г', - '\u0434' => 'д', '\u0414' => 'Д', - '\u0435' => 'е', '\u0415' => 'Е', - '\u0451' => 'ё', '\u0401' => 'Ё', - '\u0436' => 'ж', '\u0416' => 'Ж', - '\u0437' => 'з', '\u0417' => 'З', - '\u0438' => 'и', '\u0418' => 'И', - '\u0439' => 'й', '\u0419' => 'Й', - '\u043a' => 'к', '\u041a' => 'К', - '\u043b' => 'л', '\u041b' => 'Л', - '\u043c' => 'м', '\u041c' => 'М', - '\u043d' => 'н', '\u041d' => 'Н', - '\u043e' => 'о', '\u041e' => 'О', - '\u043f' => 'п', '\u041f' => 'П', - '\u0440' => 'р', '\u0420' => 'Р', - '\u0441' => 'с', '\u0421' => 'С', - '\u0442' => 'т', '\u0422' => 'Т', - '\u0443' => 'у', '\u0423' => 'У', - '\u0444' => 'ф', '\u0424' => 'Ф', - '\u0445' => 'х', '\u0425' => 'Х', - '\u0446' => 'ц', '\u0426' => 'Ц', - '\u0447' => 'ч', '\u0427' => 'Ч', - '\u0448' => 'ш', '\u0428' => 'Ш', - '\u0449' => 'щ', '\u0429' => 'Щ', - '\u044a' => 'ъ', '\u042a' => 'Ъ', - '\u044b' => 'ы', '\u042b' => 'Ы', - '\u044c' => 'ь', '\u042c' => 'Ь', - '\u044d' => 'э', '\u042d' => 'Э', - '\u044e' => 'ю', '\u042e' => 'Ю', - '\u044f' => 'я', '\u042f' => 'Я', - - '\r' => '', - '\n' => '
    ', - '\t' => '' - ); - foreach ($cyr_chars as $cyr_char_key => $cyr_char) { - $json_str = str_replace($cyr_char_key, $cyr_char, $json_str); - } */ - return $json_str; - } - - $u->stats = $u->getStats($u->info['id'],0); - - if(!isset($CRON_CORE)) { - if($u->info['online']is = $u->is; - $btl->items = $u->items; - $btl->info = $btl->battleInfo($u->info['battle']); - if(!isset($btl->info['id'])) - { - if($u->info['battle']==-1) - { - //завершаем поединок - $upd = mysql_query('UPDATE `users` SET `battle` = "0",`online` = "'.time().'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if(!$upd) - { - if(!isset($CRON_CORE)) { - die('Ошибка завершения поединка.'); - } - }else{ - echo ''; - } - }else{ - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$u->info['battle'].'" LIMIT 100'); - if(!isset($CRON_CORE)) { - die(''); - } - } - }else{ - //получаем массив с игроками в бою - $btl->teamsTake(); - - if(isset($_POST['useitem'])) { - $magic->useItems((int)$_POST['useitem']); - if($u->error!='') { - echo '
    '.$u->error.'
    '; - } - } - - //заносим удары,приемы,эффекты и т.д. - //удар - if(isset($_POST['atack']) && isset($_POST['block'])) - { - $btl->addAtack(); - } - //прием - if(isset($_POST['usepriem'])) - { - $priem->pruse($_POST['usepriem']); - } - //используем заклятие / пирожки - - - //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) - //if(!isset($_POST['usepriem'])) { - $btl->testActions(); - //} - //авто-смена противника, либо просто смена противника - if($u->stats['hpNow']>=1) - { - //ручная смена - if(isset($_POST['smn']) && $_POST['smn']!='none') - { - /* ---------------- */ - $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); - $uidz = mysql_fetch_array(mysql_query('SELECT `id`,`inUser` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['smn']).'" AND `battle` = "'.$u->info['battle'].'" LIMIT 1')); - if($uidz['inUser']>0) - { - $uidz['id'] = $uidz['inUser']; - } - $rsm = $btl->smena($uidz['id'],false); - if($rsm!=1) - { - echo '
    '.$rsm.'
    '; - } - unset($rsm); - $js .= 'smena_login = \'none\';'; - } - //авто-смена - if($u->info['enemy']==0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow']<=0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) - { - $btl->autoSmena(); - } - }else{ - $btl->mainStatus = 3; - } - //получаем данные о поединке - - //получаем данные о логе боя - - //Если бой сыгран - завершаем - if(!isset($_POST['usepriem'])) { - if($btl->info['team_win']==-1) - { - $btl->testFinish(); - }else{ - $btl->testFinish(); - } - } - if($btl->info['team_win']==-1) - { - $js .= $btl->genTeams($u->info['id']); - }else{ - $btl->mainStatus = 3; - $btl->e = $u->btl_txt; - } - - if(!isset($CRON_CORE)) { - $js .= $btl->myInfo($u->info['id'],1); - //выводим данные - if($btl->e!='') - { - echo '
    '.$btl->e.'
    '; - } - if(isset($btl->ga[$u->info['id']][$u->info['enemy']])) - { - if($u->info['hpNow']>=1) { - $btl->mainStatus = 2; - } - }else{ - if($u->info['enemy']!=0 && $btl->info['team_win']==-1 && $u->info['hpNow']>=1) - { - $js .= $btl->myInfo($u->info['enemy'],2); - } - } - if($btl->info['izlom']>0) - { - $js .= 'volna('.(1+$btl->info['izlomRoundSee']).');'; - } - $i = 1; - while($i<=7) - { - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$i]<0) - { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$i] = 0; - } - if($btl->users[$btl->uids[$u->info['id']]]['tactic'.$i]>25 && $i<7) - { - $btl->users[$btl->uids[$u->info['id']]]['tactic'.$i] = 25; - } - $i++; - } - $atk1 = 0; - if(!isset($CRON_CORE)) {$rsys = $u->sys_see(0);} - if($rsys != '') { - $js .= $rsys; - } - unset($rsys); - if(isset($btl->ga[$u->info['enemy']][$u->info['id']])) - { - $atk1 = 1; - } - } - $rehtml = ''; - if(!isset($CRON_CORE)) { - $js .= '$("#priems").html("'.$priem->seeMy(2).'");'; - //if(!isset($_POST['usepriem'])) { - $js .= $btl->lookLog(); - //} - $rehtml .= ''); + } else { + $_SESSION['tbr'] = $tm + 0.350; + } + } + + unset($tm); + $js = ''; + $u = User::start(); + $magic = new Magic(); + $priem = new Priems(); + + if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) { + die($c['exit']); + } + + function json_fix_cyr($json_str) + { + return $json_str; + } + + $u->stats = $u->getStats($u->info['id'], 0); + + if (!isset($CRON_CORE)) { + if ($u->info['online'] < time() - 30) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); + } + } + $btl = new Battle(); + require_once('log_text.php'); + $btl->is = $u->is; + $btl->items = $u->items; + $btl->info = $btl->battleInfo($u->info['battle']); + if (!isset($btl->info['id'])) { + if ($u->info['battle'] == -1) { + //завершаем поединок + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "0",`online` = "' . time( + ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + if (!$upd) { + if (!isset($CRON_CORE)) { + die('Ошибка завершения поединка.'); + } + } else { + echo ''; + } + } else { + mysql_query( + 'UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100' + ); + if (!isset($CRON_CORE)) { + die(''); + } + } + } else { + //получаем массив с игроками в бою + $btl->teamsTake(); + + if (isset($_POST['useitem'])) { + $magic->useItems((int)$_POST['useitem']); + if ($u->error != '') { + echo '
    ' . $u->error . '
    '; + } + } + + //заносим удары,приемы,эффекты и т.д. + //удар + if (isset($_POST['atack']) && isset($_POST['block'])) { + $btl->addAtack(); + } + //прием + if (isset($_POST['usepriem'])) { + $priem->pruse($_POST['usepriem']); + } + //используем заклятие / пирожки + + + //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) + //if(!isset($_POST['usepriem'])) { + $btl->testActions(); + //} + //авто-смена противника, либо просто смена противника + if ($u->stats['hpNow'] >= 1) { + //ручная смена + if (isset($_POST['smn']) && $_POST['smn'] != 'none') { + /* ---------------- */ + $_POST['smn'] = iconv('UTF-8', 'windows-1251', $_POST['smn']); + $uidz = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $_POST['smn'] + ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' + ) + ); + if ($uidz['inUser'] > 0) { + $uidz['id'] = $uidz['inUser']; + } + $rsm = $btl->smena($uidz['id'], false); + if ($rsm != 1) { + echo '
    ' . $rsm . '
    '; + } + unset($rsm); + $js .= 'smena_login = \'none\';'; + } + //авто-смена + if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + $btl->autoSmena(); + } + } else { + $btl->mainStatus = 3; + } + //получаем данные о поединке + + //получаем данные о логе боя + + //Если бой сыгран - завершаем + if (!isset($_POST['usepriem'])) { + if ($btl->info['team_win'] == -1) { + $btl->testFinish(); + } else { + $btl->testFinish(); + } + } + if ($btl->info['team_win'] == -1) { + $js .= $btl->genTeams($u->info['id']); + } else { + $btl->mainStatus = 3; + $btl->e = $u->btl_txt; + } + + if (!isset($CRON_CORE)) { + $js .= $btl->myInfo($u->info['id'], 1); + //выводим данные + if ($btl->e != '') { + echo '
    ' . $btl->e . '
    '; + } + if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + if ($u->info['hpNow'] >= 1) { + $btl->mainStatus = 2; + } + } else { + if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { + $js .= $btl->myInfo($u->info['enemy'], 2); + } + } + if ($btl->info['izlom'] > 0) { + $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + } + $i = 1; + while ($i <= 7) { + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; + } + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; + } + $i++; + } + $atk1 = 0; + if (!isset($CRON_CORE)) { + $rsys = $u->sys_see(0); + } + if ($rsys != '') { + $js .= $rsys; + } + unset($rsys); + if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { + $atk1 = 1; + } + } + $rehtml = ''; + if (!isset($CRON_CORE)) { + $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; + //if(!isset($_POST['usepriem'])) { + $js .= $btl->lookLog(); + //} + $rehtml .= ''; - - echo ($rehtml); - - if( $btl->cached == true ) { - $btl->clear_cache_start(); - } - - unset($atk1); - } - echo ''; - } - } + + echo($rehtml); + + if ($btl->cached == true) { + $btl->clear_cache_start(); + } + + unset($atk1); + } + echo ''; + } + } } //unlink($lock_file); ?> \ No newline at end of file diff --git a/jx/dungeon.php b/jx/dungeon.php index 68f456a6..3c4e59a6 100644 --- a/jx/dungeon.php +++ b/jx/dungeon.php @@ -1,241 +1,255 @@ top.xxx='.((int)$_POST['gox']).';top.yyy='.((int)$_POST['goy']).';top.xn='.((int)$_POST['gox']).';top.yn='.((int)$_POST['goy']).';'; - $_POST['x'] = $_POST['gox']; - $_POST['y'] = $_POST['goy']; - } - $u->info['x'] = 0+(int)$_POST['x']; - $u->info['y'] = 0+(int)$_POST['y']; - $dn['id2'] = (int)$_POST['ddid']; - //бой с ботом - function addBot($isd,$col,$dt) - { - global $u,$c,$code; - $vrs = explode('&',$dt); - $vr = array(); - $k = 0; - while($kinfo['admin']>0) - { - //Админка - $act = explode('|$|',$_POST['action']); - if($act[0]=='save_go') - { - $act = explode('|!|',$act[1]); - $mx = $act[0]; - $my = $act[1]; - $mpx = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$dn['id2'].'" AND `x`='.mysql_real_escape_string($mx).' AND `y`='.mysql_real_escape_string($my).' LIMIT 1')); - if(isset($mpx['id'])) - { - $i = 2; - while($i<=10) - { - if($act[$i]=='true') - { - $act[$i] = 1; - }else{ - $act[$i] = 0; - } - $i++; - } - mysql_query('UPDATE `dungeon_map` SET - `go_1` = "'.mysql_real_escape_string($act[2]).'", - `go_2` = "'.mysql_real_escape_string($act[3]).'", - `go_3` = "'.mysql_real_escape_string($act[4]).'", - `go_4` = "'.mysql_real_escape_string($act[5]).'", - `go_5` = "'.mysql_real_escape_string($act[6]).'", - `no_bot` = "'.mysql_real_escape_string($act[7]).mysql_real_escape_string($act[8]).mysql_real_escape_string($act[9]).mysql_real_escape_string($act[10]).'" - WHERE `id` = "'.$mpx['id'].'" LIMIT 1'); - $js .= 'closeAdminion();'; - } - }elseif($act[0]=='select_image') - { - //смена изображения клетки - $act = explode('|!|',$act[1]); - $img = $act[0]; - $mx = $act[1]; - $my = $act[2]; - $mpx = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$dn['id2'].'" AND `x`='.mysql_real_escape_string($mx).' AND `y`='.mysql_real_escape_string($my).' LIMIT 1')); - if(isset($mpx['id'])) - { - $mpx['style'] = $img; - $cx = array(0=>'1111', - 1=>'1110', - 2=>'1011', - 3=>'1101', - 4=>'0111', - 5=>'1100', - 6=>'0110', - 7=>'1001', - 8=>'0011', - 9=>'0001', - 10=>'0100', - 11=>'0010', - 12=>'1000', - 13=>'1010', - 14=>'0101', - 15=>'0000', - 16=>''); - mysql_query('UPDATE `dungeon_map` SET `style` = "'.mysql_real_escape_string($mpx['style']).'", `st` = "'.mysql_real_escape_string($cx[$mpx['style']]).'" WHERE `id` = "'.$mpx['id'].'" LIMIT 1'); - $js .= 'closeAdminion();'; - }else{ - //создаем клетку - $go1 = 0; - $go2 = 0; - $go3 = 0; - $go4 = 0; - $go5 = 1; - - $cx = array(0=>'00000', - 1=>'00001', - 2=>'10001', - 3=>'01001', - 4=>'00011', - 5=>'00101', - 6=>'10011', - 7=>'10101', - 8=>'01011', - 9=>'01101', - 10=>'01111', - 11=>'10111', - 12=>'11101', - 13=>'11011', - 14=>'11001', - 15=>'00111', - 16=>'11111'); - - - $go1 = $cx[$img+1][0]; - $go2 = $cx[$img+1][1]; - $go3 = $cx[$img+1][2]; - $go4 = $cx[$img+1][3]; - $go5 = $cx[$img+1][4]; - - $cx = array(0=>'1111', - 1=>'1110', - 2=>'1011', - 3=>'1101', - 4=>'0111', - 5=>'1100', - 6=>'0110', - 7=>'1001', - 8=>'0011', - 9=>'0001', - 10=>'0100', - 11=>'0010', - 12=>'1000', - 13=>'1010', - 14=>'0101', - 15=>'0000', - 16=>''); +if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && isset($_POST['id'])) { + define('GAME', true); + include_once('../_incl_data/__config.php'); + include_once('../_incl_data/class/__db_connect.php'); + $u = User::start(); + if (isset($_POST['gox']) && isset($_POST['goy'])) { + echo 'Переходим на: X = ' . $_POST['gox'] . ', Y = ' . $_POST['goy'] . ''; + $_POST['x'] = $_POST['gox']; + $_POST['y'] = $_POST['goy']; + } + $u->info['x'] = 0 + (int)$_POST['x']; + $u->info['y'] = 0 + (int)$_POST['y']; + $dn['id2'] = (int)$_POST['ddid']; + //бой с ботом + function addBot($isd, $col, $dt) + { + global $u, $c, $code; + $vrs = explode('&', $dt); + $vr = []; + $k = 0; + while ($k < count($vrs)) { + $ex = explode('=', $vrs[$k]); + $vr[$ex[0]] = $ex[1]; + $k++; + } + } - $ins = mysql_query('INSERT INTO `dungeon_map` (`st`,`go_1`,`go_2`,`go_3`,`go_4`,`go_5`,`id_dng`,`x`,`y`,`style`) VALUES ("'.$cx[$img][0].$cx[$img][1].$cx[$img][2].$cx[$img][3].'","'.$go1.'","'.$go2.'","'.$go3.'","'.$go4.'","'.$go5.'","'.$dn['id2'].'","'.mysql_real_escape_string($mx).'","'.mysql_real_escape_string($my).'","'.mysql_real_escape_string($img).'")'); - if(!$ins) - { - echo 'Ошибка создания части лабиринта'; - } - } - }elseif($act[0]=='delete') - { - //Удаляем клетку - $act = explode('|!|',$act[1]); - $mx = $act[0]; - $my = $act[1]; - $mpx = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$dn['id2'].'" AND `x`='.mysql_real_escape_string($mx).' AND `y`='.mysql_real_escape_string($my).' LIMIT 1')); - if(isset($mpx['id'])) - { - mysql_query('DELETE FROM `dungeon_map` WHERE `id` = "'.$mpx['id'].'" LIMIT 1;'); - $js .= 'closeAdminion();'; - } - } - - } + $md5 = 0; + $map = ''; + $obj = ''; + $objd = ''; + $usr = ''; + $js = ''; + $gg = 0; - $x = $u->info['x']; - $y = $u->info['y']; - - //генерируем карту - - $fmd5 = ''; - - //пользователи - - //координаты игрока - $fmd5 .= $x.'_'.$y.'='; - $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$dn['id2'].'" AND ((`x`<='.($x+5).' AND `x`>='.($x-5).') AND (`y`<='.($y+4).' AND `y`>='.($y-4).')) LIMIT 100'); - while($pl = mysql_fetch_array($sp)) - { - $map .= $pl['id'].'='.$pl['x'].'='.$pl['y'].'='.$pl['style'].'='.$pl['go'].'='.$pl['go_1'].'='.$pl['go_2'].'='.$pl['go_3'].'='.$pl['go_4'].'='.$pl['go_5'].'='.$pl['no_bot'][0].'='.$pl['no_bot'][1].'='.$pl['no_bot'][2].'='.$pl['no_bot'][3].'|'; - $fmd5 .= $pl['id'].'='; - } - $map .= 'end'; - - //предметы на клетке - $itms = ''; - $sp = mysql_query('SELECT * FROM `dungeon_items` WHERE `dn` = "'.$dn['id'].'" AND `x` = "'.$x.'" AND `y` = "'.$y.'" AND `take` = "0" LIMIT 100'); - while($pl = mysql_fetch_array($sp)) - { - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$pl['item_id'].'" LIMIT 1')); - if(isset($itm['id'])) - { - $itms .= ''; - $fmd5 .= $pl['id'].'='; - } - } - - if($itms!='') - { - $itms = '
    Предметы в локации:

    '.$itms; - $js .= 'document.getElementById(\'items\').innerHTML = "'.$itms.'";'; - }else{ - $js .= 'document.getElementById(\'items\').innerHTML = "";'; - } - - $fmd5 = md5($fmd5); - if($fmd5!=$_POST['mdf']) - { - //обновляем данные - echo ''; - }else{ - //изменений нет - - } - } + $pix = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . ((int)$_POST['ddid']) . '" AND `x`=' . $u->info['x'] . ' AND `y`=' . $u->info['y'] . ' LIMIT 1' + ) + ); + if (isset($_POST['adminion']) && $u->info['admin'] > 0) { + //Админка + $act = explode('|$|', $_POST['action']); + if ($act[0] == 'save_go') { + $act = explode('|!|', $act[1]); + $mx = $act[0]; + $my = $act[1]; + $mpx = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dn['id2'] . '" AND `x`=' . mysql_real_escape_string( + $mx + ) . ' AND `y`=' . mysql_real_escape_string($my) . ' LIMIT 1' + ) + ); + if (isset($mpx['id'])) { + $i = 2; + while ($i <= 10) { + if ($act[$i] == 'true') { + $act[$i] = 1; + } else { + $act[$i] = 0; + } + $i++; + } + mysql_query( + 'UPDATE `dungeon_map` SET + `go_1` = "' . mysql_real_escape_string($act[2]) . '", + `go_2` = "' . mysql_real_escape_string($act[3]) . '", + `go_3` = "' . mysql_real_escape_string($act[4]) . '", + `go_4` = "' . mysql_real_escape_string($act[5]) . '", + `go_5` = "' . mysql_real_escape_string($act[6]) . '", + `no_bot` = "' . mysql_real_escape_string($act[7]) . mysql_real_escape_string( + $act[8] + ) . mysql_real_escape_string($act[9]) . mysql_real_escape_string($act[10]) . '" + WHERE `id` = "' . $mpx['id'] . '" LIMIT 1' + ); + $js .= 'closeAdminion();'; + } + } elseif ($act[0] == 'select_image') { + //смена изображения клетки + $act = explode('|!|', $act[1]); + $img = $act[0]; + $mx = $act[1]; + $my = $act[2]; + $mpx = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dn['id2'] . '" AND `x`=' . mysql_real_escape_string( + $mx + ) . ' AND `y`=' . mysql_real_escape_string($my) . ' LIMIT 1' + ) + ); + if (isset($mpx['id'])) { + $mpx['style'] = $img; + $cx = [0 => '1111', + 1 => '1110', + 2 => '1011', + 3 => '1101', + 4 => '0111', + 5 => '1100', + 6 => '0110', + 7 => '1001', + 8 => '0011', + 9 => '0001', + 10 => '0100', + 11 => '0010', + 12 => '1000', + 13 => '1010', + 14 => '0101', + 15 => '0000', + 16 => '']; + mysql_query( + 'UPDATE `dungeon_map` SET `style` = "' . mysql_real_escape_string( + $mpx['style'] + ) . '", `st` = "' . mysql_real_escape_string( + $cx[$mpx['style']] + ) . '" WHERE `id` = "' . $mpx['id'] . '" LIMIT 1' + ); + $js .= 'closeAdminion();'; + } else { + //создаем клетку + $go1 = 0; + $go2 = 0; + $go3 = 0; + $go4 = 0; + $go5 = 1; + + $cx = [0 => '00000', + 1 => '00001', + 2 => '10001', + 3 => '01001', + 4 => '00011', + 5 => '00101', + 6 => '10011', + 7 => '10101', + 8 => '01011', + 9 => '01101', + 10 => '01111', + 11 => '10111', + 12 => '11101', + 13 => '11011', + 14 => '11001', + 15 => '00111', + 16 => '11111']; + + + $go1 = $cx[$img + 1][0]; + $go2 = $cx[$img + 1][1]; + $go3 = $cx[$img + 1][2]; + $go4 = $cx[$img + 1][3]; + $go5 = $cx[$img + 1][4]; + + $cx = [0 => '1111', + 1 => '1110', + 2 => '1011', + 3 => '1101', + 4 => '0111', + 5 => '1100', + 6 => '0110', + 7 => '1001', + 8 => '0011', + 9 => '0001', + 10 => '0100', + 11 => '0010', + 12 => '1000', + 13 => '1010', + 14 => '0101', + 15 => '0000', + 16 => '']; + + $ins = mysql_query( + 'INSERT INTO `dungeon_map` (`st`,`go_1`,`go_2`,`go_3`,`go_4`,`go_5`,`id_dng`,`x`,`y`,`style`) VALUES ("' . $cx[$img][0] . $cx[$img][1] . $cx[$img][2] . $cx[$img][3] . '","' . $go1 . '","' . $go2 . '","' . $go3 . '","' . $go4 . '","' . $go5 . '","' . $dn['id2'] . '","' . mysql_real_escape_string( + $mx + ) . '","' . mysql_real_escape_string($my) . '","' . mysql_real_escape_string($img) . '")' + ); + if (!$ins) { + echo 'Ошибка создания части лабиринта'; + } + } + } elseif ($act[0] == 'delete') { + //Удаляем клетку + $act = explode('|!|', $act[1]); + $mx = $act[0]; + $my = $act[1]; + $mpx = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dn['id2'] . '" AND `x`=' . mysql_real_escape_string( + $mx + ) . ' AND `y`=' . mysql_real_escape_string($my) . ' LIMIT 1' + ) + ); + if (isset($mpx['id'])) { + mysql_query('DELETE FROM `dungeon_map` WHERE `id` = "' . $mpx['id'] . '" LIMIT 1;'); + $js .= 'closeAdminion();'; + } + } + + } + + $x = $u->info['x']; + $y = $u->info['y']; + + //генерируем карту + + $fmd5 = ''; + + //пользователи + + //координаты игрока + $fmd5 .= $x . '_' . $y . '='; + $sp = mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dn['id2'] . '" AND ((`x`<=' . ($x + 5) . ' AND `x`>=' . ($x - 5) . ') AND (`y`<=' . ($y + 4) . ' AND `y`>=' . ($y - 4) . ')) LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $map .= $pl['id'] . '=' . $pl['x'] . '=' . $pl['y'] . '=' . $pl['style'] . '=' . $pl['go'] . '=' . $pl['go_1'] . '=' . $pl['go_2'] . '=' . $pl['go_3'] . '=' . $pl['go_4'] . '=' . $pl['go_5'] . '=' . $pl['no_bot'][0] . '=' . $pl['no_bot'][1] . '=' . $pl['no_bot'][2] . '=' . $pl['no_bot'][3] . '|'; + $fmd5 .= $pl['id'] . '='; + } + $map .= 'end'; + + //предметы на клетке + $itms = ''; + $sp = mysql_query( + 'SELECT * FROM `dungeon_items` WHERE `dn` = "' . $dn['id'] . '" AND `x` = "' . $x . '" AND `y` = "' . $y . '" AND `take` = "0" LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $itm = mysql_fetch_array( + mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '" LIMIT 1') + ); + if (isset($itm['id'])) { + $itms .= ''; + $fmd5 .= $pl['id'] . '='; + } + } + + if ($itms != '') { + $itms = '
    Предметы в локации:

    ' . $itms; + $js .= 'document.getElementById(\'items\').innerHTML = "' . $itms . '";'; + } else { + $js .= 'document.getElementById(\'items\').innerHTML = "";'; + } + + $fmd5 = md5($fmd5); + if ($fmd5 != $_POST['mdf']) { + //обновляем данные + echo ''; + } } -?> \ No newline at end of file diff --git a/jx/post.php b/jx/post.php index c13f8fec..1da8dd4e 100644 --- a/jx/post.php +++ b/jx/post.php @@ -1,37 +1,28 @@ top.location = \'https://'.$c['host'].'/\';'); - }else{ - if(isset($_POST['act'])) - { - $post = telegram::start(); - if($_POST['act']=='read') - { - $post->readMsg(mysql_real_escape_string($_POST['msg']),$u['id']); - }elseif($_POST['act']=='lock') - { - $post->lockMsg(mysql_real_escape_string($_POST['msg']),$u['id']); - }elseif($_POST['act']=='delete') - { - $post->deleteMsg(mysql_real_escape_string($_POST['msg']),$u['id'],$_POST['pageGo']); - }elseif($_POST['act']=='deleteAll') - { - $post->deleteMsgAll($u['id'],$_POST['pageGo']); - }elseif($_POST['act']=='page') - { - $post->seeMsg($u['id'],$_POST['msg'],5); - } - } - } +if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { + define('GAME', true); + include_once('../_incl_data/__config.php'); + include_once('../_incl_data/class/__db_connect.php'); + + + $u = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login`="' . mysql_real_escape_string($_COOKIE['login']) . '" AND `pass`="' . mysql_real_escape_string($_COOKIE['pass']) . '" LIMIT 1')); + if (!isset($u['id']) || ($u['joinIP'] == 1 && $u['ip'] != $_SERVER['HTTP_X_REAL_IP'])) { + die(''); + } else { + if (isset($_POST['act'])) { + $post = Telegram::start(); + if ($_POST['act'] == 'read') { + $post->readMsg(mysql_real_escape_string($_POST['msg']), $u['id']); + } elseif ($_POST['act'] == 'lock') { + $post->lockMsg(mysql_real_escape_string($_POST['msg']), $u['id']); + } elseif ($_POST['act'] == 'delete') { + $post->deleteMsg(mysql_real_escape_string($_POST['msg']), $u['id'], $_POST['pageGo']); + } elseif ($_POST['act'] == 'deleteAll') { + $post->deleteMsgAll($u['id'], $_POST['pageGo']); + } elseif ($_POST['act'] == 'page') { + $post->seeMsg($u['id'], $_POST['msg'], 5); + } + } + } } -?> \ No newline at end of file diff --git a/logs.php b/logs.php index d0c1121d..17ec6010 100644 --- a/logs.php +++ b/logs.php @@ -1,451 +1,473 @@ = 50000 && $x < 100000 ) { - $r = array(25,50,'Великая Битва','Кровавая Битва'); - }elseif( $x < 500000 ) { - $r = array(50,75,'Величайшая Битва','Кровавая Резня'); - }elseif( $x < 1000000 ) { - $r = array(75,100,'Историческая Битва','Кровавая Сеча'); - }elseif( $x < 2500000 ) { - $r = array(100,125,'Эпохальная Битва','Кровавое Побоище'); - }elseif( $x >= 5000000 ) { - $r = array(150,150,'Судный День','Судный День'); - } - return $r; - } - $allprice = typeBattle($allprice); - if ($btl['smert'] == 1) - { - $allprice = array(150,150,'Жесточайшее Сражение','Жесточайшее Сражение'); - } - if( $btl['type'] == 99 ) { - $allprice = ''.str_replace(' ',' ',$allprice[3]).''; - }else{ - $allprice = str_replace(' ',' ',$allprice[2]); - } +if (isset($btl['id'])) { + $allprice = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $btl['id'] . '" GROUP BY `uid` LIMIT 1' + ) + ); + $allprice = 0 + $allprice[0]; + function typeBattle($x) + { + $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок']; + if ($x < 50000) { + //Обычный бой + } elseif ($x >= 50000 && $x < 100000) { + $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; + } elseif ($x < 500000) { + $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; + } elseif ($x < 1000000) { + $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; + } elseif ($x < 2500000) { + $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; + } elseif ($x >= 5000000) { + $r = [150, 150, 'Судный День', 'Судный День']; + } + return $r; + } + + $allprice = typeBattle($allprice); + if ($btl['smert'] == 1) { + $allprice = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; + } + if ($btl['type'] == 99) { + $allprice = '' . str_replace(' ', ' ', $allprice[3]) . ''; + } else { + $allprice = str_replace(' ', ' ', $allprice[2]); + } } $fil = 'Поиск :
    '; -$r = ''; $p = ''; $b = ' +$r = ''; +$p = ''; +$b = '
    '; //nowrap="" -if($btl['team_win'] != -1) { - if(!isset($_GET['analiz'])) { - $b .= ' '; - $b .= $fil; - }else{ - $b .= ' '; - } +if ($btl['team_win'] != -1) { + if (!isset($_GET['analiz'])) { + $b .= ' '; + $b .= $fil; + } else { + $b .= ' '; + } } $b .= '
    '; -if(isset($btl['id']) && $btl['team_win'] != -1 && isset($_GET['analiz'])) { - - function rzv($v) - { - $v = explode('.',$v); - if(!isset($v[1])) - { - $v = $v[0].'.0'; - }else{ - $v = $v[0].'.'.$v[1]; - } - return $v; - } - $tmStart = floor(($btl['time_over']-$btl['time_start'])/6)/10; - $tmStart = rzv($tmStart); - $tbtl = ''; - if( $btl['invis'] > 0 ) { - $tbtl .= ''; - } - if($btl['type'] == 0) { - $tbtl = 'Тип боя: '.$tbtl.' (физический поединок)     '; - }elseif($btl['type'] == 1) { - $tbtl = 'Тип боя: '.$tbtl.' (кулачный поединок)     '; - }else{ - $tbtl = 'Тип боя: '.$tbtl.' (физический поединок)     '; - } - - if( $btl['izlom'] > 0 ) { - $tbtl .= 'Волна: '.$btl['izlomRoundSee'].'     '; - } - - $tbtl .= 'Продолжительность боя: '.$tmStart.' мин.
    '; - - $users = array( +if (isset($btl['id']) && $btl['team_win'] != -1 && isset($_GET['analiz'])) { - ); - - $uids = array( - - ); - - function con_login($us) { - $r = ''; - if( $us['align'] > 0 ) { - $r .= ''; - } - if( $us['clan'] > 0 ) { - $r .= ''; - } - $r .= ''.$us['login'].' ['.$us['level'].']'; - $r .= ''; - return $r; - } - - //Поулчаем инфо - $tpas = array( - 1 => 'X', - 2 => '', - 3 => '', - 4 => '¤', - 5 => 'X', - 6 => '', - 7 => '', - 8 => '' - ); - /*$tpbs = array( - 0 => 'X', - 1 => 'X', - 2 => '', - 3 => '', - 4 => 'X', - 5 => '', - 6 => '', - 7 => '', - 8 => '' - );*/ - $tpbs = array( - 0 => '', - 1 => '', - 2 => '', - 3 => 'X', - 4 => 'X', - 5 => '', - 6 => '', - 7 => '', - 8 => '' - ); - $sp = mysql_query('SELECT * FROM `battle_users` WHERE `battle` = "'.$btl['id'].'"'); - while($pl = mysql_fetch_array($sp)) { - if(!isset($uids[$pl['id']])) { - $i = count($users); - $users[$i] = $pl; - $uids[$pl['uid']] = $i; - // - $users[$i]['value'] = array( - 'y' => 0, //уворотов+парирований+блоков щитом - 'b' => 0, //успешных блоков - 'p' => 0, //не успешных блоков, по персонажу попали - 'zb' => array( //Список зон блока - - ), - 'sa' => array( //Статистика ударов - 0 => '', - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 5 => '' - ), - 'sb' => array( //Статистика блоков - 0 => '', - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 5 => '' - ) - ); - $sp2 = mysql_query('SELECT * FROM `battle_stat` WHERE `battle` = "'.$btl['id'].'" AND `uid1` = "'.$pl['uid'].'" ORDER BY `id` ASC'); - while($pl2 = mysql_fetch_array($sp2)) { - //Обновляем данные - $users[$i]['yrn'] += $pl2['yrn']; - $users[$i]['yrn_krit'] += $pl2['yrn_krit']; - //Статистика далее - $users[$i]['gaa']++; - if( $users[$i]['yrn'] > 0 ) { - $users[$i]['ga']++; - } - if( $users[$i]['yrn_krit'] > 0 ) { - $users[$i]['gak']++; - } - //Получаем куда бил игрок - $j = 0; - while($j < $pl2['ma']) { - $users[$i]['zona'][$pl2['a'][$j]]++; - // - $za = $pl2['a'][$j]; - $k = 1; - while($k <= 5) { - if( $za == $k ) { - $tpa = $pl2['type_a'][$j]; - $zag[$k] = true; - $users[$i]['value']['sa'][$k] .= $tpas[$tpa]; - }else{ - $zag[$k] = false; - //$users[$i]['value']['sa'][$za] .= '.'; - } - $k++; - } - // - $j++; - } - $j = $pl2['b']; - $k = 0; - while($k < $pl2['mb']) { - if( $j > 5 ) { - $j = 1; - } - $users[$i]['value']['zb'][] = array( 0 => $j , 1 => 0 ); - $users[$i]['zonb'][$j]++; - $j++; - $k++; - } - // - $k = 1; - while($k <= 5) { - if( $zag[$k] == false ) { - $users[$i]['value']['sa'][$k] .= ' '; - } - $k++; - } - // - } - // - $sp2 = mysql_query('SELECT * FROM `battle_stat` WHERE `battle` = "'.$btl['id'].'" AND `uid2` = "'.$pl['uid'].'" ORDER BY `id` ASC'); - $k = 0; - while($pl2 = mysql_fetch_array($sp2)) { - //Обновляем данные - $users[$i]['_yrn'] -= $pl2['yrn']; - $users[$i]['_yrn_krit'] -= $pl2['yrn_krit']; - //Получаем куда били игрока - $j = 0; $zag = array(); - while($j < $pl2['ma']) { - $users[$i]['value']['zb'][$k][1] = $pl2['type_a'][$j]; - if( $pl2['type_a'][$j] == 2 || $pl2['type_a'][$j] == 6 || $pl2['type_a'][$j] == 7 || $pl2['type_a'][$j] == 8 ) { - $users[$i]['value']['y']++; - }elseif( $pl2['type_a'][$j] == 3 ) { - $users[$i]['value']['b']++; - }else{ - $users[$i]['value']['p']++; - } - // - $j++; - } - // - $k++; - // - } - //Статистика блоков - $k = 0; - $h = 0; - $bjj = array(); - while( $k < count($users[$i]['value']['zb']) ) { - $zb = 0+$users[$i]['value']['zb'][$k][0]; - $zt = 0+$users[$i]['value']['zb'][$k][1]; - $bjj[$zb] = true; - $users[$i]['value']['sb'][$zb] .= ''.$tpbs[$zt].''; - if( $h < 1 ) { - $h++; - }else{ - $d = 1; - while($d <= 5) { - if( $bjj[$d] == true ) { - - }else{ - $users[$i]['value']['sb'][$d] .= ' '; - } - $d++; - } - $bjj = array(); - $h = 0; - } - $k++; - } - // - } - } - - $usr = ''; - $tm = array(); - $tm_u = array(); - $tm_v = array(); - - $i = 0; - while($i < count($users)) { - if( $users[$i] > 0 ) { - $us = $users[$i]; - if( !isset($tm[$us['team']]) ) { - $tm[$us['team']] = ''; - $tm_v[] = $us['team']; - } - $tm_u[$us['team']][] = $i; - $tm[$us['team']] .= con_login($us); - $tm[$us['team']] .= ', '; - unset($us); - } - $i++; - } - $i = 0; - while($i < count($tm_v)) { - $usr .= rtrim($tm[$tm_v[$i]],', '); - if( $i < count($tm_v)-1 ) { - $usr .= '   против   '; - } - $i++; - } - // - $usr = '

    Участники поединка

    '.$usr.'

    '; - // - $r = ''; - // - $r .= '

    Последовательность ударов

    '; - $r .= ' -'; - $i = 0; - while($i <= count($tm_v)) { - $j = 0; - $team_data = array( 'g' => false ); - while($j < count($tm_u[$tm_v[$i]])) { - $us = $users[$tm_u[$tm_v[$i]][$j]]; - if($us['id'] > 0) { - $rh = ''; - $rh .= ''.$us['value']['sa'][1].''; - $rh .= '
    '.$us['value']['sa'][2].''; - $rh .= '
    '.$us['value']['sa'][3].''; - $rh .= '
    '.$us['value']['sa'][4].''; - $rh .= '
    '.$us['value']['sa'][5].''; - $r .= ''; - } - unset($us); - $j++; - } - - $i++; - } - $r .= '
    ЛогинУдар вПоследовательность ударов
    '.con_login($us).'
    голову
    грудь
    живот
    пояс
    ноги
    '.$rh.'
    '; - $r .= '(X - удачный удар, ¤ - критический удар пробив блок , X - критический удар, Ξ - крит + инвалидность, X - доп. магический удар,
    + function rzv($v) + { + $v = explode('.', $v); + if (!isset($v[1])) { + $v = $v[0] . '.0'; + } else { + $v = $v[0] . '.' . $v[1]; + } + return $v; + } + + $tmStart = floor(($btl['time_over'] - $btl['time_start']) / 6) / 10; + $tmStart = rzv($tmStart); + $tbtl = ''; + if ($btl['invis'] > 0) { + $tbtl .= ''; + } + if ($btl['type'] == 0) { + $tbtl = 'Тип боя: ' . $tbtl . ' (физический поединок)     '; + } elseif ($btl['type'] == 1) { + $tbtl = 'Тип боя: ' . $tbtl . ' (кулачный поединок)     '; + } else { + $tbtl = 'Тип боя: ' . $tbtl . ' (физический поединок)     '; + } + + if ($btl['izlom'] > 0) { + $tbtl .= 'Волна: ' . $btl['izlomRoundSee'] . '     '; + } + + $tbtl .= 'Продолжительность боя: ' . $tmStart . ' мин.
    '; + + $users = [ + + ]; + + $uids = [ + + ]; + + function con_login($us) + { + $r = ''; + if ($us['align'] > 0) { + $r .= ''; + } + if ($us['clan'] > 0) { + $r .= ''; + } + $r .= '' . $us['login'] . ' [' . $us['level'] . ']'; + $r .= ''; + return $r; + } + + //Поулчаем инфо + $tpas = [ + 1 => 'X', + 2 => '', + 3 => '', + 4 => '¤', + 5 => 'X', + 6 => '', + 7 => '', + 8 => '', + ]; + /*$tpbs = array( + 0 => 'X', + 1 => 'X', + 2 => '', + 3 => '', + 4 => 'X', + 5 => '', + 6 => '', + 7 => '', + 8 => '' + );*/ + $tpbs = [ + 0 => '', + 1 => '', + 2 => '', + 3 => 'X', + 4 => 'X', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + ]; + $sp = mysql_query('SELECT * FROM `battle_users` WHERE `battle` = "' . $btl['id'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if (!isset($uids[$pl['id']])) { + $i = count($users); + $users[$i] = $pl; + $uids[$pl['uid']] = $i; + // + $users[$i]['value'] = [ + 'y' => 0, //уворотов+парирований+блоков щитом + 'b' => 0, //успешных блоков + 'p' => 0, //не успешных блоков, по персонажу попали + 'zb' => [ //Список зон блока + + ], + 'sa' => [ //Статистика ударов + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + ], + 'sb' => [ //Статистика блоков + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + ], + ]; + $sp2 = mysql_query( + 'SELECT * FROM `battle_stat` WHERE `battle` = "' . $btl['id'] . '" AND `uid1` = "' . $pl['uid'] . '" ORDER BY `id` ASC' + ); + while ($pl2 = mysql_fetch_array($sp2)) { + //Обновляем данные + $users[$i]['yrn'] += $pl2['yrn']; + $users[$i]['yrn_krit'] += $pl2['yrn_krit']; + //Статистика далее + $users[$i]['gaa']++; + if ($users[$i]['yrn'] > 0) { + $users[$i]['ga']++; + } + if ($users[$i]['yrn_krit'] > 0) { + $users[$i]['gak']++; + } + //Получаем куда бил игрок + $j = 0; + while ($j < $pl2['ma']) { + $users[$i]['zona'][$pl2['a'][$j]]++; + // + $za = $pl2['a'][$j]; + $k = 1; + while ($k <= 5) { + if ($za == $k) { + $tpa = $pl2['type_a'][$j]; + $zag[$k] = true; + $users[$i]['value']['sa'][$k] .= $tpas[$tpa]; + } else { + $zag[$k] = false; + //$users[$i]['value']['sa'][$za] .= '.'; + } + $k++; + } + // + $j++; + } + $j = $pl2['b']; + $k = 0; + while ($k < $pl2['mb']) { + if ($j > 5) { + $j = 1; + } + $users[$i]['value']['zb'][] = [0 => $j, 1 => 0]; + $users[$i]['zonb'][$j]++; + $j++; + $k++; + } + // + $k = 1; + while ($k <= 5) { + if ($zag[$k] == false) { + $users[$i]['value']['sa'][$k] .= ' '; + } + $k++; + } + // + } + // + $sp2 = mysql_query( + 'SELECT * FROM `battle_stat` WHERE `battle` = "' . $btl['id'] . '" AND `uid2` = "' . $pl['uid'] . '" ORDER BY `id` ASC' + ); + $k = 0; + while ($pl2 = mysql_fetch_array($sp2)) { + //Обновляем данные + $users[$i]['_yrn'] -= $pl2['yrn']; + $users[$i]['_yrn_krit'] -= $pl2['yrn_krit']; + //Получаем куда били игрока + $j = 0; + $zag = []; + while ($j < $pl2['ma']) { + $users[$i]['value']['zb'][$k][1] = $pl2['type_a'][$j]; + if ($pl2['type_a'][$j] == 2 || $pl2['type_a'][$j] == 6 || $pl2['type_a'][$j] == 7 || $pl2['type_a'][$j] == 8) { + $users[$i]['value']['y']++; + } elseif ($pl2['type_a'][$j] == 3) { + $users[$i]['value']['b']++; + } else { + $users[$i]['value']['p']++; + } + // + $j++; + } + // + $k++; + // + } + //Статистика блоков + $k = 0; + $h = 0; + $bjj = []; + while ($k < count($users[$i]['value']['zb'])) { + $zb = 0 + $users[$i]['value']['zb'][$k][0]; + $zt = 0 + $users[$i]['value']['zb'][$k][1]; + $bjj[$zb] = true; + $users[$i]['value']['sb'][$zb] .= '' . $tpbs[$zt] . ''; + if ($h < 1) { + $h++; + } else { + $d = 1; + while ($d <= 5) { + if ($bjj[$d] == true) { + + } else { + $users[$i]['value']['sb'][$d] .= ' '; + } + $d++; + } + $bjj = []; + $h = 0; + } + $k++; + } + // + } + } + + $usr = ''; + $tm = []; + $tm_u = []; + $tm_v = []; + + $i = 0; + while ($i < count($users)) { + if ($users[$i] > 0) { + $us = $users[$i]; + if (!isset($tm[$us['team']])) { + $tm[$us['team']] = ''; + $tm_v[] = $us['team']; + } + $tm_u[$us['team']][] = $i; + $tm[$us['team']] .= con_login($us); + $tm[$us['team']] .= ', '; + unset($us); + } + $i++; + } + $i = 0; + while ($i < count($tm_v)) { + $usr .= rtrim($tm[$tm_v[$i]], ', '); + if ($i < count($tm_v) - 1) { + $usr .= '   против   '; + } + $i++; + } + // + $usr = '

    Участники поединка

    ' . $usr . '

    '; + // + $r = ''; + // + $r .= '

    Последовательность ударов

    '; + $r .= ' +'; + $i = 0; + while ($i <= count($tm_v)) { + $j = 0; + $team_data = ['g' => false]; + while ($j < count($tm_u[$tm_v[$i]])) { + $us = $users[$tm_u[$tm_v[$i]][$j]]; + if ($us['id'] > 0) { + $rh = ''; + $rh .= '' . $us['value']['sa'][1] . ''; + $rh .= '
    ' . $us['value']['sa'][2] . ''; + $rh .= '
    ' . $us['value']['sa'][3] . ''; + $rh .= '
    ' . $us['value']['sa'][4] . ''; + $rh .= '
    ' . $us['value']['sa'][5] . ''; + $r .= ''; + } + unset($us); + $j++; + } + + $i++; + } + $r .= '
    ЛогинУдар вПоследовательность ударов
    ' . con_login( + $us + ) . '
    голову
    грудь
    живот
    пояс
    ноги
    ' . $rh . '
    '; + $r .= '(X - удачный удар, ¤ - критический удар пробив блок , X - критический удар, Ξ - крит + инвалидность, X - доп. магический удар,
      - противник блокировал удар,  - увернулся,  - парировал,  - отбил удар щитом)'; - // - $r .= '

    Последовательность блоков

    '; - $r .= ' -'; - $i = 0; - while($i <= count($tm_v)) { - $j = 0; - $team_data = array( 'g' => false ); - while($j < count($tm_u[$tm_v[$i]])) { - $us = $users[$tm_u[$tm_v[$i]][$j]]; - if($us['id'] > 0) { - $rh = ''; - $rh .= ''.$us['value']['sb'][1].''; - $rh .= '
    '.$us['value']['sb'][2].''; - $rh .= '
    '.$us['value']['sb'][3].''; - $rh .= '
    '.$us['value']['sb'][4].''; - $rh .= '
    '.$us['value']['sb'][5].''; - $r .= ''; - } - unset($us); - $j++; - } - - $i++; - } - $r .= '
    ЛогинБлокПоследовательность блоков
    '.con_login($us).'
    голова
    грудь
    живот
    пояс
    ноги
    '.$rh.'
    '; - $r .= '(X - удачный блок, X - пробили блок критом,  - пропустил удар, + // + $r .= '

    Последовательность блоков

    '; + $r .= ' +'; + $i = 0; + while ($i <= count($tm_v)) { + $j = 0; + $team_data = ['g' => false]; + while ($j < count($tm_u[$tm_v[$i]])) { + $us = $users[$tm_u[$tm_v[$i]][$j]]; + if ($us['id'] > 0) { + $rh = ''; + $rh .= '' . $us['value']['sb'][1] . ''; + $rh .= '
    ' . $us['value']['sb'][2] . ''; + $rh .= '
    ' . $us['value']['sb'][3] . ''; + $rh .= '
    ' . $us['value']['sb'][4] . ''; + $rh .= '
    ' . $us['value']['sb'][5] . ''; + $r .= ''; + } + unset($us); + $j++; + } + + $i++; + } + $r .= '
    ЛогинБлокПоследовательность блоков
    ' . con_login( + $us + ) . '
    голова
    грудь
    живот
    пояс
    ноги
    ' . $rh . '
    '; + $r .= '(X - удачный блок, X - пробили блок критом,  - пропустил удар,  - увернулся,  - парировал,  - отбил щитом)'; - // - $r .= '

    Суммарно

    '; - $r .= ' + // + $r .= '

    Суммарно

    '; + $r .= '
    '; - // - $i = 0; - while($i <= count($tm_v)) { - $j = 0; - $team_data = array( 'g' => false ); - while($j < count($tm_u[$tm_v[$i]])) { - $us = $users[$tm_u[$tm_v[$i]][$j]]; - if($us['id'] > 0) { - $team_data['g'] = true; - $us['heal'] = ($us['hp']-$us['hpAll'])-$us['_yrn']; - if($us['heal']<0) { - $us['heal'] = 0; - } - if( $us['hp'] < 0 ) { - $us['hp'] = 0; - } - if( $us['yrn'] < 0 ) { - $us['yrn'] = 0; - } - if( $us['yrn_krit'] < 0 ) { - $us['yrn_krit'] = 0; - } - if( $us['_yrn'] > 0 ) { - $us['_yrn'] = 0; - } - if( $us['_yrn_krit'] > 0 ) { - $us['_yrn_krit'] = 0; - } - $team_data['ga'] += $us['ga']; - $team_data['gaa'] += $us['gaa']; - $team_data['gak'] += $us['gak']; - $team_data['hp'] += $us['hp']; - $team_data['hpAll'] += $us['hpAll']; - $team_data['yrn'] += $us['yrn']; - $team_data['yrn_krit'] += $us['yrn_krit']; - $team_data['_yrn'] += $us['_yrn']; - $team_data['_yrn_krit'] += $us['_yrn_krit']; - $team_data['val_b'] += $us['value']['b']; - $team_data['val_y'] += $us['value']['y']; - $team_data['val_p'] += $us['value']['p']; - $team_data['heal'] += $us['heal']; - $winw = ''; - if( $us['hp'] < 1 ) { - $us['hp'] = '0'; - $winw = ''; - }else{ - $winw = ''; - } - $r .= ''; - } - unset($us); - $j++; - } - if( $team_data['g'] == true ) { - $winw = '--'; - if( $team_data['hp'] < 1 ) { - $team_data['hp'] = '0'; - }else{ - $winw = ''; - } - $r .= ''; - } - - $i++; - } - $r .= '
     ЛогинУдарыБлокиПопаданияЗащитаУронПотериВылечено
            
    '.$winw.''.con_login($us).' ['.$us['hp'].'/'.$us['hpAll'].']'.(0+$us['zona'][1]).'/'.(0+$us['zona'][2]).'/'.(0+$us['zona'][3]).'/'.(0+$us['zona'][4]).'/'.(0+$us['zona'][5]).''.(0+$us['zonb'][1]).'/'.(0+$us['zonb'][2]).'/'.(0+$us['zonb'][3]).'/'.(0+$us['zonb'][4]).'/'.(0+$us['zonb'][5]).''.(0+$us['ga']).'('.(0+$us['gak']).')/'.($us['gaa']).''.$us['value']['b'].'/'.$us['value']['y'].'/'.$us['value']['p'].''.$us['yrn'].'/'.$us['yrn_krit'].''.(-$us['_yrn']).''.$us['heal'].'
    '.$winw.'Всего ['.$team_data['hp'].'/'.$team_data['hpAll'].']  '.(0+$team_data['ga']).'('.(0+$team_data['gak']).')/'.($team_data['gaa']).''.$team_data['val_b'].'/'.$team_data['val_y'].'/'.$team_data['val_p'].''.$team_data['yrn'].'/'.$team_data['yrn_krit'].''.(-$team_data['_yrn']).''.$team_data['heal'].'
    '; - // - $r .= ' + //         + $i = 0; + while ($i <= count($tm_v)) { + $j = 0; + $team_data = ['g' => false]; + while ($j < count($tm_u[$tm_v[$i]])) { + $us = $users[$tm_u[$tm_v[$i]][$j]]; + if ($us['id'] > 0) { + $team_data['g'] = true; + $us['heal'] = ($us['hp'] - $us['hpAll']) - $us['_yrn']; + if ($us['heal'] < 0) { + $us['heal'] = 0; + } + if ($us['hp'] < 0) { + $us['hp'] = 0; + } + if ($us['yrn'] < 0) { + $us['yrn'] = 0; + } + if ($us['yrn_krit'] < 0) { + $us['yrn_krit'] = 0; + } + if ($us['_yrn'] > 0) { + $us['_yrn'] = 0; + } + if ($us['_yrn_krit'] > 0) { + $us['_yrn_krit'] = 0; + } + $team_data['ga'] += $us['ga']; + $team_data['gaa'] += $us['gaa']; + $team_data['gak'] += $us['gak']; + $team_data['hp'] += $us['hp']; + $team_data['hpAll'] += $us['hpAll']; + $team_data['yrn'] += $us['yrn']; + $team_data['yrn_krit'] += $us['yrn_krit']; + $team_data['_yrn'] += $us['_yrn']; + $team_data['_yrn_krit'] += $us['_yrn_krit']; + $team_data['val_b'] += $us['value']['b']; + $team_data['val_y'] += $us['value']['y']; + $team_data['val_p'] += $us['value']['p']; + $team_data['heal'] += $us['heal']; + $winw = ''; + if ($us['hp'] < 1) { + $us['hp'] = '0'; + $winw = ''; + } else { + $winw = ''; + } + $r .= '' . $winw . '' . con_login( + $us + ) . ' [' . $us['hp'] . '/' . $us['hpAll'] . ']' . (0 + $us['zona'][1]) . '/' . (0 + $us['zona'][2]) . '/' . (0 + $us['zona'][3]) . '/' . (0 + $us['zona'][4]) . '/' . (0 + $us['zona'][5]) . '' . (0 + $us['zonb'][1]) . '/' . (0 + $us['zonb'][2]) . '/' . (0 + $us['zonb'][3]) . '/' . (0 + $us['zonb'][4]) . '/' . (0 + $us['zonb'][5]) . '' . (0 + $us['ga']) . '(' . (0 + $us['gak']) . ')/' . ($us['gaa']) . '' . $us['value']['b'] . '/' . $us['value']['y'] . '/' . $us['value']['p'] . '' . $us['yrn'] . '/' . $us['yrn_krit'] . '' . (-$us['_yrn']) . '' . $us['heal'] . ''; + } + unset($us); + $j++; + } + if ($team_data['g'] == true) { + $winw = '--'; + if ($team_data['hp'] < 1) { + $team_data['hp'] = '0'; + } else { + $winw = ''; + } + $r .= '' . $winw . 'Всего [' . $team_data['hp'] . '/' . $team_data['hpAll'] . ']  ' . (0 + $team_data['ga']) . '(' . (0 + $team_data['gak']) . ')/' . ($team_data['gaa']) . '' . $team_data['val_b'] . '/' . $team_data['val_y'] . '/' . $team_data['val_p'] . '' . $team_data['yrn'] . '/' . $team_data['yrn_krit'] . '' . (-$team_data['_yrn']) . '' . $team_data['heal'] . ''; + } + + $i++; + } + $r .= ''; + // + $r .= ' Логин - имя персонажа и уровень жизни: [сейчас/всего]
    Удары - статистика ударов по областям: голова/грудь/живот/пояс/ноги
    Блоки - статистика блоков по областям: голова/грудь/живот/пояс/ноги
    @@ -454,390 +476,463 @@ if(isset($btl['id']) && $btl['team_win'] != -1 && isset($_GET['analiz'])) { Урон - выбито HP из противников / из них критами
    Потери - получено повреждений
    Вылечено - восстановлено HP
    '; - - $r = '
    '.$b.'
    '.$tbtl.$p.'Статус битвы: '.$allprice.'


    '.$usr.$r.'
    '.$p.'
    '; - //header('location: main.php'); -}elseif(!isset($btl['id'])) -{ - $r = '

    Скорее всего Архивариус снова потерял пергамент с хрониками боев ...
    '; -}else{ - include('jx/battle/log_text.php'); - function testlog($pl) - { - global $log_text,$c,$u,$code; - if($pl['type']==1 || $pl['type']==6) - { - $dt = explode('||',$pl['vars']); - $i = 0; $d = array(); - while($i'.$d['login1'].'',$rt); - $rt = str_replace('{u2}',''.$d['login2'].'',$rt); - $rt = str_replace('{pr}',''.$d['prm'].'',$rt); - $rt = str_replace('^^^^','=',$rt); - $rt = str_replace('{tm1}',''.date('H:i',$d['time1']).'',$rt); - $rt = str_replace('{tm2}',''.date('H:i',$d['time2']).'',$rt); - $rt = str_replace('{tm3}',''.date('d.m.y H:i',$d['time1']).'',$rt); - $rt = str_replace('{tm4}',''.date('d.m.y H:i',$d['time2']).'',$rt); - - $k01 = 1; - $zb1 = array(1=>0,2=>0,3=>0,4=>0,5=>0); - $zb2 = array(1=>0,2=>0,3=>0,4=>0,5=>0); - - if($d['bl2']>0) - { - $b11 = 1; - $b12 = $d['bl1']; - while($b11<=$d['zb1']) - { - $zb1[$b12] = 1; - if($b12>=5 || $b12<0) - { - $b12 = 0; - } - $b12++; - $b11++; - } - } - - if($d['bl2']>0) - { - $b11 = 1; - $b12 = $d['bl2']; - while($b11<=$d['zb2']) - { - $zb2[$b12] = 1; - if($b12>=5 || $b12<0) - { - $b12 = 0; - } - $b12++; - $b11++; - } - } - - - while($k01<=5) - { - $zns01 = ''; $zns02 = ''; - $j01 = 1; - while($j01<=5) - { - $zab1 = '0'; $zab2 = '0'; - if($j01==$k01) - { - $zab1 = '1'; - $zab2 = '1'; - } - - $zab1 .= $zb1[$j01]; - $zab2 .= $zb2[$j01]; - - $zns01 .= ''; - $zns02 .= ''; - $j01++; - } - $rt = str_replace('{zn1_'.$k01.'}',$zns01,$rt); - $rt = str_replace('{zn2_'.$k01.'}',$zns02,$rt); - $k01++; - } - $j = 1; - while($j<=21) - { - //замена R - игрок 1 - $r = $log_text[$d['s1']][$j]; - $k = 0; - while($k<=count($r)) - { - if(isset($log_text[$d['s1']][$j][$k])) - { - $rt = str_replace('{1x'.$j.'x'.$k.'}',$log_text[$d['s1']][$j][$k],$rt); - } - $k++; - } - //замена R - игрок 2 - $r = $log_text[$d['s2']][$j]; - $k = 0; - while($k<=count($r)) - { - if(isset($log_text[$d['s2']][$j][$k])) - { - $rt = str_replace('{2x'.$j.'x'.$k.'}',$log_text[$d['s2']][$j][$k],$rt); - } - $k++; - } - $j++; - } - - //заменяем данные повторно - $rt = str_replace('{u1}',''.$d['login1'].'',$rt); - $rt = str_replace('{u2}',''.$d['login2'].'',$rt); - $rt = str_replace('{pr}',''.$d['prm'].'',$rt); - $rt = str_replace('^^^^','=',$rt); - $rt = str_replace('{tm1}',''.date('H:i',$d['time1']).'',$rt); - $rt = str_replace('{tm2}',''.date('H:i',$d['time2']).'',$rt); - $rt = str_replace('{tm3}',''.date('d.m.y H:i',$d['time1']).'',$rt); - $rt = str_replace('{tm4}',''.date('d.m.y H:i',$d['time2']).'',$rt); - - //закончили заменять - $pl['text'] = $rt; - } - return $pl['text']; - } - //Получаем логи - $min = round(12*((int)$_GET['p']-1)); - if($min<1) - { - $min = 0; - } - $max = $min+11; - - $based = 'battle_logs_save'; - $sp_cnt = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_logs_save` WHERE `battle` = "'.$btl['id'].'" AND `id_hod` > '.$min.' AND `id_hod` <= '.$max.' ORDER BY `id_hod`, `time` ASC LIMIT 1')); - if( $sp_cnt[0] < 1 ) { - $based = 'battle_logs'; - } - - //генерируем страницы - $pmax = mysql_fetch_array(mysql_query('SELECT `id_hod`,`id` FROM `'.$based.'` WHERE `battle` = "'.$btl['id'].'" ORDER BY `id_hod` DESC LIMIT 1')); - $pmax = $pmax['id_hod']; - $pmax = ceil($pmax/12); - - if($min > round(12*($pmax-1))) - { - $min = round(12*($pmax-1)); - $max = $min+11; - } - $i = 1; - while($i<=$pmax) - { - if((int)$_GET['p']==$i || ((int)$_GET['p']>$pmax && $i==$pmax) || ((int)$_GET['p']<1 && $i==1)) - { - $p .= ' '.$i.' '; - }else{ - $p .= ' '.$i.' '; - } - $i++; - } - $h = 0; $clr = 'f2e5e0'; $cclr = ''; - $sp = mysql_query('SELECT * FROM `'.$based.'` WHERE `battle` = "'.$btl['id'].'" AND `id_hod` > '.$min.' AND `id_hod` <= '.($max+1).' ORDER BY `id_hod`, `id` ASC LIMIT 200'); - while($pl = mysql_fetch_array($sp)) - { - $pl['text'] = testlog($pl); - $pl['text'] = str_replace('\"','"',$pl['text']); - if($h!=$pl['id_hod']) - { - if($h>0) - { - if($clr == 'f2e5e0') { - $clr = 'f2e5E5'; - }else{ - $clr = 'f2e5e0'; - } - $cclr = 'border-top:1px solid #b1b1b1;'; - #$r .= '
    '; - } - $h = $pl['id_hod']; - }else{ - //$r .= '
    '; - } - $r .= '
    '.$pl['text'].'
    '; - $cclr = ''; - } - //собираем страницу - $p = 'Страницы: '.$p; - $usr = ''; - if($btl['team_win'] == -1) { - $sp = mysql_query('SELECT + $r = '
    ' . $b . '
    ' . $tbtl . $p . 'Статус битвы: ' . $allprice . '


    ' . $usr . $r . '
    ' . $p . '
    '; + //header('location: main.php'); +} elseif (!isset($btl['id'])) { + $r = '

    Скорее всего Архивариус снова потерял пергамент с хрониками боев ...
    '; +} else { + include('jx/battle/log_text.php'); + function testlog($pl) + { + global $log_text; + if ($pl['type'] == 1 || $pl['type'] == 6) { + $dt = explode('||', $pl['vars']); + $i = 0; + $d = []; + while ($i < count($dt)) { + $r = explode('=', $dt[$i]); + if ($r[0] != '') { + $d[$r[0]] = $r[1]; + } + $i++; + } + //обычный удар + $rt = $pl['text']; + //заменяем данные + $rt = str_replace( + '{u1}', + '' . $d['login1'] . '', + $rt + ); + $rt = str_replace( + '{u2}', + '' . $d['login2'] . '', + $rt + ); + $d['time1'] = intval($d['time1']); + $d['time2'] = intval($d['time2']); + $rt = str_replace('{pr}', '' . $d['prm'] . '', $rt); + $rt = str_replace('^^^^', '=', $rt); + $rt = str_replace('{tm1}', '' . date('H:i', $d['time1']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $d['time2']) . '', $rt); + $rt = str_replace('{tm3}', '' . date('d.m.y H:i', $d['time1']) . '', $rt); + $rt = str_replace('{tm4}', '' . date('d.m.y H:i', $d['time2']) . '', $rt); + + $k01 = 1; + $zb1 = [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0]; + $zb2 = [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0]; + + if ($d['bl2'] > 0) { + $b11 = 1; + $b12 = $d['bl1']; + while ($b11 <= $d['zb1']) { + $zb1[$b12] = 1; + if ($b12 >= 5 || $b12 < 0) { + $b12 = 0; + } + $b12++; + $b11++; + } + } + + if ($d['bl2'] > 0) { + $b11 = 1; + $b12 = $d['bl2']; + while ($b11 <= $d['zb2']) { + $zb2[$b12] = 1; + if ($b12 >= 5 || $b12 < 0) { + $b12 = 0; + } + $b12++; + $b11++; + } + } + + + while ($k01 <= 5) { + $zns01 = ''; + $zns02 = ''; + $j01 = 1; + while ($j01 <= 5) { + $zab1 = '0'; + $zab2 = '0'; + if ($j01 == $k01) { + $zab1 = '1'; + $zab2 = '1'; + } + + $zab1 .= $zb1[$j01]; + $zab2 .= $zb2[$j01]; + + $zns01 .= ''; + $zns02 .= ''; + $j01++; + } + $rt = str_replace('{zn1_' . $k01 . '}', $zns01, $rt); + $rt = str_replace('{zn2_' . $k01 . '}', $zns02, $rt); + $k01++; + } + + $j = 1; + while ($j <= 21) { + //замена R - игрок 1 + $r = $log_text[$d['s1']][$j]; + $k = 0; + while ($k <= count($r)) { + if (isset($log_text[$d['s1']][$j][$k])) { + $rt = str_replace('{1x' . $j . 'x' . $k . '}', $log_text[$d['s1']][$j][$k], $rt); + } + $k++; + } + //замена R - игрок 2 + $r = $log_text[$d['s2']][$j]; + $k = 0; + while ($k <= count($r)) { + if (isset($log_text[$d['s2']][$j][$k])) { + $rt = str_replace('{2x' . $j . 'x' . $k . '}', $log_text[$d['s2']][$j][$k], $rt); + } + $k++; + } + $j++; + } + + //заменяем данные повторно + $rt = str_replace( + '{u1}', + '' . $d['login1'] . '', + $rt + ); + $rt = str_replace( + '{u2}', + '' . $d['login2'] . '', + $rt + ); + $rt = str_replace('{pr}', '' . $d['prm'] . '', $rt); + $rt = str_replace('^^^^', '=', $rt); + $rt = str_replace('{tm1}', '' . date('H:i', $d['time1']) . '', $rt); + $rt = str_replace('{tm2}', '' . date('H:i', $d['time2']) . '', $rt); + $rt = str_replace('{tm3}', '' . date('d.m.y H:i', $d['time1']) . '', $rt); + $rt = str_replace('{tm4}', '' . date('d.m.y H:i', $d['time2']) . '', $rt); + + //закончили заменять + $pl['text'] = $rt; + } + return $pl['text']; + } + + //Получаем логи + $min = round(12 * ((int)$_GET['p'] - 1)); + if ($min < 1) { + $min = 0; + } + $max = $min + 11; + + $based = 'battle_logs_save'; + $sp_cnt = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `battle_logs_save` WHERE `battle` = "' . $btl['id'] . '" AND `id_hod` > ' . $min . ' AND `id_hod` <= ' . $max . ' ORDER BY `id_hod`, `time` ASC LIMIT 1' + ) + ); + if ($sp_cnt[0] < 1) { + $based = 'battle_logs'; + } + + //генерируем страницы + $pmax = mysql_fetch_array( + mysql_query( + 'SELECT `id_hod`,`id` FROM `' . $based . '` WHERE `battle` = "' . $btl['id'] . '" ORDER BY `id_hod` DESC LIMIT 1' + ) + ); + $pmax = $pmax['id_hod']; + $pmax = ceil($pmax / 12); + + if ($min > round(12 * ($pmax - 1))) { + $min = round(12 * ($pmax - 1)); + $max = $min + 11; + } + $i = 1; + while ($i <= $pmax) { + if ((int)$_GET['p'] == $i || ((int)$_GET['p'] > $pmax && $i == $pmax) || ((int)$_GET['p'] < 1 && $i == 1)) { + $p .= ' ' . $i . ' '; + } else { + $p .= ' ' . $i . ' '; + } + $i++; + } + $h = 0; + $clr = 'f2e5e0'; + $cclr = ''; + $sp = mysql_query( + 'SELECT * FROM `' . $based . '` WHERE `battle` = "' . $btl['id'] . '" AND `id_hod` > ' . $min . ' AND `id_hod` <= ' . ($max + 1) . ' ORDER BY `id_hod`, `id` ASC LIMIT 200' + ); + while ($pl = mysql_fetch_array($sp)) { + $pl['text'] = testlog($pl); + $pl['text'] = str_replace('\"', '"', $pl['text']); + if ($h != $pl['id_hod']) { + if ($h > 0) { + if ($clr == 'f2e5e0') { + $clr = 'f2e5E5'; + } else { + $clr = 'f2e5e0'; + } + $cclr = 'border-top:1px solid #b1b1b1;'; + #$r .= '
    '; + } + $h = $pl['id_hod']; + } else { + //$r .= '
    '; + } + $r .= '
    ' . $pl['text'] . '
    '; + $cclr = ''; + } + //собираем страницу + $p = 'Страницы: ' . $p; + $usr = ''; + if ($btl['team_win'] == -1) { + $sp = mysql_query( + 'SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`sex`,`u`.`align`,`u`.`online`,`u`.`battle`,`u`.`clan`, `s`.`hpNow`,`s`.`bot`,`s`.`team`,`u`.`city` - FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "'.$btl['id'].'" AND `s`.`hpNow` >= 1'); - - $usrs = array(-1 => array()); - - while($pl = mysql_fetch_array($sp)) { - if(!isset($usrs[$pl['team']])) { - $usrs[$pl['team']] = ''; - $usrs[-1][count($usrs[-1])] = $pl['team']; - } - if($pl['align'] > 0) { - $usrs[$pl['team']] .= ''; - } - if($pl['clan'] > 0) { - $usrs[$pl['team']] .= ''; - } - $pl['stats_r'] = $u->getStats($pl['id']); - $usrs[$pl['team']] .= ''.$pl['login'].' ['.ceil($pl['stats_r']['hpNow']).'/'.$pl['stats_r']['hpAll'].'],'; - } - - if(count($usrs[-1]) > 0) { - $i = 0; - while($i < count($usrs[-1])) { - $usr .= rtrim($usrs[$usrs[-1][$i]],','); - if(count($usrs[-1]) > $i+1) { - $usr .= '   против   '; - } - $i++; - } - } - - if($usr != '') { - $usr = '
    '.$usr.'

    '; - } - } - $tbtl = ''; - if( $btl['invis'] > 0 ) { - $tbtl .= ''; - } - if($btl['type'] == 0) { - $tbtl = 'Тип боя: '.$tbtl.' (физический поединок)     '; - }elseif($btl['type'] == 1) { - $tbtl = 'Тип боя: '.$tbtl.' (кулачный поединок)     '; - }elseif($btl['type'] == 250) { - $tbtl = ''; - $tbtl = 'Тип боя: '.$tbtl.' (Война Кланов)     '; - }elseif($btl['smert'] == 1) { - $tbtl = ''; - $tbtl = 'Тип боя: '.$tbtl.' (Жесточайшее Сражение)     '; - }else{ - $tbtl = 'Тип боя: '.$tbtl.' (физический поединок)     '; - } - - if( $btl['izlom'] > 0 ) { - $tbtl .= 'Волна: '.$btl['izlomRoundSee'].'     '; - } - - $r = '
    '.$b.'
    '.$tbtl.$p.'Статус битвы: '.$allprice.'


    '.$r.'
    '.$usr.'
    '.$p.'
    '; - - } + FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $btl['id'] . '" AND `s`.`hpNow` >= 1' + ); + + $usrs = [-1 => []]; + + while ($pl = mysql_fetch_array($sp)) { + if (!isset($usrs[$pl['team']])) { + $usrs[$pl['team']] = ''; + $usrs[-1][count($usrs[-1])] = $pl['team']; + } + if ($pl['align'] > 0) { + $usrs[$pl['team']] .= ''; + } + if ($pl['clan'] > 0) { + $usrs[$pl['team']] .= ''; + } + $pl['stats_r'] = $u->getStats($pl['id']); + $usrs[$pl['team']] .= '' . $pl['login'] . ' [' . ceil( + $pl['stats_r']['hpNow'] + ) . '/' . $pl['stats_r']['hpAll'] . '],'; + } + + if (count($usrs[-1]) > 0) { + $i = 0; + while ($i < count($usrs[-1])) { + $usr .= rtrim($usrs[$usrs[-1][$i]], ','); + if (count($usrs[-1]) > $i + 1) { + $usr .= '   против   '; + } + $i++; + } + } + + if ($usr != '') { + $usr = '
    ' . $usr . '

    '; + } + } + $tbtl = ''; + if ($btl['invis'] > 0) { + $tbtl .= ''; + } + if ($btl['type'] == 0) { + $tbtl = 'Тип боя: ' . $tbtl . ' (физический поединок)     '; + } elseif ($btl['type'] == 1) { + $tbtl = 'Тип боя: ' . $tbtl . ' (кулачный поединок)     '; + } elseif ($btl['type'] == 250) { + $tbtl = ''; + $tbtl = 'Тип боя: ' . $tbtl . ' (Война Кланов)     '; + } elseif ($btl['smert'] == 1) { + $tbtl = ''; + $tbtl = 'Тип боя: ' . $tbtl . ' (Жесточайшее Сражение)     '; + } else { + $tbtl = 'Тип боя: ' . $tbtl . ' (физический поединок)     '; + } + + if ($btl['izlom'] > 0) { + $tbtl .= 'Волна: ' . $btl['izlomRoundSee'] . '     '; + } + + $r = '
    ' . $b . '
    ' . $tbtl . $p . 'Статус битвы: ' . $allprice . '


    ' . $r . '
    ' . $usr . '
    ' . $p . '
    '; + +} ?> - -Архив: Поединки - - - - - - - - - + + Архив: Поединки + + + + + + + + + - +
    -

    - +

    + -

    Бойцовский Клуб   www.new-combats.com

    +

    Бойцовский + Клуб   www.new-combats.com




    \ No newline at end of file diff --git a/lotowork.php b/lotowork.php index c14850d7..12f1bdda 100644 --- a/lotowork.php +++ b/lotowork.php @@ -1,39 +1,28 @@ '.$_SERVER['SERVER_ADDR']); - } -*/ - -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); +$u = User::start(); $body = file_get_contents('php://input'); -$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$body.'" LIMIT 1')); -$titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$body.'" AND `vals` = "loto" AND `time` > '.(time()-24*60*60).' ORDER BY `time` DESC LIMIT 1')); -if(isset($user) && $user['id']==$u->info['id'] ) -{ - if ($titm==false) - { - // не редкий > t1 42% чуть чуть редкий > t2 25% немного редкий > t3 15% редкий > t4 10% очень редкий > t5 5% невероятно редкий > t6 3% - /*$droplist = array( - 0=>4514, t1 +$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1')); +$titm = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `actions` WHERE `uid` = "' . $body . '" AND `vals` = "loto" AND `time` > ' . (time( + ) - 24 * 60 * 60) . ' ORDER BY `time` DESC LIMIT 1' + ) +); +if (!isset($user) || $user['id'] != $u->info['id']) { + echo "No user!"; +} elseif ($titm) { + echo "Wait asign!"; +} else { + // не редкий > t1 42% чуть чуть редкий > t2 25% немного редкий > t3 15% редкий > t4 10% очень редкий > t5 5% невероятно редкий > t6 3% + /*$droplist = array( + 0=>4514, t1 1=>4515, t1 - 2=>4688, t1 + 2=>4688, t1 3=>4689, t1 4=>4690, t1 5=>5009, t2 @@ -51,129 +40,108 @@ if(isset($user) && $user['id']==$u->info['id'] ) 17=>6114, t4 18=>6115, t4 19=>6116, t4 - 20=>6360, t6 + 20=>6360, t6 21=>6462, t5 22=>5022, t6 - 23=>5023, t6 - 24=>6445, t5 + 23=>5023, t6 + 24=>6445, t5 25=>6455, t3 26=>10009, t4 27=>1032, t1 28=>1031, t1 29=>1034 t1 - );*/ - $nrnd=rand(1,100); - if ($nrnd <= 1) //t6 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1) <= 5) // t5 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-5) <= 7) // t4 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-5-7) <= 10) // t3 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-5-7-10) <= 15) // t2 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - else // t1 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } + );*/ + $nrnd = rand(1, 100); + if ($nrnd <= 1) //t6 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1) <= 5) // t5 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 5) <= 7) // t4 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 5 - 7) <= 10) // t3 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 5 - 7 - 10) <= 15) // t2 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } else // t1 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } - if (isset($droplist['id'])) - { - $idve=$droplist['idgame']; - $u->addItem($idve,$user['id'],'|frompisher=1|nosale=1'.$user['login']); - $inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$idve.'" LIMIT 1')); - $titm = mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("'.$user['id'].'","'.time().'","'.loto.'","'.$user['room'].'","'.$idve.'","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'","loto")'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Игрок '.$user['login'].' выиграл в бесплатной рулетке '.$inf['name'].'!","capitalcity","","6","1","'.time().'")'); - echo $droplist['id']; // - } - else - { - echo 'Error'; - } - } - else - { - echo "Wait asign!"; - } -} -else -{ - echo "No user!"; + if (!isset($droplist['id'])) { + echo 'Error'; + } else { + $idve = $droplist['idgame']; + $u->addItem($idve, $user['id'], '|frompisher=1|nosale=1' . $user['login']); + $inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $idve . '" LIMIT 1')); + $titm = mysql_query( + 'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $user['id'] . '","' . time( + ) . '","' . loto . '","' . $user['room'] . '","' . $idve . '","' . mysql_real_escape_string( + $_SERVER['HTTP_X_REAL_IP'] + ) . '","loto")' + ); + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Игрок ' . $user['login'] . ' выиграл в бесплатной рулетке ' . $inf['name'] . '!","capitalcity","","6","1","' . time( + ) . '")' + ); + echo $droplist['id']; // + } } diff --git a/lotoworkekr.php b/lotoworkekr.php index e0da64f6..b9523445 100644 --- a/lotoworkekr.php +++ b/lotoworkekr.php @@ -1,166 +1,120 @@ '.$_SERVER['SERVER_ADDR']); - } -*/ - -define('GAME',true); +const GAME = true; include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); - +$u = User::start(); $body = file_get_contents('php://input'); -$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$body.'" LIMIT 1')); -if ($body == 'ekr') -{ - echo $u->info['money2']; - die(); +$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1')); +if ($body == 'ekr') { + echo $u->info['money2']; + die(); } - -if(isset($user) && $user['id']==$u->info['id']) -{ - if ($user['money2']>=5) - { - $nrnd=rand(1,100); - if ($nrnd <= 1) //t6 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1) <= 7) // t5 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-7) <= 10) // t4 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-7-10) <= 15) // t3 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - elseif (($nrnd-1-7-10-15) <= 25) // t2 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - else // t1 - { - $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"'); - $y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"')); - $rndt=rand(0,$y['COUNT']-1); - $i=0; - while($pl = mysql_fetch_array($droplistt)) - { - if($i==$rndt) - { - $droplist = $pl; - } - $i++; - } - } - if (isset($droplist['id'])) - { - $idve=$droplist['idgame']; - $u->addItem($idve,$user['id'],'|frompisher=1|nosale=1'.$user['login']); - $inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$idve.'" LIMIT 1')); - //$titm = mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("'.$user['id'].'","'.time().'","'.loto.'","'.$user['room'].'","'.$idve.'","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'","loto")'); - $u->info['money2'] = $u->info['money2'] - 5; - mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "'.$u->info['id'].'"'); - if ($droplist['type']=="t6" || $droplist['type']=="t5") - { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Игрок '.$user['login'].' выиграл в платной рулетке '.$inf['name'].'!","capitalcity","","6","1","'.time().'")'); - } - echo $droplist['id']; // это закоментить - /*//этот блок разкоментить - $array = array( - '1' => $droplist['id']', // 1 элемент id вещи - '2' => $u->info['money2'] // бабло пользователя - ); - $json = json_encode($array); - echo $json;*/ - - } - else - { - echo 'Error'; - } - } - else - { - echo "No Ekr!"; - } -} -else -{ - echo "No user!"; +if (!isset($user) || $user['id'] != $u->info['id']) { + echo "No user!"; +} else { + if ($user['money2'] < 5) { + echo "No Ekr!"; + } else { + $nrnd = rand(1, 100); + if ($nrnd <= 1) //t6 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1) <= 7) // t5 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 7) <= 10) // t4 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 7 - 10) <= 15) // t3 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } elseif (($nrnd - 1 - 7 - 10 - 15) <= 25) // t2 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } else // t1 + { + $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"'); + $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"')); + $rndt = rand(0, $y['COUNT'] - 1); + $i = 0; + while ($pl = mysql_fetch_array($droplistt)) { + if ($i == $rndt) { + $droplist = $pl; + } + $i++; + } + } + if (!isset($droplist['id'])) { + echo 'Error'; + } else { + $idve = $droplist['idgame']; + $u->addItem($idve, $user['id'], '|frompisher=1|nosale=1' . $user['login']); + $inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $idve . '" LIMIT 1')); + $u->info['money2'] = $u->info['money2'] - 5; + mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "' . $u->info['id'] . '"'); + if ($droplist['type'] == "t6" || $droplist['type'] == "t5") { + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Игрок ' . $user['login'] . ' выиграл в платной рулетке ' . $inf['name'] . '!","capitalcity","","6","1","' . time( + ) . '")' + ); + } + echo $droplist['id']; // это закоментить + /*//этот блок разкоментить + $array = array( + '1' => $droplist['id']', // 1 элемент id вещи + '2' => $u->info['money2'] // бабло пользователя + ); + $json = json_encode($array); + echo $json;*/ + } + } } diff --git a/main.php b/main.php index 2ca90308..72421d36 100644 --- a/main.php +++ b/main.php @@ -24,16 +24,20 @@ } +
    \n"; var_dump($vars); echo "\n"; - if ($d) exit(); + if ($d) { + exit(); + } } define('IP', GetRealIp()); -include('_incl_data/__config.php'); -define('GAME', true); -include('_incl_data/class/__db_connect.php'); +require_once('_incl_data/__config.php'); +const GAME = true; +require_once('_incl_data/class/__db_connect.php'); date_default_timezone_set('Europe/Moscow'); +$magic = new Magic(); +$u = User::start(); +$filter = new Filter(); +$q = new Quests; -include('_incl_data/class/__magic.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__filter_class.php'); -include('_incl_data/class/__quest.php'); +/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */ +Db::exec( + 'update stats set + hpNow = hpAll, + mpNow = mpAll + where + id in (select id from users where bot = 2 and battle = 0)' +); if ($u->info['banned'] > 0) { header('location: /index.php'); @@ -70,7 +84,7 @@ if ($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { } error_reporting(E_ALL ^ E_NOTICE); -ini_set('display_errors', 'Off'); +ini_set('display_errors', 'on'); ini_set('max_execution_time', '120'); #--------для общаги, и позже для почты $sleep = $u->testAction('`vars` = "sleep" AND `uid` = "' . $u->info['id'] . '" LIMIT 1', 1); @@ -85,37 +99,35 @@ if ($u->room['file'] == "room_hostel" || $u->room['file'] == "post") { #--------для общаги, и позже для почты if ($u->info['online'] < time() - 60 || $u->info['afk'] != '') { - $filter->setOnline($u->info['8'], $u->info['id'], 0); + $filter->setOnline($u->info['8'], $u->info['id']); $u->onlineBonus(); - mysql_query("UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "',`afk`='' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"); + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "',`afk`='' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); } elseif ($u->info['timeMain'] < time() - 60 || $u->info['afk'] != '') { - mysql_query("UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "',`afk`='' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"); + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "',`afk`='' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); } if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']) || $u->info['banned'] > 0) { die($c['exit']); } -if ($u->info['battle_text'] != '') { - //Показываем системку и заносим данные - if ($u->info['last_b'] > 0) { - mysql_query('INSERT INTO `battle_last` (`battle_id`,`uid`,`time`,`act`,`level`,`align`,`clan`,`exp`) VALUES ("' . $u->info['last_b'] . '","' . $u->info['id'] . '","' . time() . '","' . $u->info['last_a'] . '","' . $u->info['level'] . '","' . $u->info['align'] . '","' . $u->info['clan'] . '","' . $u->info['exp'] . '")'); - } +//Показываем системку и заносим данные +if ($u->info['battle_text'] != '' && $u->info['last_b'] > 0) { + mysql_query( + 'INSERT INTO `battle_last` (`battle_id`,`uid`,`time`,`act`,`level`,`align`,`clan`,`exp`) VALUES ("' . $u->info['last_b'] . '","' . $u->info['id'] . '","' . time( + ) . '","' . $u->info['last_a'] . '","' . $u->info['level'] . '","' . $u->info['align'] . '","' . $u->info['clan'] . '","' . $u->info['exp'] . '")' + ); } -if (!isset($_GET['mAjax']) and !isset($_GET['ajaxHostel'])) - echo ' - - - - - - - - - - -'; +if (!isset($_GET['mAjax']) && !isset($_GET['ajaxHostel'])) { + echo ' +
    '; +} $act = -2; $act2 = 0; $u->stats = $u->getStats($u->info['id'], 0); @@ -133,10 +145,20 @@ $ul = $u->testLevel(); if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] != $u->info['id']) { if ($u->room['noatack'] == 0) { - $ua = mysql_fetch_array(mysql_query('SELECT `id`,`clan` FROM `users` WHERE`id` = "' . mysql_real_escape_string($_GET['atak_user']) . '" LIMIT 1')); - $cruw = mysql_fetch_array(mysql_query('SELECT `id`,`type` FROM `clan_wars` WHERE + $ua = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`clan` FROM `users` WHERE`id` = "' . mysql_real_escape_string( + $_GET['atak_user'] + ) . '" LIMIT 1' + ) + ); + $cruw = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`type` FROM `clan_wars` WHERE ((`clan1` = "' . $ua['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $ua['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND - `time_finish` > ' . time() . ' LIMIT 1')); + `time_finish` > ' . time() . ' LIMIT 1' + ) + ); unset($ua); if (isset($cruw['id'])) { $cruw = $cruw['type']; @@ -144,10 +166,29 @@ if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] ! $cruw = 0; } - $ua = mysql_fetch_array(mysql_query('SELECT `s`.*,`u`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE (`s`.`atack` > "' . time() . '" OR `s`.`atack` = 1 OR 1 = ' . $cruw . ' OR 2 = ' . $cruw . ') AND `s`.`id` = "' . mysql_real_escape_string($_GET['atak_user']) . '" LIMIT 1')); - $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $u->info['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - $check2 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 479 AND `uid` = "' . $ua['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_last` WHERE `uid` = "' . $u->info['id'] . '" AND `battle_id` = "' . $ua['battle'] . '" LIMIT 1')); + $ua = mysql_fetch_array( + mysql_query( + 'SELECT `s`.*,`u`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE (`s`.`atack` > "' . time( + ) . '" OR `s`.`atack` = 1 OR 1 = ' . $cruw . ' OR 2 = ' . $cruw . ') AND `s`.`id` = "' . mysql_real_escape_string( + $_GET['atak_user'] + ) . '" LIMIT 1' + ) + ); + $check = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $u->info['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;' + ) + ); + $check2 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `eff_users` WHERE `id_eff` = 479 AND `uid` = "' . $ua['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;' + ) + ); + $test = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `battle_last` WHERE `uid` = "' . $u->info['id'] . '" AND `battle_id` = "' . $ua['battle'] . '" LIMIT 1' + ) + ); if ($ua['no_ip'] == 'trupojor' && $ua['level'] == 9 && $u->info['level'] > 9) { $u->error = 'Нельзя нападать на монстра этого уровня!'; } elseif ($ua['no_ip'] == 'trupojor' && $ua['level'] == 10 && $u->info['level'] < 10) { @@ -165,7 +206,11 @@ if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] ! $minHp = floor($usta['hpAll'] / 100 * 33); // минимальный запас здоровья цели при котором можно напасть if ($ua['battle'] > 0) { - $uabt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $ua['battle'] . '" AND `team_win` = "-1" LIMIT 1')); + $uabt = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `battle` WHERE `id` = "' . $ua['battle'] . '" AND `team_win` = "-1" LIMIT 1' + ) + ); if (!isset($uabt['id'])) { $ua['battle'] = 0; } @@ -193,9 +238,13 @@ if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] ! $ua['type_pers'] = 500; } - mysql_query('UPDATE `stats` SET `hpNow` = "' . $usta['hpNow'] . '",`mpNow` = "' . $usta['mpNow'] . '" WHERE `id` = "' . $usta['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `stats` SET `hpNow` = "' . $usta['hpNow'] . '",`mpNow` = "' . $usta['mpNow'] . '" WHERE `id` = "' . $usta['id'] . '" LIMIT 1' + ); - $goodt = $magic->atackUser($u->info['id'], $ua['id'], $ua['team'], $ua['battle'], $ua['bbexp'], $ua['type_pers']); + $goodt = $magic->atackUser( + $u->info['id'], $ua['id'], $ua['team'], $ua['battle'], $ua['bbexp'], $ua['type_pers'] + ); if ($cruw == 2) { $rtxt = '[img[items/pal_button9.gif]] "' . $u->info['login'] . '" совершил' . $sx . ' кровавое нападение по метке на персонажа "' . $ua['login'] . '".'; @@ -204,7 +253,10 @@ if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] ! } if ($goodt > 0) { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time( + ) . "','6','0','1')" + ); } unset($goodt); header('location: main.php'); @@ -243,11 +295,17 @@ if ($u->info['repass'] > 0) { } define('IP', GetRealIp()); - if (isset($_POST['renpass']) && $_POST['renpass'] == $_POST['renpass2'] && md5($_POST['renpass']) != $u->info['pass']) { + if (isset($_POST['renpass']) && $_POST['renpass'] == $_POST['renpass2'] && md5( + $_POST['renpass'] + ) != $u->info['pass']) { if ($u->info['ip'] == IP) { $u->info['pass'] = md5($_POST['renpass']); setcookie('pass', $u->info['pass'], time() + 30 * 60 * 60 * 24, '', 'new-combats.com'); - mysql_query('UPDATE `users` SET `pass` = "' . mysql_real_escape_string($u->info['pass']) . '",`repass` = "0",`type_pers` = "0",`bot_room` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `pass` = "' . mysql_real_escape_string( + $u->info['pass'] + ) . '",`repass` = "0",`type_pers` = "0",`bot_room` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); mysql_query('UPDATE `stats` SET `bot` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); } else { die('Внимание! Смена пароля привязана к ip %' . $u->info['ip'] . '.
    Для восстановления контроля войдите с данного IP, либо обратитесь к Администрации проекта через нового персонажа. Приносим извинения за неудобства!
    '); @@ -260,7 +318,8 @@ if ($u->info['repass'] > 0) { echo 'Внимание!Пароли не совпадают.'; } } - die('


    Смените пожалуйста пароль от персонажа!
    Данная смена проходит, если пароль не менялся более 2 месяцев.



    + die( + '


    Смените пожалуйста пароль от персонажа!
    Данная смена проходит, если пароль не менялся более 2 месяцев.



    Сменить пароль @@ -270,16 +329,21 @@ if ($u->info['repass'] > 0) {
    -
    '); +
    ' + ); } } /*-----------------------*/ if ($u->info['battle'] == 0) { - $btl_last = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1')); + $btl_last = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' + ) + ); } if (isset($btl_last['id']) && $u->info['battle'] == 0) { - include('modules_data/btl_.php'); + require_once('modules_data/btl_.php'); $u->info['battle_lsto'] = true; } elseif ($u->info['battle'] == 0) { @@ -321,7 +385,9 @@ if (isset($btl_last['id']) && $u->info['battle'] == 0) { if ($u->info['allLock'] < time()) { $u->deleteItem(intval($_GET['delete']), $u->info['id']); } else { - echo ''; + echo ''; } } elseif (isset($_GET['unstack']) && isset($_GET['inv']) && $u->newAct($_GET['sd4'])) { $u->unstack(intval($_GET['unstack']), intval($_GET['unstackCount'])); @@ -358,73 +424,73 @@ if ($act != -2) { /*-----------------------*/ if (isset($_GET['worklist']) && $u->info['admin'] > 0) { - include('modules_data/worklist.php'); + require_once('modules_data/worklist.php'); } elseif (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) { - include('modules_data/_changepass.php'); + require_once('modules_data/_changepass.php'); } elseif ($u->info['level'] >= 0 && isset($_GET['friends']) && !isset($u->tfer['id'])) { - include('modules_data/_friends.php'); + require_once('modules_data/_friends.php'); } elseif (($u->info['admin'] > 0 || $u->info['level'] > 7 || $u->info['align'] == 50) && isset($_GET['notepad']) && !isset($u->tfer['id'])) { - include('modules_data/notepad.php'); + require_once('modules_data/notepad.php'); } elseif ((($u->info['align'] > 1 && $u->info['align'] < 2) || $u->info['admin'] > 0) && isset($_GET['light']) && !isset($u->tfer['id'])) { if ($u->info['id'] == 1000001) { $u->info['admin'] = 0; die(); } - include('modules_data/_mod.php'); + require_once('modules_data/_mod.php'); } elseif ((($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0) && isset($_GET['dark']) && !isset($u->tfer['id'])) { if ($u->info['id'] == 1000001) { $u->info['admin'] = 0; die(); } - include('modules_data/_mod.php'); + require_once('modules_data/_mod.php'); } elseif (isset($_GET['admin']) && $u->info['admin'] > 0) { if ($u->info['id'] == 1000001) { $u->info['admin'] = 0; die(); } if ($u->info['id'] == 7) { - include('modules_data/_light.php'); + require_once('modules_data/_light.php'); } else { - include('modules_data/_mod.php'); + require_once('modules_data/_mod.php'); } } elseif (isset($_GET['vip']) && !isset($u->tfer['id'])) { - include('modules_data/vip.php'); + require_once('modules_data/vip.php'); } elseif ((isset($_GET['zayvka']) && $u->info['battle'] == 0) || (isset($_GET['zayvka']) && ($_GET['r'] == 6 || $_GET['r'] == 7 || !isset($_GET['r'])) && $u->info['battle'] > 0) && !isset($u->tfer['id'])) { if ($u->room['zvsee'] == 1) { - include('modules_data/_zv2.php'); + require_once('modules_data/_zv2.php'); } else { - include('modules_data/_zv.php'); + require_once('modules_data/_zv.php'); } } elseif (isset($_GET['alh']) && $u->info['level'] >= 0 && !isset($u->tfer['id'])) { - include('modules_data/_alh.php'); + require_once('modules_data/_alh.php'); } elseif ($u->info['clan'] > 0 && isset($_GET['clan']) && !isset($u->tfer['id'])) { if ($u->info['id'] == 1000001) { $u->info['admin'] = 0; die(); } - include('modules_data/_clan.php'); + require_once('modules_data/_clan.php'); } elseif (isset($_GET['alhp']) && ($u->info['admin'] == 1 || $u->info['align'] == 50 || $u->info['align2'] == 50) && !isset($u->tfer['id'])) { if ($u->info['id'] == 1000001) { $u->info['admin'] = 0; die(); } - include('modules_data/_alhp.php'); -//Панель букмекера + require_once('modules_data/_alhp.php'); + //Панель букмекера } elseif (isset($_GET['bukmeker']) && $u->info['level'] > 0 && !isset($u->tfer['id'])) { - include('modules_data/_bukmeker.php'); + require_once('modules_data/_bukmeker.php'); //Панель светлого } elseif ($u->info['align'] >= 1 && $u->info['align'] < 2 && isset($_GET['1_panel']) && $u->info['level'] > 3 && !isset($u->tfer['id'])) { - include('modules_data/1_panel.php'); + require_once('modules_data/1_panel.php'); //Панель темного } elseif ($u->info['align'] >= 3 && $u->info['align'] < 4 && isset($_GET['3_panel']) && $u->info['level'] > 3 && !isset($u->tfer['id'])) { - include('modules_data/3_panel.php'); + require_once('modules_data/3_panel.php'); //Панель темного } elseif ($u->info['align'] >= 7 && $u->info['align'] < 8 && isset($_GET['7_panel']) && $u->info['level'] > 3 && !isset($u->tfer['id'])) { - include('modules_data/7_panel.php'); + require_once('modules_data/7_panel.php'); } elseif ($u->info['battle'] != 0) { //поединок if ((!isset($btl_last['id']) || $u->info['battle'] > 0) && !isset($u->info['battle_lsto'])) { - include('modules_data/btl_.php'); + require_once('modules_data/btl_.php'); echo ''; } @@ -437,63 +503,55 @@ if (isset($_GET['worklist']) && $u->info['admin'] > 0) { "; if ($u->info['dnow'] > 0) { - include('_incl_data/class/__dungeon.php'); + $d = new Dungeon; + $d->start(); } - include('modules_data/_dialog.php'); + require_once('modules_data/_dialog.php'); } elseif (isset($_GET['inv']) && !isset($u->tfer['id']) && $trololo == 1) { - include('modules_data/_inv.php'); + require_once('modules_data/_inv.php'); } elseif (isset($_GET['add_eff']) && !isset($u->tfer['id']) && $trololo == 1) { - include('modules_data/add_eff.php'); + require_once('modules_data/add_eff.php'); } elseif (isset($_GET['referals']) && $trololo == 1 && !isset($u->tfer['id'])) { - include('modules_data/_ref.php'); + require_once('modules_data/_ref.php'); } elseif (isset($_GET['obraz']) && !isset($u->tfer['id']) && $trololo == 1) { - include('modules_data/_obraz.php'); + require_once('modules_data/_obraz.php'); } elseif (isset($_GET['skills']) && !isset($u->tfer['id']) && $trololo == 1) { - include('modules_data/_umenie.php'); + require_once('modules_data/_umenie.php'); } elseif ((isset($_GET['transfer']) || isset($u->tfer['id'])) && $u->info['level'] >= $c['level_ransfer'] && $trololo == 1 && $u->info['inTurnir'] == 0 && $u->info['inTurnirnew'] == 0) { if ($u->info['allLock'] > time()) { - include('modules_data/_locations.php'); - echo ''; + require_once('modules_data/_locations.php'); + echo ''; } else { - include('modules_data/_transfers.php'); + require_once('modules_data/_transfers.php'); } } elseif (isset($_GET['anketa']) && !isset($u->tfer['id']) && $trololo == 1) { - include('settings.php'); + require_once('settings.php'); } elseif (isset($_GET['newanimal']) && $trololo == 1) { - include('modules_data/_newanimal.php'); + require_once('modules_data/_newanimal.php'); } elseif (isset($_GET['act_trf']) && $u->room['block_all'] == 0) { - include('modules_data/act_trf.php'); + require_once('modules_data/act_trf.php'); } elseif (isset($_GET['titul']) && $u->room['block_all'] == 0) { - include('modules_data/titul.php'); + require_once('modules_data/titul.php'); } elseif (!isset($u->tfer['id'])) { - include('modules_data/_locations.php'); + require_once('modules_data/_locations.php'); } } -/** - * Отключил потому что эта строчка крашит плавку рун. - * PHP Fatal error: Call to a member function testquest() on a non-object - * Невероятно, но факт. Инс. 09.06.22 - */ //Проверяем квесты на готовность -if (in_array($u->room['file'], [ - 'dungeon_enter', - 'dungeon_enter_all', - 'enterbezdna', - 'entercat', - 'enterdrago', - 'entergrib', - 'enternizin', - 'enterptp', - 'house_belaun', - 'dungeon' -])) { +if (in_array( + $u->room['file'], + ['dungeon_enter', 'dungeon_enter_all', 'enterbezdna', 'entercat', 'enterdrago', 'entergrib', 'enternizin', 'enterptp', 'house_belaun', 'dungeon'] +)) { $q->testquest(); } $iloc = ''; $iloce = ''; -$sp = mysql_query('SELECT * FROM `items_local` WHERE (`room` = "' . $u->info['room'] . '" OR `room` = "-1") AND `delete` = "0" AND `user_take` = "0" AND `tr_login` = "' . $u->info['login'] . '"'); +$sp = mysql_query( + 'SELECT * FROM `items_local` WHERE (`room` = "' . $u->info['room'] . '" OR `room` = "-1") AND `delete` = "0" AND `user_take` = "0" AND `tr_login` = "' . $u->info['login'] . '"' +); while ($pl = mysql_fetch_array($sp)) { $itmo = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '" LIMIT 1')); if (isset($itmo['id'])) { @@ -519,20 +577,30 @@ while ($pl = mysql_fetch_array($sp)) { if ($pl['time'] + 86400 < time()) { //Не успели поднять $glid = 1; - mysql_query('UPDATE `items_local` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `items_local` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); } elseif (isset($_GET['take_loc_item']) && $_GET['take_loc_item'] == $pl['id']) { // if ($u->info['battle'] > 0 && $tk == 1) { $iloce = 'Вы не можете поднять предмет, завершите поединок...'; } elseif ($tk == 1) { $iloce = 'Вы успешно подняли предмет "' . $itmo['name'] . '" в локации "' . $u->room['name'] . '".'; - mysql_query('UPDATE `items_local` SET `delete` = "' . time() . '" , `user_take` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `items_local` SET `delete` = "' . time( + ) . '" , `user_take` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); //выдаем предмет $glid = 1; if ($pl['data'] == '0') { - $u->addItem($pl['item_id'], $u->info['id'], '|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room']); + $u->addItem( + $pl['item_id'], $u->info['id'], '|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room'] + ); } else { - $u->addItem($pl['item_id'], $u->info['id'], '|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room'] . '|' . $pl['data']); + $u->addItem( + $pl['item_id'], $u->info['id'], + '|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room'] . '|' . $pl['data'] + ); } } } @@ -540,8 +608,7 @@ while ($pl = mysql_fetch_array($sp)) { if ($tk == 1 && $pl['tr_login'] == '0') { $tk = 2; } - $iloc .= '
    ' . - '
    ' . '' . - '
    '; + $iloc .= '" src="https://img.new-combats.com/i/items/' . $itmo['img'] . '">' . '
    '; } } else { echo '[!]'; @@ -564,10 +630,7 @@ if ($iloc != '') { if ($iloce != '') { $iloc = '
    ' . $iloce . '
    ' . $iloc; } - $iloc = '' . - '

    В комнате разбросаны предметы

    ' . $iloc; + $iloc = '' . '

    В комнате разбросаны предметы

    ' . $iloc; $tjs .= 'top.frames[\'main\'].locitems=1;parent.$(\'#canal1\').html( \'' . $iloc . '\' );'; } else { $tjs .= 'top.frames[\'main\'].locitems=1;parent.$(\'#canal1\').html( \'\' );'; @@ -575,7 +638,11 @@ if ($iloc != '') { unset($iloc, $iloce); /*-----------------------*/ -$spl = mysql_fetch_array(mysql_query('SELECT `exp` FROM `levels` WHERE `nextLevel` = "' . ($u->info['level'] + 1) . '" ORDER BY `exp` ASC LIMIT 1')); +$spl = mysql_fetch_array( + mysql_query( + 'SELECT `exp` FROM `levels` WHERE `nextLevel` = "' . ($u->info['level'] + 1) . '" ORDER BY `exp` ASC LIMIT 1' + ) +); $spl = $spl['exp']; echo ' '; diff --git a/main_bot.php b/main_bot.php index 0e028ffc..a66608bc 100644 --- a/main_bot.php +++ b/main_bot.php @@ -1,483 +1,283 @@ -'.$_SERVER['SERVER_ADDR']); +if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') { + die('Hello pussy!'); +} +if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock( + ) != '91.228.152.24') { + die(getIPblock() . '
    ' . $_SERVER['SERVER_ADDR']); } include('_incl_data/__config.php'); -define('GAME',true); +const GAME = true; include('_incl_data/class/__db_connect.php'); -/*mysql_query("LOCK TABLES -`aaa_monsters` WRITE, -`actions` WRITE, -`bank` WRITE, - -`battle` WRITE, -`battle_act` WRITE, -`battle_actions` WRITE, -`battle_cache` WRITE, -`battle_end` WRITE, -`battle_last` WRITE, -`battle_logs` WRITE, -`battle_logs_save` WRITE, -`battle_stat` WRITE, -`battle_users` WRITE, - -`bs_actions` WRITE, -`bs_items` WRITE, -`bs_items_use` WRITE, -`bs_logs` WRITE, -`bs_map` WRITE, -`bs_statistic` WRITE, -`bs_trap` WRITE, -`bs_turnirs` WRITE, -`bs_zv` WRITE, - -`clan` WRITE, -`clan_wars` WRITE, - -`dungeon_actions` WRITE, -`dungeon_bots` WRITE, -`dungeon_items` WRITE, -`dungeon_map` WRITE, -`dungeon_now` WRITE, -`dungeon_zv` WRITE, - -`eff_main` WRITE, -`eff_users` WRITE, - -`items_img` WRITE, -`items_local` WRITE, -`items_main` WRITE, -`items_main_data` WRITE, -`items_users` WRITE, - -`izlom` WRITE, -`izlom_rating` WRITE, - -`laba_act` WRITE, -`laba_itm` WRITE, -`laba_map` WRITE, -`laba_now` WRITE, -`laba_obj` WRITE, - -`levels` WRITE, -`levels_animal` WRITE, - -`online` WRITE, - -`priems` WRITE, - -`quests` WRITE, -`reimage` WRITE, - -`reg` WRITE, - -`stats` WRITE, -`test_bot` WRITE, -`turnirs` WRITE, -`users` WRITE, -`users_animal` WRITE, -`user_ico` WRITE, -`users_twink` WRITE, -`zayvki` WRITE;");*/ - -function e($t) { - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","TABU","6","1","-1")'); +function e($t) +{ + mysql_query( + 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date( + 'H:i:s' + ) . ' (Критическая ошибка): ' . mysql_real_escape_string($t) . '","capitalcity","TABU","6","1","-1")' + ); } -if(isset($_GET['cron_core'])) { - $id = array( - 'id' => $_GET['uid'], - 'pass' => $_GET['pass'] - ); - if(md5($id['id'].'_brfCOreW@!_'.$id['pass']) == $_GET['cron_core']) { - $uzr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "'.mysql_real_escape_string($id['id']).'" AND `pass` = "'.mysql_real_escape_string($id['pass']).'" LIMIT 1')); - if(isset($uzr['id'])) { - $CRON_CORE = true; - $_COOKIE['login'] = $uzr['login']; - $_COOKIE['pass'] = $uzr['pass']; - $_POST['id'] = 'reflesh'; - - - if(isset($_GET['atack'])) { - $_POST['atack'] = $_GET['atack']; - } - if(isset($_GET['block'])) { - $_POST['block'] = $_GET['block']; - } - if(isset($_GET['usepriem'])) { - $_POST['usepriem'] = $_GET['usepriem']; - } - if(isset($_GET['useitem'])) { - $_POST['useitem'] = $_GET['useitem']; - } - } - } +if (isset($_GET['cron_core'])) { + $id = [ + 'id' => $_GET['uid'], + 'pass' => $_GET['pass'], + ]; + if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) { + $uzr = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $id['id'] + ) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1' + ) + ); + if (isset($uzr['id'])) { + $CRON_CORE = true; + $_COOKIE['login'] = $uzr['login']; + $_COOKIE['pass'] = $uzr['pass']; + $_POST['id'] = 'reflesh'; + + + if (isset($_GET['atack'])) { + $_POST['atack'] = $_GET['atack']; + } + if (isset($_GET['block'])) { + $_POST['block'] = $_GET['block']; + } + if (isset($_GET['usepriem'])) { + $_POST['usepriem'] = $_GET['usepriem']; + } + if (isset($_GET['useitem'])) { + $_POST['useitem'] = $_GET['useitem']; + } + } + } } -if(!isset($uzr['id'])) { - header('location: main.php'); - die(); +if (!isset($uzr['id'])) { + header('location: main.php'); + die(); } unset($uzr); -include('_incl_data/class/__magic.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__filter_class.php'); -include('_incl_data/class/__quest.php'); +$magic = new Magic(); +$u = User::start(); +$filter = new Filter(); +$q = new Quests; -if($u->info['activ']>0) { - die('Вам необходимо активировать персонажа.
    Авторизируйтесь с главной страницы.'); +if ($u->info['activ'] > 0) { + die('Вам необходимо активировать персонажа.
    Авторизируйтесь с главной страницы.'); } $tjs = ''; #--------для общаги, и позже для почты -$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1',1); -if($u->room['file']!="objaga" && $sleep['id']>0) { - mysql_query('UPDATE `actions` SET `vars` = "unsleep" WHERE `id` = "'.$sleep['id'].'" LIMIT 1'); +$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "' . $u->info['id'] . '" LIMIT 1', 1); +if ($u->room['file'] != "objaga" && $sleep['id'] > 0) { + mysql_query('UPDATE `actions` SET `vars` = "unsleep" WHERE `id` = "' . $sleep['id'] . '" LIMIT 1'); +} +if ($u->room['file'] == "objaga" || $u->room['file'] == "post") { + $trololo = 0; +} else { + $trololo = 1; } -if($u->room['file']=="objaga" || $u->room['file']=="post"){$trololo=0;}else{$trololo=1;} #--------для общаги, и позже для почты -if($u->info['online'] < time()-60) -{ - $filter->setOnline($u->info['online'],$u->info['id'],0); - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); -}elseif($u->info['timeMain'] < time()-60) -{ - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); +if ($u->info['online'] < time() - 60) { + $filter->setOnline($u->info['online'], $u->info['id']); + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); +} elseif ($u->info['timeMain'] < time() - 60) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); } -if(!isset($u->info['id']) || ($u->info['joinIP']==1 && $u->info['ip']!=$_SERVER['HTTP_X_REAL_IP']) || $u->info['banned']>0) -{ - die($c['exit']); +if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']) || $u->info['banned'] > 0) { + die($c['exit']); } -if(isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user']!=$u->info['id'] ) -{ - if($u->room['noatack'] == 0) { - $ua = mysql_fetch_array(mysql_query('SELECT `id`,`clan` FROM `users` WHERE`id` = "'.mysql_real_escape_string($_GET['atak_user']).'" LIMIT 1')); - $cruw = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_wars` WHERE - ((`clan1` = "'.$ua['clan'].'" AND `clan2` = "'.$u->info['clan'].'") OR (`clan2` = "'.$ua['clan'].'" AND `clan1` = "'.$u->info['clan'].'")) AND - `time_finish` > '.time().' LIMIT 1')); - unset($ua); - if(isset($cruw['id'])) { - $cruw = 1; - } - - $ua = mysql_fetch_array(mysql_query('SELECT `s`.`team`,`s`.`id`,`s`.`bbexp`,`u`.`battle`,`u`.`id`,`u`.`room`,`u`.`login`,`u`.`online` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE (`s`.`atack` > "'.time().'" OR `s`.`atack` = 1 OR 1 = '.$cruw.') AND `s`.`id` = "'.mysql_real_escape_string($_GET['atak_user']).'" LIMIT 1')); - if(isset($ua['id']) && $ua['online'] > time()-520) - { - $usta = $u->getStats($ua['id'],0); // статы цели - $minHp = $usta['hpAll']/100*33; // минимальный запас здоровья цели при котором можно напасть - - if($ua['room']==$u->info['room'] && ($minHp<$usta['hpNow'] || $ua['battle']>0)) - { - $magic->atackUser($u->info['id'],$ua['id'],$ua['team'],$ua['battle'],$ua['bbexp'],50); - - $rtxt = '[img[items/pal_button8.gif]] "'.$u->info['login'].'" совершил'.$sx.' нападение по метке на персонажа "'.$ua['login'].'".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')"); - - header('location: main.php'); - die(); - }else{ - if($ua['room']!=$u->info['room']){ - //Персонаж в другой комнате - $u->error = 'Персонаж находится в другой комнате'; - }else{ - $u->error = 'Персонаж имеет слишком малый уровень жизней.'; - } - } - }else{ - //На персонажа нельзя напасть - $u->error = 'Персонаж не в игре, либо на нем нет метки'; - } - } - $u->error = 'Вам запрещается атаковать без разрешения...'; +if (isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user'] != $u->info['id']) { + if ($u->room['noatack'] == 0) { + $ua = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`clan` FROM `users` WHERE`id` = "' . mysql_real_escape_string( + $_GET['atak_user'] + ) . '" LIMIT 1' + ) + ); + $cruw = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `clan_wars` WHERE + ((`clan1` = "' . $ua['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $ua['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND + `time_finish` > ' . time() . ' LIMIT 1' + ) + ); + unset($ua); + if (isset($cruw['id'])) { + $cruw = 1; + } + + $ua = mysql_fetch_array( + mysql_query( + 'SELECT `s`.`team`,`s`.`id`,`s`.`bbexp`,`u`.`battle`,`u`.`id`,`u`.`room`,`u`.`login`,`u`.`online` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE (`s`.`atack` > "' . time( + ) . '" OR `s`.`atack` = 1 OR 1 = ' . $cruw . ') AND `s`.`id` = "' . mysql_real_escape_string( + $_GET['atak_user'] + ) . '" LIMIT 1' + ) + ); + if (isset($ua['id']) && $ua['online'] > time() - 520) { + $usta = $u->getStats($ua['id'], 0); // статы цели + $minHp = $usta['hpAll'] / 100 * 33; // минимальный запас здоровья цели при котором можно напасть + + if ($ua['room'] == $u->info['room'] && ($minHp < $usta['hpNow'] || $ua['battle'] > 0)) { + $magic->atackUser($u->info['id'], $ua['id'], $ua['team'], $ua['battle'], $ua['bbexp'], 50); + + $rtxt = '[img[items/pal_button8.gif]] "' . $u->info['login'] . '" совершил' . $sx . ' нападение по метке на персонажа "' . $ua['login'] . '".'; + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time( + ) . "','6','0','1')" + ); + + header('location: main.php'); + die(); + } else { + if ($ua['room'] != $u->info['room']) { + //Персонаж в другой комнате + $u->error = 'Персонаж находится в другой комнате'; + } else { + $u->error = 'Персонаж имеет слишком малый уровень жизней.'; + } + } + } else { + //На персонажа нельзя напасть + $u->error = 'Персонаж не в игре, либо на нем нет метки'; + } + } + $u->error = 'Вам запрещается атаковать без разрешения...'; } -//mysql_query('START TRANSACTION'); - -if($u->info['battle_text']!='') -{ - //Показываем системку и заносим данные - if($u->info['last_b']>0) - { - mysql_query('INSERT INTO `battle_last` (`battle_id`,`uid`,`time`,`act`,`level`,`align`,`clan`,`exp`) VALUES ("'.$u->info['last_b'].'","'.$u->info['id'].'","'.time().'","'.$u->info['last_a'].'","'.$u->info['level'].'","'.$u->info['align'].'","'.$u->info['clan'].'","'.$u->info['exp'].'")'); - } - mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); +if ($u->info['battle_text'] != '') { + //Показываем системку и заносим данные + if ($u->info['last_b'] > 0) { + mysql_query( + 'INSERT INTO `battle_last` (`battle_id`,`uid`,`time`,`act`,`level`,`align`,`clan`,`exp`) VALUES ("' . $u->info['last_b'] . '","' . $u->info['id'] . '","' . time( + ) . '","' . $u->info['last_a'] . '","' . $u->info['level'] . '","' . $u->info['align'] . '","' . $u->info['clan'] . '","' . $u->info['exp'] . '")' + ); + } + mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); } -/*echo ' - - - - - - - - - - -'; -*/ -/*-----------------------*/ -$act = -2; $act2 = 0; -$u->stats = $u->getStats($u->info['id'],0); -$u->aves = $u->ves(NULL); -if(!isset($u->stats['act'])) -{ - $u->stats['act'] = 0; +$act = -2; +$act2 = 0; +$u->stats = $u->getStats($u->info['id'], 0); +$u->aves = $u->ves(null); +if (!isset($u->stats['act'])) { + $u->stats['act'] = 0; } -if($u->stats['act']==1) -{ - $act = 1; +if ($u->stats['act'] == 1) { + $act = 1; } -$u->rgd = $u->regen($u->info['id'],0,0); +$u->rgd = $u->regen($u->info['id'], 0, 0); //Проверка уровня -$ul = $u->testLevel(); -if($ul==1) -{ - $act = 1; -} -if($u->info['repass'] > 0 && $u->info['id'] != 5433446) { -function GetRealIp() -{ - if (!empty($_SERVER['HTTP_CLIENT_IP'])) - { - $ip=$_SERVER['HTTP_CLIENT_IP']; - } - elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - { - $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; - } - else - { - $ip=$_SERVER['REMOTE_ADDR']; - } - return $ip; +$ul = $u->testLevel(); +if ($ul == 1) { + $act = 1; } -/*-----------------------*/ -if($u->info['battle']==0) -{ - //Проверка/Снятие эффектов - - //Проверка/Снятие предметов - //$act2 = $u->testItems($u->info['id'],$u->stats,0); - if($act2!=-2 && $act==-2) - { - $act = $act2; - } - - if(!isset($u->tfer['id']) && $u->room['block_all'] == 0) - { - //Одеть/снять предмет - if(isset($_GET['rstv']) && isset($_GET['inv'])) { - $act = $u->freeStatsMod($_GET['rstv'],$_GET['mf'],$u->info['id']); - }elseif(isset($_GET['ufs2']) && isset($_GET['inv'])) - { - $act = $u->freeStats2Item($_GET['itmid'],$_GET['ufs2'],$u->info['id'],1); - }elseif(isset($_GET['ufs2mf']) && isset($_GET['inv'])) - { - $act = $u->freeStats2Item($_GET['itmid'],$_GET['ufs2mf'],$u->info['id'],2); - }elseif(isset($_GET['ufsmst']) && isset($_GET['inv'])) - { - $act = $u->itemsSmSave($_GET['itmid'],$_GET['ufsmst'],$u->info['id']); - }elseif(isset($_GET['ufsms']) && isset($_GET['inv'])) - { - $act = $u->itemsSmSave($_GET['itmid'],$_GET['ufsms']+100,$u->info['id']); - }elseif(isset($_GET['ufs']) && isset($_GET['inv'])) - { - $act = $u->freeStatsItem($_GET['itmid'],$_GET['ufs'],$u->info['id']); - }elseif(isset($_GET['sid']) && isset($_GET['inv'])) - { - $act = $u->snatItem($_GET['sid'],$u->info['id']); - }elseif(isset($_GET['oid']) && isset($_GET['inv'])) - { - $act = $u->odetItem($_GET['oid'],$u->info['id']); - }elseif(isset($_GET['item_rune']) && isset($_GET['inv'])) - { - $act = $u->runeItem(NULL); - }elseif(isset($_GET['remitem'],$_GET['inv'])) - { - $act = $u->snatItemAll($u->info['id']); - }elseif(isset($_GET['delete']) && isset($_GET['inv']) && $u->newAct($_GET['sd4'])) - { - $u->deleteItem(intval($_GET['delete']),$u->info['id']); - }elseif(isset($_GET['stack']) && isset($_GET['inv'])) - { - $u->stack($_GET['stack']); - }elseif(isset($_GET['unstack']) && isset($_GET['inv'])) - { - $u->unstack($_GET['unstack']); - }elseif(isset($_GET['end_qst_now'])) - { - $q->endq((int)$_GET['end_qst_now'],'end'); - } - //Использовать эффект - if(isset($_GET['use_pid'])) - { - $magic->useItems((int)$_GET['use_pid']); - } - } +if ($u->info['repass'] > 0 && $u->info['id'] != 5433446) { + function GetRealIp() + { + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } else { + $ip = $_SERVER['REMOTE_ADDR']; + } + return $ip; + } -}elseif($u->info['battle_text']!='') -{ - //Показываем системку и заносим данные - if($u->info['last_b']>0) - { - - } - mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + /*-----------------------*/ + if ($u->info['battle'] == 0) { + if ($act2 != -2 && $act == -2) { + $act = $act2; + } + + if (!isset($u->tfer['id']) && $u->room['block_all'] == 0) { + //Одеть/снять предмет + if (isset($_GET['rstv']) && isset($_GET['inv'])) { + $act = $u->freeStatsMod($_GET['rstv'], $_GET['mf'], $u->info['id']); + } elseif (isset($_GET['ufs2']) && isset($_GET['inv'])) { + $act = $u->freeStats2Item($_GET['itmid'], $_GET['ufs2'], $u->info['id'], 1); + } elseif (isset($_GET['ufs2mf']) && isset($_GET['inv'])) { + $act = $u->freeStats2Item($_GET['itmid'], $_GET['ufs2mf'], $u->info['id'], 2); + } elseif (isset($_GET['ufsmst']) && isset($_GET['inv'])) { + $act = $u->itemsSmSave($_GET['itmid'], $_GET['ufsmst'], $u->info['id']); + } elseif (isset($_GET['ufsms']) && isset($_GET['inv'])) { + $act = $u->itemsSmSave($_GET['itmid'], $_GET['ufsms'] + 100, $u->info['id']); + } elseif (isset($_GET['ufs']) && isset($_GET['inv'])) { + $act = $u->freeStatsItem($_GET['itmid'], $_GET['ufs'], $u->info['id']); + } elseif (isset($_GET['sid']) && isset($_GET['inv'])) { + $act = $u->snatItem($_GET['sid'], $u->info['id']); + } elseif (isset($_GET['oid']) && isset($_GET['inv'])) { + $act = $u->odetItem($_GET['oid'], $u->info['id']); + } elseif (isset($_GET['item_rune']) && isset($_GET['inv'])) { + $act = $u->runeItem(null); + } elseif (isset($_GET['remitem'], $_GET['inv'])) { + $act = $u->snatItemAll($u->info['id']); + } elseif (isset($_GET['delete']) && isset($_GET['inv']) && $u->newAct($_GET['sd4'])) { + $u->deleteItem(intval($_GET['delete']), $u->info['id']); + } elseif (isset($_GET['stack']) && isset($_GET['inv'])) { + $u->stack($_GET['stack']); + } elseif (isset($_GET['unstack']) && isset($_GET['inv'])) { + $u->unstack($_GET['unstack']); + } elseif (isset($_GET['end_qst_now'])) { + $q->endq((int)$_GET['end_qst_now'], 'end'); + } + //Использовать эффект + if (isset($_GET['use_pid'])) { + $magic->useItems((int)$_GET['use_pid']); + } + } + + } elseif ($u->info['battle_text'] != '') { + mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + + if ($magic->youuse > 0) { + $act = 1; + } + //Получение статов + if ($act != -2) { + $u->stats = $u->getStats($u->info['id'], 0, 1); + $u->aves = $u->ves(null); + $act2 = $u->testItems($u->info['id'], $u->stats, 0); + if ($act2 != -2 && $act == -2) { + $act = $act2; + } + } } -if($magic->youuse > 0) -{ - $act = 1; +if ( + (isset($_GET['zayvka']) && $u->info['battle'] == 0) || + (isset($_GET['zayvka']) && ($_GET['r'] == 6 || $_GET['r'] == 7 || !isset($_GET['r'])) && $u->info['battle'] > 0) && + !isset($u->tfer['id'])) { + include('modules_data/_zv.php'); } -//Получение статов -if($act!=-2) -{ - $u->stats = $u->getStats($u->info['id'],0,1); - $u->aves = $u->ves(NULL); - $act2 = $u->testItems($u->info['id'],$u->stats,0); - if($act2!=-2 && $act==-2) - { - $act = $act2; - } -} -} - -if((isset($_GET['zayvka']) && $u->info['battle']==0) || (isset($_GET['zayvka']) && ($_GET['r']==6 || $_GET['r']==7 || !isset($_GET['r'])) && $u->info['battle']>0) && !isset($u->tfer['id'])) -{ - include('modules_data/_zv.php'); -} - -/*-----------------------*/ -/* -if(isset($_GET['security']) && !isset($u->tfer['id']) && $trololo==1) -{ - include('modules_data/_changepass.php'); -}elseif(isset($_GET['quests'])) -{ - include('modules_data/_quests.php'); -}elseif($u->info['level']>1 && isset($_GET['friends']) && !isset($u->tfer['id'])) -{ - include('modules_data/_friends.php'); -}elseif((($u->info['align']>=1 && $u->info['align']<2) || $u->info['admin']>0) && isset($_GET['light']) && !isset($u->tfer['id'])) -{ - include('modules_data/_mod.php'); -}elseif((($u->info['align']>=3 && $u->info['align']<4) || $u->info['admin']>0) && isset($_GET['dark']) && !isset($u->tfer['id'])) -{ - include('modules_data/_mod.php'); -}elseif(($u->info['clan']>0 || (($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4))) && isset($_GET['clan']) && !isset($u->tfer['id'])) -{ - if(($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4)) { - include('modules_data/_clan.php'); - }else{ - include('modules_data/_clan_oldversion.php'); - } -}elseif(isset($_GET['admin']) && $u->info['admin']>0) -{ - if($u->info['id']==7) { - include('modules_data/_light.php'); - }else{include('modules_data/_mod.php');} -}elseif(isset($_GET['help'])) -{ - include('modules_data/help.php'); -}elseif(isset($_GET['vip']) && !isset($u->tfer['id'])) -{ - include('modules_data/vip.php'); -}elseif((isset($_GET['zayvka']) && $u->info['battle']==0) || (isset($_GET['zayvka']) && ($_GET['r']==6 || $_GET['r']==7 || !isset($_GET['r'])) && $u->info['battle']>0) && !isset($u->tfer['id'])) -{ - if($u->room['zvsee'] == 1) { - include('modules_data/_zv2.php'); - }else{ - include('modules_data/_zv.php'); - } -}elseif(isset($_GET['alh']) && $u->info['level']>0 && !isset($u->tfer['id'])) -{ - include('modules_data/_alh.php'); -}elseif(isset($_GET['alhp']) && $u->info['admin']==1 && !isset($u->tfer['id'])) -{ - include('modules_data/_alhp.php'); -}elseif($u->info['battle']!=0) -{ - //поединок - include('modules_data/btl_.php'); -}else{ - if(isset($_GET['talk']) && !isset($u->tfer['id'])) - { - if($u->info['dnow']>0 && !isset($u->tfer['id'])) - { - include('_incl_data/class/__dungeon.php'); - } - include('modules_data/_dialog.php'); - }elseif(isset($_GET['act_sec']) && !isset($u->tfer['id']) && $trololo==1) - { - include('modules_data/_security.php'); - }elseif(isset($_GET['inv']) && !isset($u->tfer['id']) && $trololo==1) - { - include('modules_data/_inv.php'); - }elseif(isset($_GET['cryshop']) && !isset($u->tfer['id']) && $trololo==1 && $u->info['level']>0) - { - include('modules_data/_cryshop.php'); - }elseif(isset($_GET['referals']) && $trololo==1 && !isset($u->tfer['id']) && $u->info['level']>0){ - include('modules_data/_ref.php'); - }elseif(isset($_GET['obraz']) && !isset($u->tfer['id']) && $trololo==1) - { - include('modules_data/_obraz.php'); - }elseif(isset($_GET['skills']) && !isset($u->tfer['id']) && $trololo==1) - { - include('modules_data/_umenie.php'); - }elseif((isset($_GET['transfer']) || isset($u->tfer['id'])) && $u->info['level']>=$c['level_ransfer'] && $trololo==1) - { - include('modules_data/_transfers.php'); - }elseif(isset($_GET['anketa']) && !isset($u->tfer['id']) && $trololo==1) - { - include('modules_data/_anketa.php'); - }elseif(isset($_GET['pet']) && $u->info['animal']>0 && $trololo==1) - { - include('modules_data/_animal.php'); - }elseif(isset($_GET['act_trf']) && $u->room['block_all']==0) { - include('modules_data/act_trf.php'); - }elseif(!isset($u->tfer['id'])) - { - include('modules_data/_locations.php'); - } -} -*/ - -//mysql_query('COMMIT'); - -if($u->room['name']=='Башня Смерти' && $u->info['inUser']>0 && $u->info['lost']>0) -{ - //mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //кидаем травму - //header('location: main.php'); -} - -//Проверяем квесты на готовность -//$q->testquest(); - -/*-----------------------*/ -/*echo ' -';*/ - -//unlink($lock_file); mysql_query('UNLOCK TABLES'); -?> diff --git a/map.php b/map.php index 951fdb79..bcfb2a46 100644 --- a/map.php +++ b/map.php @@ -1,18 +1,19 @@ info['banned'] > 0 || !isset($u->info['id'])) { +if($u->info['banned'] || !isset($u->info['id'])) { header('location: /index.php'); die(); } diff --git a/modules_data/1_panel.php b/modules_data/1_panel.php index eda62d47..150c6cf7 100644 --- a/modules_data/1_panel.php +++ b/modules_data/1_panel.php @@ -1,87 +1,75 @@ - - var elem = document.getElementById('se-pre-con'); - elem.parentNode.removeChild(elem); - - "; -if(!defined('GAME')) -{ - die(); +info['align'] !== 1) { + exit(); } -if($u->info['align']>=1 && $u->info['align']<2) { -if($u->error!='') -{ - echo ''.$u->error.'
    '; + +if ($u->error) { + echo '' . $u->error . '
    '; } -$vu = array(0,0,0,0,0,0,0); + //Абилки $item_light -$item_light = array( -"" => array( - array(5048,1,0,0,0,'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1',1) - //array(5049,1,0,0,0,'usefromfile=1|musor=1|noremont=1|useOnLogin=1|tr_align=1|srok=86400|nosale=1|sudba=1',1) - //Для темного//array(4398,113,0,0,0,'useOnLogin=1|onlyOne=1|oneType=37|noremont=1|musor=1|tr_align=1|sudba='.$u->info['login'].'|srok=86400|nosale=1',1), - - ), -); -$vi = array( -); +$item_light = [ + [5048, 1, 0, 0, 0, 'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1', 1], +]; +$vi = []; +$vnr = [0 => 'на сегодня', 1 => ' всего']; +$seet = ''; +foreach ($item_light as $item) { + if (!$item[1]) { + continue; + } + $itm = Db::getRow('select * from items_main where id = ?', [$item[0]]); + if (!$itm['id']) { + continue; + } + $vix = 0; + if ($item[4] === 0) { + $vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . strtotime('now 00:00:00') . ' AND `vars` = "dark_itm' . $itm['id'] . '"', + 2); + } else { + $vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . $vt['timeUse'] . ' AND `vars` = "dark_itm' . $itm['id'] . '" ', + 2); + } + $vix = $vix[0]; + if ($item[1] - $vix > 0 && $_GET['take_item_light_panel'] == $itm['id']) { + $nitm = $u->addItem($itm['id'], $u->info['id'], $item[5]); + $u->addAction(time(), 'dark_itm' . $itm['id'], ''); + echo 'Предмет "' . $itm['name'] . '" перемещен к Вам в инвентарь!

    '; + } + + //Вывод предметов + $seet0 = ' '; + if ($item[1] - $vix > 0) { + $seet0 = '' . $seet0 . ''; + } else { + $seet0 = '' . $seet0 . ''; + } + $seet .= $seet0; +} + ?> - - - - - -

    Светлая Сила с нами, собрат microLogin($u->info['id'],1)?>

    - - -
    -

    Абилки:
    (Чтобы забрать предмет просто нажмите на его изображение)

    -

    - 'на сегодня',1 => ' всего'); - while($i < count($item_light[$lightn_panel])) { - if($item_light[$lightn_panel][$i][1]>0) { - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_light[$lightn_panel][$i][0].'" LIMIT 1')); - if(isset($itm['id'])) { - $vix = 0; - if($item_light[$lightn_panel][$i][4] == 0) { - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "dark_itm'.$itm['id'].'"',2); - $vix = $vix[0]; - }else{ - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "dark_itm'.$itm['id'].'" ',2); - $vix = $vix[0]; - } - if($item_light[$lightn_panel][$i][1]-$vix > 0) { - if(isset($_GET['take_item_light_panel']) && $_GET['take_item_light_panel'] == $itm['id']) { - $nitm = $u->addItem($itm['id'],$u->info['id'],$item_light[$lightn_panel][$i][5]); - if($item_light[$lightn_panel][6]>0) { - } - $u->addAction(time(),'dark_itm'.$itm['id'],''); - echo 'Предмет "'.$itm['name'].'" перемещен к Вам в инвентарь!

    '; - } - } - $seet0 = ''; - //Вывод предметов - $seet0 .= ' '; - if($item_light[$lightn_panel][$i][1]-$vix > 0) { - $seet0 = ''.$seet0.''; - }else{ - $seet0 = ''.$seet0.''; - } - $seet .= $seet0; - } - } - $i++; - } -} - echo $seet; - ?> -

    - - \ No newline at end of file + + + +

    Светлая Сила с нами, собрат microLogin($u->info['id'], 1) ?>

    +
    + + +
    +
    +
    Абилки:
    (Чтобы забрать предмет просто нажмите на его изображение)
    +
    +
    diff --git a/modules_data/_NewLocations.php b/modules_data/_NewLocations.php index 3d2d76c1..cbae2a0f 100644 --- a/modules_data/_NewLocations.php +++ b/modules_data/_NewLocations.php @@ -221,7 +221,7 @@ if(isset($_GET['loc'])) } if($u->info['room']==209){ - include('_incl_data/class/__zv.php'); + $zv = new FightRequest(); } if($re!=''){ diff --git a/modules_data/_bukmeker.php b/modules_data/_bukmeker.php index 9c20b3b4..c8080bd9 100644 --- a/modules_data/_bukmeker.php +++ b/modules_data/_bukmeker.php @@ -1,112 +1,137 @@ - - var elem = document.getElementById('se-pre-con'); - elem.parentNode.removeChild(elem); - - "; -if(!defined('GAME')) -{ - die(); +info['bukmeker'] && !$u->info['admin']) { + die(); } -if($u->info['bukmeker']<>1 && $u->info['admin']<>1){ - die('

    Не нужно так делать!

    '); -} -?> - - -
    -

    Добро пожаловать в панель Букмекера, персонаж info['login']?>

    -info['id'])."' LIMIT 1")); -if(isset($ba['id'])) { +$ba = mysql_fetch_array(mysql_query("SELECT * FROM `bank_alh` WHERE `uid` = " . $u->info['id'])); ?> - - - - -
    -

    Доступно

    - кр. -
    - - microLogin($uba['id'],1).'
    '; - }else{ - echo 'Банковский счет заблокирован, либо не найден.
    '; - unset($_POST['buy_cr']); - } - echo '
    '; - if(isset($uba['login'])) { - $_POST['buk_cr'] = round($_POST['buk_cr'],2); - if(isset($_POST['buk_cr']) && $_POST['buk_cr'] < 1) { - echo 'Минимальная сумма перевода: 1 кр.
    '; - unset($_POST['buk_cr']); - }elseif($_POST['buk_cr'] > $ba['cr']) { - echo 'Недостаточно средств на счете
    '; - unset($_POST['buk_cr']); - } - if(isset($_POST['buygoodluck'])) { - echo ''; - $ba['cr'] -= $_POST['buk_cr']; - $ba['USD'] += round($_POST['buk_cr']*$ucur,2); - mysql_query('UPDATE `bank_alh` SET `cr` = "'.mysql_real_escape_string($ba['cr']).'",`USD` = "'.mysql_real_escape_string($ba['USD']).'" WHERE `id` = "'.$ba['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `money` = `money` + '.mysql_real_escape_string($_POST['buk_cr']).' WHERE `login` = "'.$uba['login'].'" LIMIT 1'); - - $money = round($_POST['buk_cr']*$pl['cur'],2); - $money = round($money/100*(100-$ba['procent']),2); - - }else{ - echo 'Сумма кр.:'; - if(!isset($_POST['buk_cr'])) { - echo '              
    '; - }else{ - echo ' '.round((int)$_POST['buk_cr'],2).' кр.'; - echo '   '; - } - } - } - } - - if(isset($_POST['buy_cr'])){ ?> Перевести кр персонажу: - -
    -info['bukmeker']=1 || $u->info['admin']==1){ - if (isset($_POST['systemM']) && !empty($_POST['systemM'])){ - - $r = "Внимание:"; - $r .=' '.$_POST['sysMes'].' [Букмекерская Контора]'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','".$r."','".time()."','6','0')"); - - echo "
    Системное сообщение отправленно"; + + + +

    Панель Букмекера

    +
    + Привет, info['login'] ?>. + + +
    -} -?> \ No newline at end of file + + + + + +
    +

    Доступно

    + кр. +
    +
    + microLogin($uba['id'], 1) . '
    '; + } else { + echo 'Банковский счет заблокирован, либо не найден.
    '; + unset($_POST['buy_cr']); + } + echo '
    '; + if (isset($uba['login'])) { + $_POST['buk_cr'] = round($_POST['buk_cr'], 2); + if (isset($_POST['buk_cr']) && $_POST['buk_cr'] < 1) { + echo 'Минимальная сумма перевода: 1 кр.
    '; + unset($_POST['buk_cr']); + } elseif ($_POST['buk_cr'] > $ba['cr']) { + echo 'Недостаточно средств на счете
    '; + unset($_POST['buk_cr']); + } + if (isset($_POST['buygoodluck'])) { + echo ''; + $ba['cr'] -= $_POST['buk_cr']; + $ba['USD'] += round($_POST['buk_cr'] * $ucur, 2); + mysql_query( + 'UPDATE `bank_alh` SET `cr` = "' . mysql_real_escape_string( + $ba['cr'] + ) . '",`USD` = "' . mysql_real_escape_string( + $ba['USD'] + ) . '" WHERE `id` = "' . $ba['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `users` SET `money` = `money` + ' . mysql_real_escape_string( + $_POST['buk_cr'] + ) . ' WHERE `login` = "' . $uba['login'] . '" LIMIT 1' + ); + + $money = round($_POST['buk_cr'] * $pl['cur'], 2); + $money = round($money / 100 * (100 - $ba['procent']), 2); + + } else { + echo 'Сумма кр.:'; + if (!isset($_POST['buk_cr'])) { + echo '              
    '; + } else { + echo ' ' . round( + (int)$_POST['buk_cr'], 2 + ) . ' кр.'; + echo '   '; + } + } + } + } + + if (isset($_POST['buy_cr'])) { ?> Перевести кр персонажу: +
    +
    +info['bukmeker'] && !$u->info['admin']) { + return; +} +if (!empty($_POST['systemM'])) { + $r = "Внимание: {$_POST['sysMes']} [Букмекерская Контора]"; + mysql_query("INSERT INTO `chat` (`new`,`text`,`time`,`type`) VALUES ('1','" . $r . "', unix_timestamp(),'6')"); + echo "
    Системное сообщение отправлено."; +} +?> +
    +
    + +
    + +
    +
    diff --git a/modules_data/_clan.php b/modules_data/_clan.php index e0237758..77e6d8fe 100644 --- a/modules_data/_clan.php +++ b/modules_data/_clan.php @@ -1,2944 +1,3595 @@ -info['clan'])."' LIMIT 1")); -$cpr = explode('|', $u->info['clan_prava']); - -if(!isset($res['id'])) { - die('Клан был расформирован.'); +info['clan']) . "' LIMIT 1") +); +$cpr = explode('|', $u->info['clan_prava']); + +if (!isset($res['id'])) { + die('Клан был расформирован.'); +} + +if (!isset($_GET['events']) && !isset($_GET['diplom']) && !isset($_GET['control']) && !isset($_GET['deposit']) && !isset($_GET['titul']) && !isset($_GET['rules']) && !isset($_GET['info']) && !isset($_GET['members'])) { + $_GET['events'] = 1; } //Возможности текущего титула -$tt = array( - 0 => array('000000000','Доступные каналы'), - 1 => array(0,'Просмотр событий клана'), - 2 => array(0,'Создание событий клана'), - 3 => array(0,'Просмотр хранилища'), - 4 => array(0,'Использование вещей из хранилища'), - 5 => array(0,'Изъятие предметов из хранилища'), - 6 => array(0,'Просмотр казны и списка игроков, пополнявших казну'), - 7 => array(0,'Пополнение казны и доступ к абилкам'), - 8 => array(0,'Использование казны'), - 9 => array(0,'Прием в клан'), - 10 => array(0,'Изгнание из клана'), - 11 => array(0,'Редактирование информации о клане'), - 12 => array(0,'Клановые союзы и альянсы'), - 13 => array(0,'Управление клановыми союзами и альянсами'), - 14 => array(0,'Обьявление войны'), - 15 => array(0,0), - 15 => array(0,0), - 16 => array(0,0), - 17 => array(0,0), - 18 => array(0,0), - 19 => array(0,0), - 20 => array(0,0) -); +$tt = [ + 0 => ['000000000', 'Доступные каналы'], + 1 => [0, 'Просмотр событий клана'], + 2 => [0, 'Создание событий клана'], + 3 => [0, 'Просмотр хранилища'], + 4 => [0, 'Использование вещей из хранилища'], + 5 => [0, 'Изъятие предметов из хранилища'], + 6 => [0, 'Просмотр казны и списка игроков, пополнявших казну'], + 7 => [0, 'Пополнение казны и доступ к абилкам'], + 8 => [0, 'Использование казны'], + 9 => [0, 'Прием в клан'], + 10 => [0, 'Изгнание из клана'], + 11 => [0, 'Редактирование информации о клане'], + 12 => [0, 'Клановые союзы и альянсы'], + 13 => [0, 'Управление клановыми союзами и альянсами'], + 14 => [0, 'Обьявление войны'], + 15 => [0, 0], + 15 => [0, 0], + 16 => [0, 0], + 17 => [0, 0], + 18 => [0, 0], + 19 => [0, 0], + 20 => [0, 0], +]; -if($u->info['clan_prava'] != 'glava') { - $utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$u->info['clan_prava'].'" LIMIT 1')); - if(!isset($utitl['id'])) { - $utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 2 LIMIT 1')); - } +if ($u->info['clan_prava'] != 'glava') { + $utitl = mysql_fetch_array( + mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "' . $u->info['clan_prava'] . '" LIMIT 1') + ); + if (!isset($utitl['id'])) { + $utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 2 LIMIT 1')); + } } else { - $utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 1 LIMIT 1')); + $utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 1 LIMIT 1')); } -if(isset($utitl['id'])) { - $i = 1; - while($i < count($tt)) { - if($utitl['prava'][$i] > 0) { - $tt[$i][0] = 1; - } - $i++; - } +if (isset($utitl['id'])) { + $i = 1; + while ($i < count($tt)) { + if ($utitl['prava'][$i] > 0) { + $tt[$i][0] = 1; + } + $i++; + } } $u->info['tt'] = $tt; //Уровень клана -$lvl_exp = array( - 0 => 0, - 1 => 500000, - 2 => 2000000, - 3 => 5500000, - 4 => 10500000, - 5 => 20500000, - 6 => 35500000, - 7 => 65500000, - 8 => 100000000, - 9 => 200000000, - 10 => 300000000, - 11=> 1000000000 - -); +$lvl_exp = [ + 0 => 0, + 1 => 500000, + 2 => 2000000, + 3 => 5500000, + 4 => 10500000, + 5 => 20500000, + 6 => 35500000, + 7 => 65500000, + 8 => 100000000, + 9 => 200000000, + 10 => 300000000, + 11 => 1000000000, -if($res['exp'] >= $lvl_exp[$res['level']+1]) { - $res['level']++; - mysql_query('UPDATE `clan` SET `level` = "'.$res['level'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES ( - "'.$res['id'].'","'.time().'","'.date('d.m.Y').'","0","127.0.0.1","Администрация","Клановое сообщение","Ваш клан достиг уровня '.$res['level'].'!" - )'); +]; + +if ($res['exp'] >= $lvl_exp[$res['level'] + 1]) { + $res['level']++; + mysql_query('UPDATE `clan` SET `level` = "' . $res['level'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'); + mysql_query( + 'INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES ( + "' . $res['id'] . '","' . time() . '","' . date( + 'd.m.Y' + ) . '","0","127.0.0.1","Администрация","Клановое сообщение","Ваш клан достиг уровня ' . $res['level'] . '!" + )' + ); } -$r1 = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "'.$res['id'].'" AND `date` = "'.date('dmY').'" LIMIT 1')); // читаем позицию клана +$r1 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "' . $res['id'] . '" AND `date` = "' . date( + 'dmY' + ) . '" LIMIT 1' + ) +); // читаем позицию клана //Права клана -$lvl_prava = array( - 0 => array(8,0,0,0,0,50,20,200), - 1 => array(12,1,0,0,0,50,20,200), - 2 => array(16,1,0,0,0,50,20,200), - 3 => array(20,1,0,0,0,50,20,200), - 4 => array(24,1,1,0,0,100,40,200), - 5 => array(28,1,1,0,0,100,40,200), - 6 => array(32,1,1,0,0,100,40,200), - 7 => array(36,1,1,0,0,200,80,200), - 8 => array(40,1,1,1,1,200,80,200), - 9 => array(44,1,1,1,1,200,80,200), - 10 => array(48,1,1,1,1,200,80,200), - 11 => array(52,1,1,1,1,200,80,200) -) +$lvl_prava = [ + 0 => [8, 0, 0, 0, 0, 50, 20, 200], + 1 => [12, 1, 0, 0, 0, 50, 20, 200], + 2 => [16, 1, 0, 0, 0, 50, 20, 200], + 3 => [20, 1, 0, 0, 0, 50, 20, 200], + 4 => [24, 1, 1, 0, 0, 100, 40, 200], + 5 => [28, 1, 1, 0, 0, 100, 40, 200], + 6 => [32, 1, 1, 0, 0, 100, 40, 200], + 7 => [36, 1, 1, 0, 0, 200, 80, 200], + 8 => [40, 1, 1, 1, 1, 200, 80, 200], + 9 => [44, 1, 1, 1, 1, 200, 80, 200], + 10 => [48, 1, 1, 1, 1, 200, 80, 200], + 11 => [52, 1, 1, 1, 1, 200, 80, 200], +] ?> -
    '; - }else{ - $tm_start = floor(($zi['time']+$zi['time_start']-time())/6)/10; - $tm_start = $this->rzv($tm_start); - echo '
    - Ожидаем начала '.$this->z2n[$zi['razdel']].' боя'; - $sv0 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$zi['id'].'" LIMIT 100')); - if($sv0[0] <= 1) - { - if(isset($_GET['cancelzvnow'])) - { - echo ' Заявка на бой отменена'; - $u->info['zv'] = 0; - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }else{ - echo ' Отменить'; - } - } - unset($sv0); - echo '
    Ваш бой начнется через '.$tm_start.' мин.'; - } - }elseif($r==1 || $r==2 || $r==3) - { - //новички,физические,договорные - $zi = array(1=>'Если вы не достигли первого уровня, то для вас это единственный способ для проведения битв.',2=>'Здесь вы можете найти себе достойного противника для сражения.',3=>'Если вы предварительно с кем-то договорились о поединке, то лучше здесь подать заявку.'); - $dv = ''; - if($r==3) - { - $dv = '
    Логин противника - -
    - Бой на деньги, ставка - - -  '; - }else{ - $dv = ''; - if($u->info['level']<4 || $u->info['admin']>0 || $u->info['id']==1011840) - { - $dv .= ' '; - } - } - echo ' -
    - - - - - - -
    '.$zi[$r].'
    - - - - -
    - Подать заявку на бой - Таймаут - - Тип боя - - '.$dv.' -
    -
    '; - }elseif($r==4) - { - //групповые - echo ' - '; - }elseif($r==5) - { - //хаотичные - echo 'Хаотичный бой - разновидность группового, где группы формируются автоматически. Бой не начнется, если собралось меньше 4-х человек.
    - Подать заявку на хаотичный бой -
    - -
    '; - } - }elseif($r==6) - { - //текущие - echo 'Текущие бои...'; - }elseif($r==7) - { - //завершенные - $btl = ''; - $dt = time(); - $slogin = $u->info['login']; - $see = ' - - - - -
     « Предыдущий день

    Записи о завершенных боях за '.date('d.m.Y',$dt).'

    Следующий день » 
    -
    -Показать только бои персонажа: за -
    -
    '; - if($btl=='') - { - $see .= '


    В этот день не было боев, или же, летописец опять потерял свитки...




    '; - }else{ - $see .= $btl; - } - - echo $see; - }else{ - if((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) - { - echo '

    Выберите раздел
    '; - } - } - }else{ - if((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) - { - echo '

    Выберите раздел
    '; - } - } - } - - public function rzv($v) - { - $v = explode('.',$v); - if(!isset($v[1])) - { - $v = $v[0].'.0'; - }else{ - $v = $v[0].'.'.$v[1]; - } - return $v; - } - - public function rzInfo($id) - { - global $u; - $r = ''; - $w = mysql_num_rows(mysql_query('SELECT * FROM `zayvki` WHERE `time` > '.(time()-7200).' AND `city` = "'.$u->info['city'].'" AND `cancel` = "0" AND `start` = "0" AND `razdel` = "'.$id.'" AND (`min_lvl_1` <= '.$u->info['level'].' OR `min_lvl_2` <= '.$u->info['level'].') AND (`max_lvl_1` >= '.$u->info['level'].' OR `max_lvl_2` >= '.$u->info['level'].')')); - if($w>0) - { - $r = ' ('.$w.')'; - } - return $r; - } - - public function testzvu($id,$tm,$bt) - { - $r = 0; - if($bt==0) - { - $r = mysql_num_rows(mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "'.$id.'" AND `team` = "'.$tm.'"')); - }else{ - $r = mysql_num_rows(mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "'.$id.'" AND `team` = "'.$tm.'" AND `bot` = "2"')); - } - return $r; - } - - public function seeZv() - { - global $u,$c,$code,$zi; - if(isset($_GET['r']) && $this->zv_see==1) - { - $r = round(intval($_GET['r'])); - if($r>=1 && $r<=5) - { - //Список заявок - $i = 0; - $cl = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "'.mysql_real_escape_string($r).'" AND `start` = "0" AND `cancel` = "0" AND `time` > "'.(time()-60*60*2).'" AND `city` = "'.$u->info['city'].'" ORDER BY `id` DESC'); - $zvb = ''; - if($r==4 || $r==5) - { - /*echo '
    -
    Показывать заявки -  
    -   -
    -

    ';*/ - } - while($pl = mysql_fetch_array($cl)) - { - if($pl['razdel']==5) - { - //Заявки хаотичного боя - $tm = ''; - $tmStart = floor(($pl['time']+$pl['time_start']-time())/6)/10; - $tmStart = $this->rzv($tmStart); - - $users = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`admin`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`zv` = "'.$pl['id'].'"'); - while($s = mysql_fetch_array($users)) - { - $tm .= $u->microLogin($uz['id'],1).', '; - } - - $rad = ''; - - $tm = rtrim($tm,', '); - - if(!isset($zi['id'])) - { - $rad = ' '; - } - - $n1tv = ''; - - if($pl['invise']==1) - { - //невидимый бой - $tm = 'невидимый'; - $n1tv = ' '; - } - - $zvb .= ''.$rad.''.date('H:i',$pl['time']).' ('.$tm.') ('.$pl['min_lvl_1'].'-'.$pl['max_lvl_1'].') '.$n1tv.' Бой начнется через '.$tmStart.' мин., таймаут '.($pl['timeout']/60).' мин.
    '; - - }elseif($pl['razdel']==4) - { - //Заявки группового боя - $tm1 = ''; - $tm2 = ''; - $tmStart = floor(($pl['time']+$pl['time_start']-time())/6)/10; - $tmStart = $this->rzv($tmStart); - - //Персонаж в заявке, подключаем ему противника - //Ищем апонента для групповых - $rndo = rand(0,1000); - if($rndo < 250) - { - $apo = array(); - if(rand(0,100)<51) - { - $apo['team'] = 1; - }else{ - $apo['team'] = 2; - } - if($this->testzvu($pl['id'],$apo['team'],0) < $pl['tm'.$apo['team'].'max'] && $this->testzvu($pl['id'],$apo['team'],1) < $pl['bot'.$apo['team']]) - { - $spj = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE (`u`.`level` >= '.$pl['min_lvl_'.$apo['team']].' AND `u`.`level` <= '.$pl['max_lvl_'.$apo['team']].') AND `st`.`bot` = "2" AND `u`.`battle` = "0" AND `st`.`zv` = "0" LIMIT 1')); - if(isset($spj['id'])) - { - mysql_query('UPDATE `stats` SET `hpNow` = "3000",`mpNow` = "3000",`zv` = "'.$pl['id'].'",`team` = "'.$apo['team'].'" WHERE `id` = "'.$spj['id'].'" LIMIT 1'); - } - } - } - - //генерируем команды - $users = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`admin`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`zv` = "'.$pl['id'].'"'); - while($s = mysql_fetch_array($users)) - { - ${'tm'.$s['team']} .= $u->microLogin($s['id'],1).', '; - } - - if($tm1=='') - { - $tm1 = 'группа пока не набрана'; - }else{ - $tm1 = rtrim($tm1,', '); - } - - if($tm2=='') - { - $tm2 = 'группа пока не набрана'; - }else{ - $tm2 = rtrim($tm2,', '); - } - $rad = ''; - if(!isset($zi['id'])) - { - $rad = ' '; - } - $zvb .= ''.$rad.''.date('H:i',$pl['time']).' '.$pl['tm1max'].' ('.$pl['min_lvl_1'].'-'.$pl['max_lvl_1'].') на '.$pl['tm2max'].' ('.$pl['min_lvl_2'].'-'.$pl['max_lvl_2'].') ('.$tm1.') против ('.$tm2.') Бой начнется через '.$tmStart.' мин., таймаут '.($pl['timeout']/60).' мин.
    '; - }elseif($pl['razdel']>=1 && $pl['razdel']<=3) - { - $uz = mysql_fetch_array(mysql_query('SELECT `u`.`banned`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$pl['id'].'" AND `st`.`team`="1" LIMIT 1')); - if(isset($uz['id'])) - { - $uze = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$pl['id'].'" AND `st`.`team` = "2" LIMIT 1')); - $d1 = ''; - if($uz['id']==$u->info['id'] || $uze['id']==$u->info['id']) - { - $d1 = 'disabled="disabled"'; - } - if(!isset($uze['id']) || $u->info['zv']==$pl['id']) - { - $enm = ''; - - if(isset($uze['id'])) - { - $enm = ' против '.$u->microLogin($uze['id'],1).''; - } - if($uz['banned']>0) - { - $pl['id'] = 0; - $d1 = 'disabled="disabled"'; - $zvb .= ''; - } - $dp1 = ''; - if($pl['money']>0) - { - $dp1 = ' Бой на деньги, ставка: '.$u->round2($pl['money']).' кр.'; - } - $zvb .= ' '.date('H:i',$pl['time']).' '.$u->microLogin($uz['id'],1).' '.$enm.' тип боя: (таймаут '.round($pl['timeout']/60).' мин.'.$dp1.')
    '; - if($uz['banned']>0){ $zvb .= '
    '; } - } - } - } - $i++; - } - if($i==0) - { - //заявок нет - }else{ - if(!isset($zi['id'])) - { - echo '

    '.$zvb.'
    '; - }else{ - echo $zvb; - } - } - } - } - } - - public function go($id) - { - global $u,$c,$code,$zi,$filter; - if(!isset($zi['id'])) - { - if($u->info['battle']==0) - { - $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="'.mysql_real_escape_string(intval($id)).'" AND `city` = "'.$u->info['city'].'" AND `start` = "0" AND `cancel` = "0" AND `time` > "'.(time()-60*60*2).'" LIMIT 1')); - if(isset($z['id'])) - { - if($z['razdel']>=1 && $z['razdel']<=3) - { - //новички, физы, договорные - $uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$z['id'].'" AND `st`.`team`="1" LIMIT 1')); - if(isset($uz1['id'])) - { - $uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="'.$z['id'].'" AND `st`.`team`="2" LIMIT 1')); - if($u->info['hpNow']<$u->stats['hpAll']/100*30 && ($z['razdel']>=1 || $z['razdel']<=3)) - { - $this->error = 'Вы еще слишком ослаблены чтобы начать новый бой'; - $az = 0; - }elseif($uz1['clan']==$u->info['clan'] && $u->info['clan']!=0) - { - $this->error = 'Вы не можете сражаться против сокланов'; - }elseif($z['money']>0 && $u->info['level']<4) - { - $this->error = 'Бои на деньги проводятся с 4-го уровня'; - }elseif($z['withUser']!='' && $filter->mystr($u->info['login'])!=$filter->mystr($z['withUser']) && $z['razdel']==3) - { - $this->error = 'Вы не можете принять эту заявку'; - }elseif($z['money']>0 && $z['money']>$u->info['money']) - { - $this->error = 'У Вас недостаточно денег, чтобы принять эту заявку'; - }elseif($u->stats['hpNow']stats['hpMax']/100*30)) - { - $this->error = 'Вы слишком ослаблены, восстановитесь'; - }elseif(!isset($uz2['id'])) - { - $upd = mysql_query('UPDATE `stats` SET `zv` = "'.$z['id'].'",`team` = "2" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($upd) - { - $ca = ''; - if($uz1['clan']!=0) - { - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="'.$uz1['clan'].'" LIMIT 1')); - if(isset($pc['id'])) - { - $pc['img'] = $pc['name_mini'].'.gif'; - $ca = ''; - } - } - if($uz1['align']!=0) - { - $ca = ''.$ca; - } - $this->error = 'Ожидаем подтверждения боя от '.$ca.' '.$uz1['login'].' ['.$uz1['level'].']'; - $sa = ''; - if($u->info['sex']==2) - { - $sa = 'а'; - } - $text = ' [login:'.$u->info['login'].'] принял'.$sa.' вашу заявку на бой.[reflesh_main_zv_priem:'.$u->info['id'].']'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('".$uz1['city']."','".$uz1['room']."','','".$uz1['login']."','".$text."','".time()."','10','0')"); - $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = 2; - }else{ - $this->error = 'Невозможно принять заявку.'; - } - }else{ - $this->error = 'Заявку уже кто-то принял до вас.'; - } - }else{ - $this->error = 'Заявка на бой заблокирована.'; - } - }elseif($z['razdel']==4 && $u->info['level']>1) - { - $tm = 0; - //групповые - if(isset($_GET['tm1'])) - { - $tm = 1; - }elseif(isset($_GET['tm2'])) - { - $tm = 2; - }else{ - $this->error = 'Что-то здесь не так'; - } - - if($tm!=0) - { - $t1 = $tm; - $t2 = 1; - $tmmax = 0; - if($tm==1){ $t2 = 2; } - $cl111 = mysql_query('SELECT `u`.`clan`,`st`.`team`,`st`.`id`,`st`.`zv` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv` = "'.$z['id'].'" LIMIT 200'); - $cln = 0; - while($pc111 = mysql_fetch_array($cl111)) - { - if($pc111['clan']==$u->info['clan'] && $u->info['clan']!=0 && $pc111['team']==$t2) - { - $cln++; - } - if($pc111['team']==$t1) - { - $tmmax++; - } - } - if($cln>0) - { - $this->error = 'Вы не можете сражаться против сокланов'; - }elseif($z['tm'.$t1.'max']>$tmmax) - { - if($z['min_lvl_'.$t1]>$u->info['level'] || $z['max_lvl_'.$t1]<$u->info['level']) - { - $this->error = 'Вы не подходите по уровню, за эту команду могут зайти персонажи '.$z['min_lvl_'.$t1].' - '.$z['max_lvl_'.$t1].' уровня'; - }elseif($u->stats['hpNow']stats['hpMax']/100*30)) - { - $this->error = 'Вы слишком ослаблены, восстановитесь'; - }else{ - $upd = mysql_query('UPDATE `stats` SET `zv` = "'.$z['id'].'",`team` = "'.mysql_real_escape_string((int)$t1).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if(!$upd) - { - $this->error = 'Ошибка приема заявки...'; - }else{ - $this->error = 'Вы приняли групповой бой...'; - $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = mysql_real_escape_string((int)$t1); - } - } - }else{ - $this->error = 'Группа уже набрана ('.($z['tm'.$t1.'max']-$tmmax).')'; - } - } - }elseif($z['razdel']==5 && $u->info['level']>1) - { - //хаотичные - if($z['min_lvl_1']>$u->info['level'] || $z['max_lvl_1']<$u->info['level']) - { - $this->error = 'Вы не подходите по уровню, за эту команду могут зайти персонажи '.$z['min_lvl_1'].' - '.$z['max_lvl_1'].' уровня'; - }elseif($u->stats['hpNow']stats['hpMax']/100*30)) - { - $this->error = 'Вы слишком ослаблены, восстановитесь'; - }else{ - $t1 = 1; - - /* считаем баланс */ - if($z['tm1']>$z['tm2']) - { - $t1 = 2; - }elseif($z['tm1']<$z['tm2']) - { - $t1 = 1; - }else{ - $t1 = rand(1,2); - } - - if($z['invise']==1) - { - $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "'.$z['id'].'"')); - $nxtID = $nxtID[0]; - $u->info['login2'] = 'Боец ('.($nxtID+1).')'; - }else{ - $u->info['login2'] = ''; - } - - $blnc = 100*$u->info['level']+10*$u->info['upLevel']+$u->info['exp']+$u->stats['reting']; - - $z['tm'.$t1] += $blnc; - - $upd = mysql_query('UPDATE `stats` SET `zv` = "'.$z['id'].'",`team` = "'.$t1.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if(!$upd) - { - $this->error = 'Ошибка приема заявки...'; - }else{ - mysql_query('UPDATE `users` SET `login2` = "'.$u->info['login2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `zayvki` SET `tm1` = "'.$z['tm1'].'", `tm2` = "'.$z['tm2'].'" WHERE `id` = "'.$z['id'].'" LIMIT 1'); - $this->error = 'Вы приняли хаотичный бой...'; - $zi = $z; - $u->info['zv'] = $z['id']; - $u->info['team'] = mysql_real_escape_string((int)$t1); - } - } - } - }else{ - $this->error = 'Заявка на бой не найдена.'; - } - } - }else{ - $this->error = 'Вы не можете принять бой. Сначала отзовите свою заявку.'; - } - } -} - -$zv = new zayvki; -$zv->test(); //проверяем заявки -?> \ No newline at end of file diff --git a/modules_data/location/_locations.php b/modules_data/location/_locations.php index 7b83d7da..42c8c440 100644 --- a/modules_data/location/_locations.php +++ b/modules_data/location/_locations.php @@ -160,7 +160,7 @@ if(isset($_GET['loc'])) if($u->info['room']==209) { - require_once('_incl_data/class/__zv.php'); + $zv = new FightRequest(); } if($re!=''){ $re = $re.' '; } diff --git a/modules_data/location/a_clanreg.php b/modules_data/location/a_clanreg.php index a07d2dcd..c30f480d 100644 --- a/modules_data/location/a_clanreg.php +++ b/modules_data/location/a_clanreg.php @@ -1,314 +1,291 @@ -room['file']=='a_clanreg') -{ - - +if ($u->room['file'] != 'a_clanreg') { + return; +} function alignc($al) { - if ($al==1){$value="(светлый)";} - elseif ($al==3){$value="(темный)";} - elseif ($al==7){$value="(нейтральный)";} - else {$value="(серый)";} - return $value; -} -// класс загрузки файлов - -class upload { - -protected function __construct() { } - -static $save_path = 'clan_prw/'; -static $error = ''; - -static function saveimg($name,$max_mb = 2,$exts = 'jpg|png|jpeg|gif',$cnm = '',$mnw = 0,$mxw = 0,$mnh = 0,$mxh = 0) { - if (isset($_FILES[$name])) { - $f = &$_FILES[$name]; - - if(isset($f['tmp_name'])) { - $width = 0; - $height = 0; - list($width, $height) = getimagesize($f['tmp_name']); - } - - if( $mnw != 0 && $mnw > $width ) { - self::$error = 'Минимальная ширина картинки '.$mnw.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mxw != 0 && $mxw < $width ) { - self::$error = 'Максимальная ширина картинки '.$mxw.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mnh != 0 && $mnh > $height ) { - self::$error = 'Минимальная высота картинки '.$mnh.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif( $mxh != 0 && $mxh < $height ) { - self::$error = 'Максимальная высота картинки '.$mxh.' пикселей. (Размер этой картинки '.$width.'x'.$height.')'; - }elseif (($f['size'] <= $max_mb*1024*1024) && ($f['size'] > 0)) { - if ( - (preg_match('/\.('.$exts.')$/i',$f['name'],$ext))&& - (preg_match('/image/i',$f['type'])) - ) { - - $ext[1] = strtolower($ext[1]); - $fn = uniqid('f_',true).'.'.$ext[1]; - $fn2 = uniqid('f_',true).'.gif'; - if (move_uploaded_file($f['tmp_name'], self::$save_path . $fn)) { - // система изменения размера , требуется Rimage - //Rimage::resize(self::$save_path . $fn, self::$save_path . $fn2); - //@unlink(self::$save_path . $fn); // удаление файла - return array($fn2,$fn,self::$save_path . $fn); - } else { - self::$error = 'Ошибка загрузки файла'; - } - } else { - self::$error = 'Неверный тип файла. Допустимые типы : '.$exts.''; - } - } else { - self::$error = 'Неверный размер файла. Максимальный размер файла '.$max_mb.' МБ'; - } + if ($al == 1) { + $value = "(светлый)"; + } elseif ($al == 3) { + $value = "(темный)"; + } elseif ($al == 7) { + $value = "(нейтральный)"; } else { - self::$error = 'Файл не найден'; + $value = "(серый)"; } - return false; -} // end saveimg -} // end class + return $value; +} -$lzv = mysql_fetch_array(mysql_query('SELECT * FROM `_clan` WHERE `uid` = "'.$u->info['id'].'" AND `admin_time` = "0" LIMIT 1')); +$lzv = mysql_fetch_array( + mysql_query('SELECT * FROM `_clan` WHERE `uid` = "' . $u->info['id'] . '" AND `admin_time` = "0" LIMIT 1') +); /*Заявка на вступление*/ -if(isset($_POST['clan_enter'])) -{ - - mysql_query('UPDATE `users` SET `clan_zv`= "'.$_POST['clan_enter'].'" WHERE `id` = "'.$u->info['id'].'" '); +if (isset($_POST['clan_enter'])) { + + mysql_query('UPDATE `users` SET `clan_zv`= "' . $_POST['clan_enter'] . '" WHERE `id` = "' . $u->info['id'] . '" '); } /* Регистрация клана */ -if(isset($_POST['clan_name'])) { - /*if($_POST['clan_align'] != 0) { - $_POST['clan_align'] = 0; - }*/ - - $tr_money2 = 0; - if($_POST['clan_align'] == 1) { - $tr_money2 = 50; - $_POST['clan_align'] = 1; - }elseif($_POST['clan_align'] == 3) { - $tr_money2 = 50; - $_POST['clan_align'] = 3; - }elseif($_POST['clan_align'] == 7) { - $tr_money2 = 50; - $_POST['clan_align'] = 7; - } - - $clan_name = substr(htmlspecialchars($_POST['clan_name'],NULL,'cp1251'), 0, 30); - - $cnt = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `name` = "'.mysql_real_escape_string($clan_name).'" LIMIT 1')); - - if(isset($cnt['id'])) { - $re = 'Клан с названием "'.$cnt['name'].'" уже зарегистрирован.'; - }elseif(true == false) { - $re = 'Регистрация кланов временно не работает.'; - }elseif(isset($lzv['id'])) { - $re = 'Вы уже подали заявку на регистрацию клана, ожидайте ответа от администрации'; - //}elseif( $u->testAlign($_POST['clan_align'],$u->info['id']) == 0 ) { - //$re = 'Вы не можете зарегистрировать клан с данной склонностью. (Действует ограничение на выбор склонности для вашего персонажа)'; - }elseif($tr_money2 > $u->info['money2']) { - $re = 'У вас не хватает денег, требуется '.$tr_money2.'екр.'; - }elseif($u->info['clan'] > 0){ - $re = 'Вы состоите в одном из кланов, требуется покинуть его'; - }elseif($u->info['align'] > 0){ - $re = 'Персонажи со склонностью не могут создавать клан, избавьтесь от неё'; - }else{ - /* заносим данные в базу */ - //$clan_name = str_replace('.','',$clan_name); - //$clan_name = str_replace(' ','',$clan_name); - //$clan_name = str_replace(' ','',$clan_name); - if(!preg_match("/^[-a-zA-Z0-9]+$/", $clan_name)) { - $re = 'В названии клана присутствуют запрещенные символы.'; - }elseif($file = upload::saveimg('clan_img1',0.3,'gif',$clan_name,24,24,15,15)) { - //if($file2 = upload::saveimg('clan_img2',0.5,'gif',$clan_name)) { - if($tr_money2 < 0) { - $tr_money2 = 0; - } - $u->info['money2'] -= $tr_money2; - - mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `_clan` (`uid`,`time`,`city`,`name`,`name2`,`site`,`img1`,`img2`,`info`,`money`,`align`) VALUES ( - "'.$u->info['id'].'","'.time().'", - "'.$u->info['city'].'", - "'.mysql_real_escape_string(htmlspecialchars($_POST['clan_name'],NULL,'cp1251')).'", - "'.mysql_real_escape_string(htmlspecialchars($_POST['clan_name'],NULL,'cp1251')).'", - "'.mysql_real_escape_string(htmlspecialchars($_POST['clan_site'],NULL,'cp1251')).'", - "'.mysql_real_escape_string(htmlspecialchars($file[1],NULL,'cp1251')).'", +if (isset($_POST['clan_name'])) { + + $tr_money2 = 0; + if ($_POST['clan_align'] == 1) { + $tr_money2 = 50; + $_POST['clan_align'] = 1; + } elseif ($_POST['clan_align'] == 3) { + $tr_money2 = 50; + $_POST['clan_align'] = 3; + } elseif ($_POST['clan_align'] == 7) { + $tr_money2 = 50; + $_POST['clan_align'] = 7; + } + + $clan_name = substr(htmlspecialchars($_POST['clan_name'], null, 'cp1251'), 0, 30); + + $cnt = mysql_fetch_array( + mysql_query('SELECT * FROM `clan` WHERE `name` = "' . mysql_real_escape_string($clan_name) . '" LIMIT 1') + ); + + $upload = new Uploader($clan_name); + $upload->setMaxFileSize(.3); + $upload->setDimensions(24, 15); + $upload->setExtentions('gif'); + $upload->setSavePath('clan_prw/'); + + if (isset($cnt['id'])) { + $re = 'Клан с названием "' . $cnt['name'] . '" уже зарегистрирован.'; + } elseif (isset($lzv['id'])) { + $re = 'Вы уже подали заявку на регистрацию клана, ожидайте ответа от администрации'; + } elseif ($tr_money2 > $u->info['money2']) { + $re = 'У вас не хватает денег, требуется ' . $tr_money2 . 'екр.'; + } elseif ($u->info['clan'] > 0) { + $re = 'Вы состоите в одном из кланов, требуется покинуть его'; + } elseif ($u->info['align'] > 0) { + $re = 'Персонажи со склонностью не могут создавать клан, избавьтесь от неё'; + } else { + /* заносим данные в базу */ + if (!preg_match("/^[-a-zA-Z0-9]+$/", $clan_name)) { + $re = 'В названии клана присутствуют запрещенные символы.'; + } elseif ($file = $upload->saveimg()) { + if ($tr_money2 < 0) { + $tr_money2 = 0; + } + $u->info['money2'] -= $tr_money2; + + mysql_query( + 'UPDATE `users` SET `money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + mysql_query( + 'INSERT INTO `_clan` (`uid`,`time`,`city`,`name`,`name2`,`site`,`img1`,`img2`,`info`,`money`,`align`) VALUES ( + "' . $u->info['id'] . '","' . time() . '", + "' . $u->info['city'] . '", + "' . mysql_real_escape_string(htmlspecialchars($_POST['clan_name'], null, 'cp1251')) . '", + "' . mysql_real_escape_string(htmlspecialchars($_POST['clan_name'], null, 'cp1251')) . '", + "' . mysql_real_escape_string(htmlspecialchars($_POST['clan_site'], null, 'cp1251')) . '", + "' . mysql_real_escape_string(htmlspecialchars($file[1], null, 'cp1251')) . '", "", "", - "'.$tr_money2.'", - "'.mysql_real_escape_string(htmlspecialchars($_POST['clan_align'],NULL,'cp1251')).'" - )'); - $lzv = array( - 'id' => mysql_insert_id(), - 'name' => htmlspecialchars($_POST['clan_name'],NULL,'cp1251'), - 'time' => time() - ); - $re = 'Вы успешно подали заявку на регистрацию клана "'.htmlspecialchars($_POST['clan_name'],NULL,'cp1251').'". ('.$tr_money2.'екр.)'; - //}else{ - // @unlink($file[2]); // удаление файла - // $re = 'Большой значок: '.upload::$error; - //} - }else{ - $re = 'Маленький значок: '.upload::$error; - } - } + "' . $tr_money2 . '", + "' . mysql_real_escape_string(htmlspecialchars($_POST['clan_align'], null, 'cp1251')) . '" + )' + ); + $lzv = [ + 'id' => mysql_insert_id(), + 'name' => htmlspecialchars($_POST['clan_name'], null, 'cp1251'), + 'time' => time(), + ]; + $re = 'Вы успешно подали заявку на регистрацию клана "' . htmlspecialchars( + $_POST['clan_name'], null, 'cp1251' + ) . '". (' . $tr_money2 . 'екр.)'; + } else { + $re = 'Маленький значок: ' . Uploader::$error; + } + } } ?> - - - - - - -
    -
    -

    Заявка на регистрацию клана

    -
    -
    - '.$re.''; - } - ?> -
    - + +
    - - + + -
      - - - -
    - - - - - - -
    - - - - -
    Страшилкина улица
    +
    +
    +

    Заявка на регистрацию клана

    +
    +
    + ' . $re . ''; + } + ?> +
    +
    + + + + + +
      + + + + +
    + + + + + + +
    + + + + + +
    Страшилкина улица
    +
    +
    +
    +
    +
    -
    -info['clan'] > 0 ) { - $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$u->info['clan'].'" LIMIT 1')); -?> -Вы уже состоите в клане и не можете подать заявку на регистрацию нового клана.

    -
    -

    Клановые войны

    - info['clan_prava'] == 'glava' ) { - echo 'Нет ни одной войны, но вы можете обьявить её!'; - }else{ - echo 'Нет ни одной войны, но ваш глава клана может обьявить её!'; - } - ?> -
    - - - -

    Требования к значку: размер (ШхВ в пикселях) 24х15, графический тип GIF, размер до 30кб.

    -

    - Стоимость регистрации кланов:
    - нейтральный - 50 екр.
    - светлый - 50 екр.
    - тёмный - 50 екр.
    -

    +
    +info['clan'] > 0) { + $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $u->info['clan'] . '" LIMIT 1')); + ?> + Вы уже состоите в клане и не можете подать заявку на регистрацию нового клана.

    +
    +

    Клановые войны

    + info['clan_prava'] == 'glava') { + echo 'Нет ни одной войны, но вы можете обьявить её!'; + } else { + echo 'Нет ни одной войны, но ваш глава клана может обьявить её!'; + } + ?> +
    + + + + + + + + + +

    Требования к значку: размер (ШхВ в пикселях) 24х15, графический тип GIF, размер до 30кб.

    +

    + Стоимость регистрации кланов:
    + нейтральный - 50 + екр.
    + светлый - 50 + екр.
    + тёмный - 50 + екр.
    +

    +

    + Заявка на регистрацию подает будущий глава клана, у которого должна быть при себе необходимая сумма. +

    +
    +
    +
    +

    Заявка на регистрацию клана

    +
    + + Название клана (только английские буквы или цифры, одно слово): + +
    + Клан сайт (необязательно Пример https://new-combats.com/): + +
    + Значок + +
    + Склонность клана + +
    + + +     Вы уже подали заявку на регистрацию клана " + ". Ожидайте ответа от Администрации. + +
    +
    +
    +
    +
    +

    Заявка на вступление в клан

    + info['id'] . '" LIMIT 1') + ); + if ($clnt['clan_zv'] != 0) { + $clnn = mysql_fetch_array( + mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $clnt['clan_zv'] . '" LIMIT 1') + ); + echo 'Вы подали заявку в клан ' . $clnn['name'] . ' ' . alignc( + $clnn['align'] + ) . ' ' . $tmpc . '
    '; + echo 'Ожидайте рассмотрения вашей заявки. Если решения долго нет просто выбирите из списка другой клан.
    '; + } + ?> + Выбирите клан: +
    + +

    + +
    +
    +
    +

    Примечание:

    - Заявка на регистрацию подает будущий глава клана, у которого должна быть при себе необходимая сумма. + При подаче заявки с вас снимается сумма необходимая для регистрации клана.
    + В случаи отказа в регистрации клана (по любой причине), еврокредиты возвращаются персонажу.
    + Администрация вправе отказать в регистрации без объяснения причин.
    + При регистрации клана, глава клана в течении 60 дней не имеет право передавать своё главенство другому + игроку.

    - - - - -
    -
    -

    Заявка на регистрацию клана

    -
    - - Название клана (только английские буквы или цифры, одно слово): - -
    - Клан сайт (необязательно Пример https://new-combats.com/): - -
    - Значок - -
    - Склонность клана - -
    - - -     Вы уже подали заявку на регистрацию клана "". Ожидайте ответа от Администрации. - -
    -
    - - -
    -
    -

    Заявка на вступление в клан

    - info['id'].'" LIMIT 1')); - if ($clnt['clan_zv']!=0) - { - $clnn = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$clnt['clan_zv'].'" LIMIT 1')); - echo 'Вы подали заявку в клан '.$clnn['name'].' '.alignc($clnn['align']).' '.$tmpc.'
    '; - echo 'Ожидайте рассмотрения вашей заявки. Если решения долго нет просто выбирите из списка другой клан.
    '; - } - ?> - Выбирите клан: -
    - -

    - -
    -
    - - - -

    Примечание:

    -

    -При подаче заявки с вас снимается сумма необходимая для регистрации клана.
    -В случаи отказа в регистрации клана (по любой причине), еврокредиты возвращаются персонажу.
    -Администрация вправе отказать в регистрации без объяснения причин.
    -При регистрации клана, глава клана в течении 60 дней не имеет право передавать своё главенство другому игроку. -

    - - \ No newline at end of file + \ No newline at end of file diff --git a/modules_data/location/ab/hramOLD.php b/modules_data/location/ab/hramOLD.php new file mode 100644 index 00000000..be3c1821 --- /dev/null +++ b/modules_data/location/ab/hramOLD.php @@ -0,0 +1,394 @@ +info['id'].'" AND `var` = "qsthram1" AND `val` = 1 LIMIT 1')); +if(isset($qst_hram['id'])) { + $qst_hram = true; +}else{ + $qst_hram = false; + unset($_GET['r']); +}*/ + +$qst_hram = true; + +if($u->room['file']=='ab/hram') +{ + if(isset($_GET['itm']) && $qst_hram == true) + { + + if($_GET['itm']>0) + { + if($_GET['r']==1) + { + $_GET['itm'] = (int)$_GET['itm']; + //Переплавка вещей + $resz = $u->plavka($_GET['itm'],1); + $re = ''.$resz.''; + unset($resz); + }elseif( $_GET['r'] == 2 ){ + //Переплавка рун + $resz = ''; + + $itm123 = explode('x',$_GET['itm']); + + $itm1 = round((int)$itm123[0]); + $itm2 = round((int)$itm123[1]); + $itm3 = round((int)$itm123[2]); + + + $itm1 = mysql_fetch_array(mysql_query('SELECT `a`.`id` AS `iid`,`a`.*,`b`.* FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON (`b`.`id` = `a`.`item_id` AND `b`.`type` = 31) WHERE `a`.`id` = "'.mysql_real_escape_string($itm1).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1')); + $itm2 = mysql_fetch_array(mysql_query('SELECT `a`.`id` AS `iid`,`a`.*,`b`.* FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON (`b`.`id` = `a`.`item_id` AND `b`.`type` = 31) WHERE `a`.`id` = "'.mysql_real_escape_string($itm2).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1')); + $itm3 = mysql_fetch_array(mysql_query('SELECT `a`.`id` AS `iid`,`a`.*,`b`.* FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON (`b`.`id` = `a`.`item_id` AND `b`.`type` = 31) WHERE `a`.`id` = "'.mysql_real_escape_string($itm3).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1')); + + if($itm1['iid'] == $itm2['iid'] || $itm2['iid'] == $itm3['iid'] || $itm1['iid'] == $itm3['iid'] ) { + $resz = 'Не удалось расплавить одну руну, она сгорела.'; + mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$itm3['iid'].'" OR `id` = "'.$itm2['iid'].'" OR `id` = "'.$itm1['iid'].'"'); + }elseif(!isset($itm1['id']) || !isset($itm2['id']) || !isset($itm3['id'])) { + $resz = 'Недостаточно компонентов для преобразования.'; + }elseif( $itm1['level'] != $itm2['level'] || $itm1['level'] != $itm3['level'] ) { + $resz = 'Руны должны быть одного уровня.'; + }elseif( $itm1['level'] == 1 ) { + //$resz = 'Унируны нельзя преобразовывать'; + $itm4 = array(); + $sp = mysql_query('SELECT * FROM `items_main` WHERE `level` = "'.$itm1['level'].'" AND `type` = 31 + AND `id` != "'.$itm1['item_id'].'" AND `id` != "'.$itm2['item_id'].'" AND `id` != "'.$itm3['item_id'].'" AND `id` < 6000'); + while( $pl = mysql_fetch_array($sp) ) { + $itm4[] = $pl; + } + $itm4 = $itm4[rand(0,count($itm4)-1)]; + mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$itm3['iid'].'" OR `id` = "'.$itm2['iid'].'" OR `id` = "'.$itm1['iid'].'"'); + $u->rep['rep1'] += 10; + mysql_query('UPDATE `rep` SET `rep1` = "'.$u->rep['rep1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + $u->addItem($itm4['id'],$u->info['id']); + $resz = 'Удачно преобразованы руны "'.$itm1['name'].'","'.$itm2['name'].'" и "'.$itm3['name'].'" в "'.$itm4['name'].'".'; + $resz .= '
    Добавлена репутация Храма Знаний +10'; + }else{ + $itm4 = array(); + $sp = mysql_query('SELECT * FROM `items_main` WHERE `level` = "'.$itm1['level'].'" AND `type` = 31 + AND `id` != "'.$itm1['item_id'].'" AND `id` != "'.$itm2['item_id'].'" AND `id` != "'.$itm3['item_id'].'"'); + while( $pl = mysql_fetch_array($sp) ) { + $itm4[] = $pl; + } + $itm4 = $itm4[rand(0,count($itm4)-1)]; + mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$itm3['iid'].'" OR `id` = "'.$itm2['iid'].'" OR `id` = "'.$itm1['iid'].'"'); + $u->rep['rep1'] += 1; + mysql_query('UPDATE `rep` SET `rep1` = "'.$u->rep['rep1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + $u->addItem($itm4['id'],$u->info['id']); + $resz = 'Удачно преобразованы руны "'.$itm1['name'].'","'.$itm2['name'].'" и "'.$itm3['name'].'" в "'.$itm4['name'].'".'; + $resz .= '
    Добавлена репутация Храма Знаний +1'; + } + + $re = ''.$resz.''; + unset($resz); + } + } + } +?> + + + + + +
    +
    Храм Знаний
    +
    '.$re.''; } ?>
    +
    + + + + +
      + + + +
    + + + + + + + + +
    + + + + +
    Центральная площадь
     
    +

    +  

    +
    + + + + + + + + +
    getInfoPers($u->info['id'],0); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } ?>
    + + + + + +
    '.$re.''; } ?> + + + + +
    +
      Форум  
    + +
    src="https://img.new-combats.com/city/ap_exit.gif" width="57" height="26" class="aFilter" />
    +
    +
    onclick="location.href='main.php?r=1'" title="Алтарь Предметов" src="https://img.new-combats.com/city/ap_altar1.gif" width="147" height="93" class="aFilter" />
    +
    onclick="location.href='main.php?r=2'" title="Алтарь Рун" src="https://img.new-combats.com/city/ap_altar2.gif" width="147" height="93" class="aFilter" />
    +
    src="https://img.new-combats.com/city/ap_exit.gif" width="57" height="26" class="aFilter" />
    + + +
    +
    + + +
    + +
    +
    + Внимание! Никогда и никому не говорите пароль от своего персонажа. Не вводите пароль на других сайтах, типа "новый город", "лотерея", "там, где все дают на халяву". Пароль не нужен ни паладинам, ни кланам, ни администрации, только взломщикам для кражи вашего героя.
    + Администрация.

    +
    +
    + genInv(11,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete` = "0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`data` NOT LIKE "%fromshop=2%" ORDER BY `lastUPD` DESC'); + if($itmAll[0]==0){ + $itmAllSee = 'ПУСТО (нет подходящих предметов)'; + }else{ + $itmAllSee = $itmAll[2]; + } + //Удачно растворен предмет "Укрепленный Костыль". Получена руна "Моно Бауни". + ?> + + + + + + + + + + +
    microLogin($u->info['id'],1)?>Подходящие предметы в инвентаре
    + Репутация: rep['rep1']; ?> +

    Предмет не выбран

    +
    +
    +
    + Внимание!
    + Предметы при растворении и руны при слиянии необратимо теряются.
    +
    + + + info['invBlock']==0){ echo $itmAllSee; }else{ echo '
    Рюкзак закрыт.
    Введите пароль:
    '; } ?> +
    + +
    +genInv(14,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete` = "0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`type` = 31 ORDER BY `lastUPD` DESC'); + if($itmAll[0]==0){ + $itmAllSee = 'ПУСТО (нет подходящих предметов)'; + }else{ + $itmAllSee = $itmAll[2]; + } + //Удачно растворен предмет "Укрепленный Костыль". Получена руна "Моно Бауни". + ?> + + + + + + + + + + +
    microLogin($u->info['id'],1)?>Подходящие предметы в инвентаре
    + Репутация: rep['rep1']; ?> +

    + + + + + + + +
    ПустоПустоПусто
    + +

    +
    +
    +
    + Внимание!
    + Предметы при растворении и руны при слиянии необратимо теряются.
    +
    + + + info['invBlock']==0){ echo $itmAllSee; }else{ echo '
    Рюкзак закрыт.
    Введите пароль:
    '; } ?> +
    + +
    + + \ No newline at end of file diff --git a/modules_data/location/ab/izlom2.php b/modules_data/location/ab/izlom2.php index 26617c63..be92e546 100644 --- a/modules_data/location/ab/izlom2.php +++ b/modules_data/location/ab/izlom2.php @@ -1,148 +1,149 @@ room['file']=='ab/izlom2') -{ -if(isset($_POST['level'])) -{ - $dop_lvl = 8; //максимально допустимый лвл - if((int)$_POST['level'] <= $u->info['level'] && (int)$_POST['level'] <= $dop_lvl) - { - $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = "31" AND `delete` = "0" LIMIT 1')); - if(!isset($eff1['id'])) - { - if(file_exists('_incl_data/class/__zv.php')) { - if(!isset($zv)) - { - require_once('_incl_data/class/__zv.php'); - } - $zv->startIzlom(1,((int)$_POST['level'])); - }else{ - echo '...'; - } - }else{ - echo 'Вы не можете начать новый поход пока действует эффект "Касание Хаоса"'; - } - }else{ - echo 'Вы не можете начать поход... Выполните больше заданий у Шейлы!'; - } +if ($u->room['file'] != 'ab/izlom2') { + return; +} +if (isset($_POST['level'])) { + $dop_lvl = 8; //максимально допустимый лвл + if ((int)$_POST['level'] > $u->info['level'] || (int)$_POST['level'] > $dop_lvl) { + echo 'Вы не можете начать поход... Выполните больше заданий у Шейлы!'; + } else { + $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = "31" AND `delete` = "0" LIMIT 1')); + if (isset($eff1['id'])) { + echo 'Вы не можете начать новый поход пока действует эффект "Касание Хаоса"'; + } elseif (!isset($zv)) { + $zv = new FightRequest(); + } + } } - ?> - -
    '.$re.''; } ?>
    - - - -
    Излом Хаоса
    -
    - - - - -
      - - - -
    - - - - - - - - -
    - - - - - - - - -
    Излом Хаоса - 16
    Магазин Излома
     
    -
    -
    - + +
    ' . $re . ''; + } ?>
    + + + + +
    +
    Излом Хаоса
    +
    + + + + + +
      + + + + +
    + + + + + + + + + +
    + + + + + + + + + +
    Излом + Хаоса - 16
    Магазин + Излома
    +
     
    +
    +
    +
    +
    +
    - info['level']<7){ echo 'disabled'; } ?>> - Проход в Излом Хаоса (посмотреть рейтинг)
    -

    - -
    - '.date('d.m.Y H:i',$pl['time']).', Волна: '.$pl['voln'].', '.$u->microLogin($pl['uid'],1).'
    '; - } - }-*/ - /*if(!isset($text)) - { - $text = 'История пуста, скорее всего не нашлось смельчаков...'; - } - echo $text; - unset($text);*/ - echo '

    '; - ?> - \ No newline at end of file + +

    + diff --git a/modules_data/location/bank.bac.php b/modules_data/location/bank.bac.php new file mode 100644 index 00000000..81084832 --- /dev/null +++ b/modules_data/location/bank.bac.php @@ -0,0 +1,943 @@ +'; + $subject = mime_header_encode($subject, $data_charset, $send_charset); + $from = mime_header_encode($name_from, $data_charset, $send_charset) + .' <' . $email_from . '>'; + if($data_charset != $send_charset) { + $body = iconv($data_charset, $send_charset, $body); + } + $headers = "From: $from\r\n"; + $headers .= "Content-type: text/html; charset=$send_charset\r\n"; + + return mail($to, $subject, $body, $headers); + } + + function mime_header_encode($str, $data_charset, $send_charset) { + if($data_charset != $send_charset) { + $str = iconv($data_charset, $send_charset, $str); + } + return '=?' . $send_charset . '?B?' . base64_encode($str) . '?='; + } + } + +if($u->room['file']=='bank') +{ + $noc = $c['crtoecr']*2; //120 kr = 1 ekr. + $con = $c['ecrtocr']*2.5; //1 екр. = 30 кр. + function getNum($v) + { + $plid = $v; + $pi = iconv_strlen($plid); + if($pi<5) + { + $i = 0; + while($i<=5-$pi) + { + $plid = '0'.$plid; + $i++; + } + } + return $plid; + } + function getNumId($v) + { + $plid = $v; + $array = str_split($plid); + $ends=0; + $result=''; + for($i=0,$end=(count($array)-1);$i<=$end;$i++){ + if($array[$i]==0 and $ends==0){$array[$i]='';}else{$ends=1;} + $result.=$array[$i]; + } + //print_r($array); + return $result; + } + + if($u->info['allLock'] > time()) { + $u->bank = false; + } + + $re2 = ''; + if(isset($_GET['enter']) && !isset($u->bank['id'])) + { + $bank = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string((int)$_POST['bank']).'" LIMIT 1')); + if(!isset($bank['id'])) + { + $re2 = 'Неверный номер счета.'; + }elseif($bank['pass']!=$_POST['pass']) + { + $pl = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `time` > "'.(time()-60*60).'" AND `vars` = "bank_bad_pass_'.mysql_real_escape_string($bank['id']).'" LIMIT 5')); + if($pl[0]>=3) + { + $re2 = 'Ваш счет был заблокирован на 1 час'; + }else{ + if($pl[0]==0) + { + $re2 = 'Неверный номер счета или пароль. Если вы трижды введете неверный номер счета или пароль, счет будет заблокирован на час'; + }else{ + $pp = array(0=>'ок',1=>'ка',2=>'ки',3=>'ки'); + $re2 = 'Неверный номер счета или пароль. У вас осталось '.(3-$pl[0]).' попыт'.$pp[3-$pl[0]].', в противном случаи счет будет заблокирован на час'; + } + mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`) VALUES ("'.$u->info['id'].'","'.time().'","'.$u->info['city'].'","'.$u->info['room'].'","bank_bad_pass_'.mysql_real_escape_string($bank['id']).'","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'")'); + } + }else{ + + if($u->info['allLock'] > time()) { + echo ''; + }else{ + //вошли! + $bank['useNow'] = time()+12*60*60; + mysql_query('UPDATE `bank` SET `useNow` = "0" WHERE `id` != "'.$bank['id'].'" AND `uid` = "'.$u->info['id'].'" AND `useNow`!="0" LIMIT 1'); + mysql_query('UPDATE `bank` SET `useNow` = "'.$bank['useNow'].'" WHERE `id` = "'.$bank['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'); + mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`) VALUES ("'.$u->info['id'].'","'.time().'","'.$u->info['city'].'","'.$u->info['room'].'","bank_good_pass_'.mysql_real_escape_string($bank['id']).'","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'")'); + $u->bank = $bank; + } + } + }elseif(isset($_GET['res'])) + { + //echo $_GET['schet'].'
    '; + $b_pass = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string(getNumId($_GET['schet'])).'" ORDER BY `id` DESC LIMIT 1')); + if($b_pass['repass'] >= time()) + { + $re2 = 'Номера счетов и пароли к ним можно выслать только один раз в сутки'; + }else{ + mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`) VALUES ("'.$u->info['id'].'","'.time().'","'.$u->info['city'].'","'.$u->info['room'].'","bank_res","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'")'); + $re2 = 'Выслан номер счета и пароль на email, указанный в анкете'; + mysql_query('UPDATE `bank` SET `repass` = "'.(time()+24*3600).'" WHERE `id` = "'.$b_pass['id'].'" LIMIT 1'); + send_mime_mail('Бойцовский Клуб - Support', + 'support@new-combats.com', + ''.$u->info['login'].'', + $u->info['mail'], + 'CP1251', // кодировка, в которой находятся передаваемые строки + 'KOI8-R', // кодировка, в которой будет отправлено письмо + 'Восстановление пароля от счета в банке персонажа '.$u->info['login'].'', + "Номер счета: ".getNum($b_pass['id'])."
    Пароль: ".$b_pass['pass'].'

    С уважением,
    Администрация Бойцовского Клуба'); + + } + }elseif(isset($_GET['open']) && !isset($u->bank['id'])) + { + if( $_POST['rdn01'] == 2 && ($u->info['level'] >= 8 || $u->info['money4'] < 15 )) { + $re2 = 'Недостаточно зубов!'; + }elseif($u->info['money']>=3 || ($u->info['level'] < 8 && $u->info['money4'] >= 15 && $c['zuby'] == true )) + { + if( $_POST['pass1'] == '' || $_POST['pass1'] == ' ' ) { + $re2 = 'Вы не указали пароль!'; + }elseif( $_POST['pass1'] != $_POST['pass2'] ) { + $re2 = 'Пароли не совпадают!'; + }elseif( $u->info['money'] - 3 < 0 && $_POST['rdn01'] != 2 ) { + $re2 = 'У вас недостаточно кр.'; + }elseif($u->info['align']!=2) + { + $pass = rand(10000,91191); + $pass = htmlspecialchars($_POST['pass1'],NULL,'cp1251'); + $ins = mysql_query('INSERT INTO `bank` (`uid`,`create`,`pass`) VALUES ("'.$u->info['id'].'","'.time().'","'.$pass.'")'); + if($ins) + { + $bank = mysql_insert_id(); + if( $u->info['level'] < 8 && $_POST['rdn01'] == 2 && $c['zuby'] == true) { + $u->info['money4'] -= 15; + }else{ + $u->info['money'] -= 3; + } + $upd = mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'",`money4` = "'.$u->info['money4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + $re2 = 'Счет №'.getNum($bank).' был успешно открыт.
    Пароль от счета: '.$pass.'

    (Сменить пароль можно в разделе "Управление счетом" после авторизации)'; + $u->addDelo(3,$u->info['id'],'Вы успешно открыли счет №'.getNum($bank).'',time(),$u->info['city'],'Bank.System',3,0,''); + }else{ + $re2 = 'Банк отказал в получении банковского счета.'; + } + }else{ + $re2 = 'Хаосники не могут создавать новые счета в банке.'; + } + }else{ + if( $u->info['level'] < 8 && $c['zuby'] == true ) { + $re2 = 'Для открытия счета необходимо иметь при себе 3.00 кр. или '.$u->zuby(15).''; + }else{ + $re2 = 'Для открытия счета необходимо иметь при себе 3.00 кр.'; + } + } + }elseif(isset($_GET['exit']) && isset($u->bank['id'])) + { + $u->bank = false; + mysql_query('UPDATE `bank` SET `useNow` = "0" WHERE `uid` = "'.$u->info['id'].'" AND `useNow`!="0" LIMIT 1'); + } + + if($u->info['allLock'] > time()) { + $u->bank = false; + } + + if(isset($u->bank['id'])) + { + if(isset($_POST['sd4']) && $u->newAct($_POST['sd4'])) + { + if(isset($_POST['transfer_kredit2']) && $u->info['admin']>0) + { + //перевод екредитов с одного счета на другой + $ub = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `id` = "'.mysql_real_escape_string((int)$_POST['num2']).'" LIMIT 1')); + if(isset($ub['id']) && $ub['id']!=$u->bank['id']) + { + $ut = mysql_fetch_array(mysql_query('SELECT `id`,`level`,`city`,`room`,`login` FROM `users` WHERE `id` = "'.mysql_real_escape_string($ub['uid']).'" LIMIT 1')); + if($ut['level']>=0 || $ut['id']==$u->info['id'] || $u->info['admin']>0) + { + $mn = floor((int)($_POST['tansfer_sum2']*100)); + $mn = round(($mn/100),2); + $prc = 0; + $mn += $prc; + if($u->bank['money2']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма'; + }else{ + $upd = mysql_query('UPDATE `bank` SET `money2` = "'.mysql_real_escape_string($u->bank['money2']-$mn).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money2'] -= $mn; + $ub['money2'] += $mn-$prc; + + mysql_query('UPDATE `users` SET `catch` = `catch` + "'.floor($mn-$prc).'" WHERE `id` = "'.$ut['id'].'" LIMIT 1'); + mysql_query('UPDATE `users` SET `frg` = `frg` + '.floor($mn).' WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + + mysql_query('UPDATE `bank` SET `money2` = "'.mysql_real_escape_string($ub['money2']).'" WHERE `id` = "'.$ub['id'].'" LIMIT 1'); + $re2 = 'Вы удачно перевели '.($mn-$prc).' екр. (комиссия '.$prc.' екр.) на счет №'.getNum($ub['id']).' персонажу "'.$ut['login'].'"'; + $u->addDelo(3,$ut['id'],'Получено '.($mn-$prc).' екр. со счета №'.getNum($u->bank['id']).' от персонажа "'.$u->info['login'].'", комиссия '.$prc.' екр. (Итого: '.$ub['money1'].' кр., '.$ub['money2'].' екр.)',time(),$ut['city'],'Bank.System',mysql_real_escape_string($mn-$prc),0,$ub['id']); + $u->addDelo(3,$u->info['id'],'Передано '.($mn-$prc).' екр. на счет №'.getNum($ub['id']).' персонажу "'.$ut['login'].'", комиссия '.$prc.' екр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,mysql_real_escape_string($mn),$u->bank['id']); + $log = '"'.$u->info['login'].'" ['.$u->info['level'].'] перевел со своего банковского счета №'.$u->bank['id'].' на счет №'.$ub['id'].' к персонажу "'.$ut['login'].'" ['.$ut['level'].'] '.($mn-$prc).' екр.'; + $u->addDelo(1,$u->info['id'],$log,time(),$u->info['city'],'Bank.System',0,0,''); + $u->addDelo(1,$ut['id'],$log,time(),$ut['city'],'Bank.System',0,0,''); + if($ut['id']!=$u->info['id']) + { + $alg = ''; + if($u->info['align']==50) + { + $alg = ''; + } + $text = '"'.$alg.'[login:'.$u->info['login'].']" перевел'.($u->info['sex']==0?"":"а").' вам '.($mn-$prc).' екр. со своего банковского счета №'.getNum($u->bank['id']).' на ваш банковский счет №'.getNum($ub['id']).'.'; + + mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$ut['city']."','".$ut['room']."','','".$ut['login']."','".$text."','".time()."','12','0','1')"); + } + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет '.$mn.' екр. на счете'; + } + }else{ + $re2 = 'Нельзя перевести кредиты на этот счет'; + } + }else{ + $re2 = 'Нельзя перевести кредиты на этот счет'; + } + }elseif(isset($_POST['transfer_kredit']) && $u->info['align']!=2) + { + //перевод кредитов с одного счета на другой + if($u->info['level']>=4 || $u->info['admin']>0) + { + $ub = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `id` = "'.mysql_real_escape_string((int)$_POST['num']).'" LIMIT 1')); + if(isset($ub['id']) && $ub['id']!=$u->bank['id']) + { + $ut = mysql_fetch_array(mysql_query('SELECT `id`,`level`,`city`,`room`,`login` FROM `users` WHERE `id` = "'.mysql_real_escape_string($ub['uid']).'" LIMIT 1')); + if($ut['level']>=4 || $ut['id']==$u->info['id'] || $u->info['admin']>0) + { + $mn = floor((int)($_POST['tansfer_sum']*100)); + $mn = round(($mn/100),2); + $prc = round($mn*3/100,2); + $mn += $prc; + if($u->bank['money1']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма'; + }else{ + $upd = mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($u->bank['money1']-$mn).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money1'] -= $mn; + $ub['money1'] += $mn-$prc; + mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($ub['money1']).'" WHERE `id` = "'.$ub['id'].'" LIMIT 1'); + $re2 = 'Вы удачно перевели '.($mn-$prc).' кр. (комиссия '.$prc.' кр.) на счет №'.getNum($ub['id']).' персонажу "'.$ut['login'].'"'; + $u->addDelo(3,$ut['id'],'Получено '.($mn-$prc).' кр. со счета №'.getNum($u->bank['id']).' от персонажа "'.$u->info['login'].'", комиссия '.$prc.' кр. (Итого: '.$ub['money1'].' кр., '.$ub['money2'].' екр.)',time(),$ut['city'],'Bank.System',mysql_real_escape_string($mn-$prc),0,$ub['id']); + $u->addDelo(3,$u->info['id'],'Передано '.($mn-$prc).' кр. на счет №'.getNum($ub['id']).' персонажу "'.$ut['login'].'", комиссия '.$prc.' кр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,mysql_real_escape_string($mn),$u->bank['id']); + $log = '"'.$u->info['login'].'" ['.$u->info['level'].'] перевел со своего банковского счета №'.$u->bank['id'].' на счет №'.$ub['id'].' к персонажу "'.$ut['login'].'" ['.$ut['level'].'] '.($mn-$prc).' кр. Дополнительно снято '.$prc.' кр. за услуги банка.'; + $u->addDelo(1,$u->info['id'],$log,time(),$u->info['city'],'Bank.System',0,0,''); + $u->addDelo(1,$ut['id'],$log,time(),$ut['city'],'Bank.System',0,0,''); + if($ut['id']!=$u->info['id']) + { + $text = '"[login:'.$u->info['login'].']" перевел'.($u->info['sex']==0?"":"а").' вам '.($mn-$prc).' кр. со своего банковского счета №'.getNum($u->bank['id']).' на ваш банковский счет №'.getNum($ub['id']).'.'; + mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$ut['city']."','".$ut['room']."','','".$ut['login']."','".$text."','".time()."','6','0','1')"); + } + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет '.$mn.' кр. на счете'; + } + }else{ + $re2 = 'Нельзя перевести кредиты на этот счет'; + } + }else{ + $re2 = 'Нельзя перевести кредиты на этот счет'; + } + }else{ + $re2 = 'Передача кредитов возможна только с 4-го уровня'; + } + }elseif($u->info['align']!=2 && $u->info['haos'] < time() && $u->info['haos'] != 1 && $u->info['align'] !=50 && isset($_POST['convert_kredit']) && $c['crtoecr'] > 0) { + //обменять кр. на екр. + if($u->info['palpro'] > time()) { + $mn = ceil((int)($_POST['convert_sum2']*100)); + $mn = round(($mn/100),2); + $mne = round($mn/$noc,2); + $mn = round(($mn/100*103+5),2); + $sm = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "bank_kr_to_ekr_['.date('d.m.Y',time()).']" ORDER BY `id` DESC LIMIT 1',1); + $sm_lim = 100; + if(isset($sm['id']) && $sm['vals']+$mne > $sm_lim) { + if($sm['vals'] < $sm_lim) { + $re2 = 'На сегодня Вы можете обменять еще на '.($sm_lim-$sm['vals']).' екр.. (Примерно '.round( ( ($sm_lim-$sm['vals'])*$noc ) ,2).' кр.), текущий обмен на '.$mne.' екр..'; + }else{ + $re2 = 'На сегодня Вы исчерпали свой лимит обмена кр. на екр. ('.$sm_lim.' екр.)'; + } + }elseif($mn > 0 && $mne > 0 && $mn >= round((0.01*($noc*1.03)+5),2)) { + if($u->bank['money1'] >= $mn) { + if(!isset($sm['id'])) { + $u->addAction(time(),'bank_kr_to_ekr_['.date('d.m.Y').']',$mne); + }else{ + mysql_query('UPDATE `actions` SET `vals` = "'.($sm['vals']+$mne).'" WHERE `id` = "'.$sm['id'].'" LIMIT 1'); + } + $re2 = 'Вы успешно обменяли '.$mn.' кр. на '.$mne.' екр.'; + $u->bank['money1'] -= $mn; + $u->bank['money2'] += $mne; + + mysql_query('UPDATE `users` SET `catch` = `catch` + "'.round($mne,2).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + + mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($u->bank['money1']).'", `money2` = "'.mysql_real_escape_string($u->bank['money2']).'",`shara` = `shara` + "'.mysql_real_escape_string($mne).'" WHERE `id` = "'.mysql_real_escape_string($u->bank['id']).'" LIMIT 1'); + $log = '"'.$u->info['login'].'" ['.$u->info['level'].'] обменял '.$mn.' кр. на '.$mne.' екр., Банковский счет №'.$u->bank['id'].'.'; + $u->addDelo(1,$u->info['id'],$log,time(),$u->info['city'],'Bank.System',0,0,''); + $u->addDelo(3,$u->info['id'],'Вы успешно обменяли '.ceil((int)($_POST['convert_sum2']*100/100)).' кр. на '.$mne.' екр., комиссия '.round((ceil((int)($_POST['convert_sum2']*100/100))/100*3+5),2).' кр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + }else{ + $re2 = 'У вас нет '.$mn.' кр. на счете'; + } + }else{ + $re2 = 'Минимальная сумма для обмена составляет '.round((0.01*($noc*1.03)+5),2).' кр.'; + } + }else{ + $re2 = 'Вы должны пройти проверку на чистоту у Паладинов или Тарманов.'; + } + }elseif(isset($_POST['convert_ekredit'])) + { + //обменять екр. на кр. + $mn = ceil((int)($_POST['convert_sum']*100)); + $mn = round(($mn/100),2); + if($u->bank['money2']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма'; + }else{ + $upd = mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($u->bank['money1']+($mn*$con)).'",`money2` = "'.mysql_real_escape_string($u->bank['money2']-$mn).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money1'] += $mn*$con; + $u->bank['money2'] -= $mn; + $u->addDelo(3,$u->info['id'],'Вы обменяли '.$mn.' екр. на '.($mn*$con).' кр., комиссия 0 кр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,mysql_real_escape_string($mn*$con),$u->bank['id']); + $re2 = 'Вы удачно обменяли '.$mn.' екр. на '.($mn*$con).' кр.'; + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет '.$mn.' екр. на счете'; + } + }elseif(isset($_POST['get_kredit'])) + { + //положить деньги на счет + $mn = floor((int)($_POST['get_sum']*100)); + $mn = round(($mn/100),2); + if($u->bank['money1']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма (Снять '.((int)$_POST['get_sum']).' кр.)'; + }else{ + $upd = mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']+$mn).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money1'] -= $mn; + $u->info['money'] += $mn; + mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($u->bank['money1']).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + $u->addDelo(3,$u->info['id'],'Вы сняли со счета '.$mn.' кр., комиссия 0 кр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + $re2 = 'Вы удачно сняли со счета '.$mn.' кр.'; + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет '.$mn.' кр. на счете'; + } + }elseif(isset($_POST['get_ekredit'])) + { + //положить деньги на счет + $mn = floor((int)($_POST['get_esum']*100)); + $mn = round(($mn/100),2); + if($u->bank['money2']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма (Снять '.((int)$_POST['get_esum']).' Екр.)'; + }else{ + $upd = mysql_query('UPDATE `users` SET `money2` = "'.mysql_real_escape_string($u->info['money2']+$mn).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money2'] -= $mn; + $u->info['money2'] += $mn; + mysql_query('UPDATE `bank` SET `money2` = "'.mysql_real_escape_string($u->bank['money2']).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + $u->addDelo(3,$u->info['id'],'Вы сняли со счета '.$mn.' Екр., комиссия 0 Екр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + $re2 = 'Вы удачно сняли со счета '.$mn.' Екр.'; + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет '.$mn.' Екр. на счете'; + } + }elseif(isset($_POST['add_ekredit'])) + { + //положить деньги на счет + $mn = floor((int)($_POST['add_esum']*100)); + $mn = round(($mn/100),2); + if($u->info['money2']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма (Пополнение счета)'; + }else{ + $upd = mysql_query('UPDATE `users` SET `money2` = "'.mysql_real_escape_string($u->info['money2']-$mn).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money2'] += $mn; + $u->info['money2'] -= $mn; + mysql_query('UPDATE `bank` SET `money2` = "'.mysql_real_escape_string($u->bank['money2']).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + $u->addDelo(3,$u->info['id'],'Вы положили на счет '.$mn.' Eкр., комиссия 0 Екр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + $re2 = 'Вы удачно положили на свой счет '.$mn.' Екр.'; + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет при себе '.$mn.' Екр.'; + } + }elseif(isset($_POST['add_kredit'])) + { + //положить деньги на счет + $mn = floor((int)($_POST['add_sum']*100)); + $mn = round(($mn/100),2); + if($u->info['money']>=$mn) + { + if($mn<0.01 || $mn>1000000000) + { + $re2 = 'Неверно указана сумма (Пополнение счета)'; + }else{ + $upd = mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']-$mn).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); + if($upd) + { + $u->bank['money1'] += $mn; + $u->info['money'] -= $mn; + mysql_query('UPDATE `bank` SET `money1` = "'.mysql_real_escape_string($u->bank['money1']).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + $u->addDelo(3,$u->info['id'],'Вы положили на счет '.$mn.' кр., комиссия 0 кр. (Итого: '.$u->bank['money1'].' кр., '.$u->bank['money2'].' екр.)',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + $re2 = 'Вы удачно положили на свой счет '.$mn.' кр.'; + }else{ + $re2 = 'Не удалось выполнить операцию'; + } + } + }else{ + $re2 = 'У вас нет при себе '.$mn.' кр.'; + } + }elseif(isset($_POST['change_psw2'])) + { + //смена пароля счета + $sm = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vals` = "id='.$u->bank['id'].'&new_pass='.$u->bank['pass'].'" AND `vars` = "bank_new_pass" AND `time` > "'.(time()-24*60*60).'" LIMIT 1',1); + if($_POST['new_psw1']!=$_POST['new_psw2']) + { + $re2 = 'Пароли не совпадают'; + }elseif(iconv_strlen($_POST['new_psw1'])<6 || iconv_strlen($_POST['new_psw1'])>32) + { + $re2 = 'Пароль не может быть короче 6 или длинее 32 символов'; + }elseif(isset($sm['id'])) + { + $re2 = 'Нельзя менять пароль чаще одного раза в день'; + }else{ + //меняем + $upd = mysql_query('UPDATE `bank` SET `pass` = "'.mysql_real_escape_string($_POST['new_psw1']).'" WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); + if($upd) + { + $u->addAction(time(),'bank_new_pass','id='.$u->bank['id'].'&new_pass='.$_POST['new_psw1'].''); + $u->bank['pass'] = $_POST['new_psw1']; + $re2 = 'Пароль от счета №'.getNum($u->bank['id']).' был успешно изменен
    Новый пароль: '.$u->bank['pass'].''; + $u->addDelo(3,$u->info['id'],'Был изменен пароль от счета.',time(),$u->info['city'],'Bank.System',0,0,$u->bank['id']); + }else{ + $re2 = 'Вам отказали в смене пароля'; + } + } + } + } + } + + if($re!=''){ echo '
    '.$re.'
    '; } ?> + + +
    + + + + + +
    +
    +

    Банк

    +
    +
    +
    + + + + + +
      + + + +
    + + + + + + +
    + + + + +
    Страшилкина улица
    +
    + + + + + + + + + + +
    +
    + '.$re2.'
    '; } + if(!isset($u->bank['id'])) + { + ?> + Мы предоставляем следующие услуги: +
      +
    1. Открытие счета
    2. Возможность положить/снять кредиты/еврокредиты со счета +
    3. Перевести кредиты/еврокредиты с одного счета на другой +
    4. Обменный пункт. Обмен еврокредитов на кредиты +
    + + +
    + Хотите открыть свой счет? Услуга платная: + +
    +
    +
    +
    Управление счетом + + +
    + + + + + +
    Номер счета
    Пароль
    +
    +
    +
    +
    + > +
    +
    + Забыли пароль? Можно его выслать на email, номер счета:
    +
    +
    + + + + +
    + + + + + + + +

    Управление счетом

      +Счёт №: bank['id']); ?> [x]
    +
    +
    +
    У вас на счете + + + + + + + + + +
    Кредитов:round2($u->bank['money1']); ?>
    Еврокредитов:round2($u->bank['money2']); ?>

    При себе наличных:round2($u->info['money']); ?> кр.
    При себе наличных:round2($u->info['money2']); ?> Екр.
    +
    +
    +
    Внимание! Некоторые услуги банка платные, о размере взымаемой комиссии написано в соответствующем разделе.
    + + + + + + +
    + + + + + + + + + + info['align']!=2 && $u->info['haos'] < time() && $u->info['haos'] != 1 && $c['crtoecr'] > 0) { ?> + + + + info['admin']>1000) + { + ?> + + + + + + + + + + +
    + Пополнить счет + Сумма + + кр. + +
    + Сумма + + Екр. + +
    +
    + Перевести кредиты на другой счет + Сумма + + кр.
    + Номер счета куда перевести кредиты + +
    + +
    + Комиссия составляет 3.00 % от суммы, но не менее 1.00 кр. +
    + Обменный пункт + Обменять еврокредиты на кредиты.
    + Курс 1 екр. = .00 кр.
    + Сумма + + екр. + /> +
    + Обменный пункт + Обменять кредиты на еврокредиты.
    + Курс кр. = 1.00 екр.
    + Сумма + + кр. +
    + Комиссия составляет 3.00 % от суммы, а так-же 5.00 кр. + +
    + Перевести еврокредиты на другой счет + Сумма + + екр.
    + Номер счета куда перевести кредиты + +
    + +
    + Комиссия составляет 0.00 % от суммы, но не менее 0.01 екр. +
    + Настройки + У вас разрешена высылка номера счета и пароля на email. Если вы не уверены в своем email, или убеждены, что не забудете свой номер счета и пароль к нему, то можете запретить высылку пароля на email. Это убережет вас от кражи кредитов с вашего счета в случае взлома вашего email. Но если вы сами забудете свой номер счета и/или пароль, вам уже никто не поможет!
    + +
    + Сменить пароль
    + + + + + + + + + +
    Новый пароль
    Введите новый пароль повторно
    + +
    + +
     
    +
    + + + + + + + + + + + + +
    + Снять со счета + Сумма + + кр. + +
    + Сумма + + Eкр. + +
    +
    + Курс еврокредита к мировой валюте + + + + + + + + + + + + + + + + + + + + + + + +
    Данные на без учета комиссий
    1 екр. =
    10UAH = 1 Еврокредит
    0.35USD = 1 Еврокредит
    20RUB = 1 Еврокредит
    0.29EUR = 1 Еврокредит
    +
    + Последние операции + + info['id'].'" AND `dop` = "'.$u->bank['id'].'" AND `type` = "3" ORDER BY `time` DESC LIMIT 21'); + while($pl = mysql_fetch_array($sp)) + { + ?> + + + + +
    '.date('d.m.Y H:i',$pl['time']).' '; echo $pl['text']; ?>
    +
    +
    +Сумма указанная в окне оповещения и суммы взымаемая\начисляемая могут различаться. + \ No newline at end of file diff --git a/modules_data/location/btl_.php b/modules_data/location/btl_.php index 7e4d0661..b72311e8 100644 --- a/modules_data/location/btl_.php +++ b/modules_data/location/btl_.php @@ -1,772 +1,1162 @@ -info['battle'] == 0) { - $u->info['battle'] = $btl_last['battle']; - //die(); +if (!$old_battle) { + return; +} +if (isset($btl_last['id']) && $u->info['battle'] == 0) { + $u->info['battle'] = $btl_last['battle']; } -if($u->info['battle'] == 0 || isset($_GET['bend'])) -{ - //header('location: main.php'); - //die(); - die(''); +if ($u->info['battle'] == 0 || isset($_GET['bend'])) { + die(''); } -$thisBattle = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$u->info['battle'].'" LIMIT 1')); +$thisBattle = mysql_fetch_array( + mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" LIMIT 1') +); -$allprice = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "'.$u->info['battle'].'" GROUP BY `uid` LIMIT 1')); +$allprice = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $u->info['battle'] . '" GROUP BY `uid` LIMIT 1' + ) +); $allprice = $allprice[0]; -function typeBattle($x) { - $r = array(0,0,'Поединок','Кровавый Поединок'); - if( $x < 50000 ) { - //Обычный бой - }elseif( $x >= 50000 && $x < 100000 ) { - $r = array(25,50,'Великая Битва','Кровавая Битва'); - }elseif( $x < 500000 ) { - $r = array(50,75,'Величайшая Битва','Кровавая Резня'); - }elseif( $x < 1000000 ) { - $r = array(75,100,'Историческая Битва','Кровавая Сеча'); - }elseif( $x < 2500000 ) { - $r = array(100,125,'Эпохальная Битва','Кровавое Побоище'); - }elseif( $x >= 5000000 ) { - $r = array(150,150,'Судный День','Судный День'); - } - return $r; +function typeBattle($x) +{ + $r = [0, 0, 'Поединок', 'Кровавый Поединок']; + if ($x < 50000) { + //Обычный бой + } elseif ($x >= 50000 && $x < 100000) { + $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; + } elseif ($x < 500000) { + $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; + } elseif ($x < 1000000) { + $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; + } elseif ($x < 2500000) { + $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; + } elseif ($x >= 5000000) { + $r = [150, 150, 'Судный День', 'Судный День']; + } + return $r; } -$allprice = typeBattle($allprice); - if ($thisBattle['smert'] == 1) - { - $allprice = array(150,150,'Жесточайшее Сражение','Жесточайшее Сражение'); - } -/*if( $u->info['admin'] > 0 ) { - echo ''; -}else{*/ - echo ''; -//} +$allprice = typeBattle($allprice); +if ($thisBattle['smert'] == 1) { + $allprice = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; +} + +echo ''; ?> - + -
    - - - - - - -
    - -
    - - - - - - -
    -
    -
    - - - - - - -
    - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - -
    -
    - - - - - - - - - -
    -
    - - - - - - -
    Атака
    -
    Защита
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    удар в голову 
     блок головы
    -
     блок головы и груди
    -
     блок головы, груди и живота
    удар в грудь 
     блок груди
    -
     блок груди и живота
    -
     блок груди, живота и пояса
    удар в живот 
     блок живота
    -
     блок живота и пояса
    -
     блок живота, пояса и ног
    удар в пояс(пах) 
     блок пояса
    -
     блок пояса и ног
    -
     блок пояса, ног и головы
    удар по ногам 
     блок ног
    -
     блок ног и головы
    -
     блок ног, головы и груди
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
       - - - - - - - info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"style="cursor:pointer;" onclick="top.leaderFight();" id="btn_down_img3" style="cursor:pointer;" title="Передать флаг" src="https://img.new-combats.com/i/ico_change_leader1.gif" width="16" height="19" />
     
    -
    - info['level'] == 0) { ?>
    -
    Просто нажмите Вперёд!!! чтобы сделать рандомный удар

    - + } + //space + if (event.keyCode == 32 && top.c.noEr == 0) { + document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2"); + document.getElementById('reflesh_btn').setAttribute("onclick", ""); + + if (document.getElementById('reflesh_btn').disabled) { + } else { + reflesht(); + top.c.noEr = 1; + clearTimeout(top.c.noErTmr); + top.c.noErTmr = setTimeout('top.c.noEr = 0;', 2000); + } + + } + + if (event.keyCode == 49) { + change_radioKeys(1, false); + } + if (event.keyCode == 50) { + change_radioKeys(2, false); + } + if (event.keyCode == 51) { + change_radioKeys(3, false); + } + if (event.keyCode == 52) { + change_radioKeys(4, false); + } + if (event.keyCode == 53) { + change_radioKeys(5, false); + } + if (event.keyCode == 48) { + change_radioKeys(0, false); + } + + + } + $(document.body).bind('keyup', function (event) { + mbsum(event); + }); + + + function shpb() { + $(document).find('div.pimg').unbind('mouseover'); + $(document).find('div.pimg').unbind('mouseout'); + $(document).find('div.pimg').unbind('mousedown'); + $(document).find('div.pimg').bind('mouseover', function () { + top.hi(this, $(this).attr('stt'), event, 0, 1, 1, 1, 'stt'); + }); + $(document).find('div.pimg').bind('mouseout', function () { + top.hic(); + }); + $(document).find('div.pimg').bind('mousedown', function () { + top.hic(); + }); + var test = $(document).find('div.pimg'); + var i = 0; + while (i != -1) { + if (test[i] != undefined) { + if ($(test[i]).attr('pog') > 1 && $(test[i]).attr('stl') == 0) { + $(test[i]).attr('stl', 1); + $(test[i]).html('' + $(test[i]).attr('pog') + '' + $(test[i]).attr('pog') + '' + $(test[i]).attr('pog') + '' + $(test[i]).attr('pog') + '
    ' + $(test[i]).attr('pog') + '
    ' + $(test[i]).html()); + } else if ($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) { + $(test[i]).attr('stl', 1); + $(test[i]).html('x' + $(test[i]).attr('col') + 'x' + $(test[i]).attr('col') + 'x' + $(test[i]).attr('col') + 'x' + $(test[i]).attr('col') + '
    x' + $(test[i]).attr('col') + '
    ' + $(test[i]).html()); + } + } else { + i = -2; + } + i++; + } + } + +
    + + + + + + +
    + +
    + + + - -
    +
    +
    +
    - info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0"> - - - - - - - - - -
    info['tactic1']; ?> info['tactic2']; ?> info['tactic3']; ?> info['tactic4']; ?> info['tactic5']; ?> info['tactic6']); ?> info['tactic7']<0){ $u->info['tactic7'] = 0; } echo 0+$u->info['tactic7']; ?>
    -
    -
    - - - - - - - -
    -
    -
    -
    -
    -
    - - - - + + +
      -
    -
    - На данный момент вами нанесено урона:  info['battle_yron']); ?> HP .
    - - (Опыт: +info['battle_exp']); ?> ед., Без учета процентов) +
    +
    + + + + + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    +
    +
    + + + + +
    +
    + + + + + + +
    +
    Атака
    +
    +
    -
    +
    +
    Защита
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    удар в голову +   + +
    +
    +
     блок головы
    +
     блок головы и груди
    +
     блок головы, груди и + живота +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    удар в грудь +   + +
    +
    +
     блок груди
    +
     блок груди и живота
    +
     блок груди, живота и пояса +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    удар в живот +   + +
    +
    +
     блок живота
    +
     блок живота и пояса
    +
     блок живота, пояса и ног +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    удар в пояс(пах) +   + +
    +
    +
     блок пояса
    +
     блок пояса и ног
    +
     блок пояса, ног и головы +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    удар по ногам +   + +
    +
    +
     блок ног
    +
     блок ног и головы
    +
     блок ног, головы и груди +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + +
      + + + +   + + + + + + + info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;" + style="cursor:pointer;" onclick="top.leaderFight();" id="btn_down_img3" + style="cursor:pointer;" + title="Передать флаг" + src="https://img.new-combats.com/i/ico_change_leader1.gif" + width="16" height="19"/> +
     
    +
    +
    + info['level'] == 0) { ?> +
    +
    Просто нажмите + Вперёд!!! чтобы сделать рандомный + удар
    +
    + +
    +
    +
    + info['level'] < 2) { + echo ' style="display:none;" '; + } ?> border="0" cellspacing="0" cellpadding="0"> + + + + + + + + + +
    info['tactic1']; ?> info['tactic2']; ?> info['tactic3']; ?> info['tactic4']; ?> info['tactic5']; ?> info['tactic6']); ?> + info['tactic7'] < 0) { + $u->info['tactic7'] = 0; + } + echo 0 + $u->info['tactic7']; ?>
    +
    +
    + + + + + + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + +
      +
    +
    + На данный момент вами нанесено урона:  info['battle_yron']); ?> HP .
    + + (Опыт: +info['battle_exp']); ?> ед., Без учета процентов) +
    +
    +
    +
    Лог боя »»
    + (Бой идет с таймаутом NaN мин.) +
    +
    +
    + + + + + + +
      +
    +
    Полную версию лога боя смотрите здесь »»
    +
     
    -
    Лог боя »»
    - (Бой идет с таймаутом NaN мин.)
    -
    - - - - - - -
     
    Полную версию лога боя смотрите здесь »»

     
    -
    - + - - -
    - + startCountdown(); + genZoneAtack(); + genZoneBlock(); + refleshPoints(); + + + diff --git a/modules_data/location/dragopsh.php b/modules_data/location/dragopsh.php index 4fd149df..f2dcf24f 100644 --- a/modules_data/location/dragopsh.php +++ b/modules_data/location/dragopsh.php @@ -1,937 +1,946 @@ room['file']=='dragopsh') { - - require_once('_incl_data/class/__dungeon.php'); - - $lab = mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "'.$u->info['dnow'].'" LIMIT 1')); - if( !isset($lab['id']) ) { - die('Поход в подземелье не найден...'); - } - - $varsitmsund = array( - //Вещи в сундуках - array(4391,1), - array(1043,1), - array(3106,1), - array(2544,2), - //array(2545,1), - array(724,1), - array(1187,1), - array(1043,1), - array(3106,1), - array(2544,2), - //array(2545,1), - array(724,1), - array(1187,1), - array(1043,1), - array(3106,1), - array(2544,2), - //array(2545,1), - array(724,1), - array(1187,1), - array(1043,1), - array(3106,1), - array(2544,2), - //array(2545,1), - array(724,1), - array(1187,1) - ); - - $varsitm = array( - //Слабые ресурсы - array(4373,1), - array(4374,1), - array(4375,1), - array(4376,1), - array(4377,1), - array(4378,1), - array(4379,1), - array(4380,1), - array(4381,1), - array(4382,1), - array(4383,1), - array(4384,1), - array(4385,1), - // - array(4373,1), - array(4374,1), - array(4375,1), - array(4376,1), - array(4377,1), - array(4378,1), - array(4379,1), - array(4380,1), - array(4381,1), - array(4382,1), - array(4383,1), - array(4384,1), - array(4385,1), - // - array(4373,1), - array(4374,1), - array(4375,1), - array(4376,1), - array(4377,1), - array(4378,1), - array(4379,1), - array(4380,1), - array(4381,1), - array(4382,1), - array(4383,1), - array(4384,1), - array(4385,1) - ); - $varsitmart = array( - //Артефакты - array(2109,1), - array(2111,1), - array(2099,1), - array(2105,1), - array(2122,1), - array(2101,1), - array(2114,1), - array(2107,1), - array(2108,1) - ); - - $map = mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "'.$u->info['dnow'].'" LIMIT 1')); - if( !isset($map['id']) ) { - die('Карта подземелий не найдена...'); - } - - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "'.$u->info['id'].'" AND `dn` = "'.$u->info['dnow'].'" AND `vars` = "dielaba" LIMIT 1')); - $dies = $dies[0]; - - $map_d = json_decode($map['data']); - - $varos = array(); - $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "'.$u->info['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); - - $errors = ''; - $effed = ''; - - if( isset($_GET['takeitm']) ) { - $var = array( - 'obj' => mysql_fetch_array(mysql_query('SELECT `i`.*,`m`.`name`,`m`.`inslot` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`id` = "'.mysql_real_escape_string($_GET['takeitm']).'" AND `i`.`lib` = "'.$lab['id'].'" AND `i`.`x` = "'.$u->info['x'].'" AND `i`.`y` = "'.$u->info['y'].'" LIMIT 1')) - ); - if(isset($var['obj']['id'])) { - if( $var['obj']['take'] == 0 ) { - $var['sex'] = ''; if($u->info['sex'] == 1) { $var['sex'] = 'а'; } - $var['text'] = ''.$u->info['login'].' поднял'.$var['sex'].' предмет "'.$var['obj']['name'].'"'; - $errors .= 'Вы подняли предмет "'.$var['obj']['name'].'"'; - mysql_query('UPDATE `laba_itm` SET `take` = "'.$u->info['id'].'" WHERE `id` = "'.$var['obj']['id'].'" LIMIT 1'); - if( $var['obj']['inslot'] > 0 ) { - $u->addItem($var['obj']['itm'],$u->info['id'],'|fromlaba=1|nosavelaba=1|nosale=1'); - }else{ - $u->addItem($var['obj']['itm'],$u->info['id'],'|fromlaba=1'); - } - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$var['text']."','".time()."','6','0','1','1')"); - }else{ - $errors .= 'Предмет кто-то поднял раньше Вас...'; - } - }else{ - $errors = 'Предмет не найден...'; - } - }elseif( isset($_GET['useobj']) ) { - $var = array( - 'obj' => mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `id` = "'.mysql_real_escape_string($_GET['useobj']).'" AND `lib` = "'.$lab['id'].'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'" LIMIT 1')) - ); - if(isset($var['obj']['id'])) { - if( $var['obj']['use'] == 0 ) { - if( $var['obj']['type'] == 1 ) { - //сунудук - $var['sex'] = ''; if($u->info['sex'] == 1) { $var['sex'] = 'а'; } - - //Выдаем ресурсы, свитки - if( rand(0,100) < 25 ) { - //Выдаем арт varsitmart - $var['itm'] = $varsitm[rand(0,count($varsitm)-1)]; - $var['itm'] = $var['itm'][0]; - $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$var['itm'].'" LIMIT 1')); - if( isset($var['itm']['id']) ) { - mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( - "'.$u->info['id'].'","'.$lab['id'].'","'.time().'","'.$var['itm']['id'].'","'.$u->info['x'].'","'.$u->info['y'].'","0" +if ($u->room['file'] == 'dragopsh') { + + $d = new Dungeon; + $d->start(); + + $lab = mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1')); + if (!isset($lab['id'])) { + die('Поход в подземелье не найден...'); + } + + $varsitmsund = [//Вещи в сундуках + [4391, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1), + [724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1), + [724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1), + [724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1), + [724, 1], [1187, 1]]; + + $varsitm = [//Слабые ресурсы + [4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1], // + [4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1], // + [4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1]]; + $varsitmart = [//Артефакты + [2109, 1], [2111, 1], [2099, 1], [2105, 1], [2122, 1], [2101, 1], [2114, 1], [2107, 1], [2108, 1]]; + + $map = mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1')); + if (!isset($map['id'])) { + die('Карта подземелий не найдена...'); + } + + $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "dielaba" LIMIT 1')); + $dies = $dies[0]; + + $map_d = json_decode($map['data']); + + $varos = []; + $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); + + $errors = ''; + $effed = ''; + + if (isset($_GET['takeitm'])) { + $var = ['obj' => mysql_fetch_array(mysql_query('SELECT `i`.*,`m`.`name`,`m`.`inslot` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`id` = "' . mysql_real_escape_string($_GET['takeitm']) . '" AND `i`.`lib` = "' . $lab['id'] . '" AND `i`.`x` = "' . $u->info['x'] . '" AND `i`.`y` = "' . $u->info['y'] . '" LIMIT 1'))]; + if (isset($var['obj']['id'])) { + if ($var['obj']['take'] == 0) { + $var['sex'] = ''; + if ($u->info['sex'] == 1) { + $var['sex'] = 'а'; + } + $var['text'] = '' . $u->info['login'] . ' поднял' . $var['sex'] . ' предмет "' . $var['obj']['name'] . '"'; + $errors .= 'Вы подняли предмет "' . $var['obj']['name'] . '"'; + mysql_query('UPDATE `laba_itm` SET `take` = "' . $u->info['id'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1'); + if ($var['obj']['inslot'] > 0) { + $u->addItem($var['obj']['itm'], $u->info['id'], '|fromlaba=1|nosavelaba=1|nosale=1'); + } else { + $u->addItem($var['obj']['itm'], $u->info['id'], '|fromlaba=1'); + } + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $u->info['dnow'] . "','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $var['text'] . "','" . time() . "','6','0','1','1')"); + } else { + $errors .= 'Предмет кто-то поднял раньше Вас...'; + } + } else { + $errors = 'Предмет не найден...'; + } + } elseif (isset($_GET['useobj'])) { + $var = ['obj' => mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `id` = "' . mysql_real_escape_string($_GET['useobj']) . '" AND `lib` = "' . $lab['id'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" LIMIT 1'))]; + if (isset($var['obj']['id'])) { + if ($var['obj']['use'] == 0) { + if ($var['obj']['type'] == 1) { + //сунудук + $var['sex'] = ''; + if ($u->info['sex'] == 1) { + $var['sex'] = 'а'; + } + + //Выдаем ресурсы, свитки + if (rand(0, 100) < 25) { + //Выдаем арт varsitmart + $var['itm'] = $varsitm[rand(0, count($varsitm) - 1)]; + $var['itm'] = $var['itm'][0]; + $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $var['itm'] . '" LIMIT 1')); + if (isset($var['itm']['id'])) { + mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( + "' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['itm']['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0" )'); - }else{ - $var['itm']['name'] = 'Предмет рассыпался на глазах...'; - } - } - //Выдаем ресурсы, свитки - $var['itm'] = $varsitmsund[rand(0,count($varsitmsund)-1)]; - $var['itm'] = $var['itm'][0]; - $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$var['itm'].'" LIMIT 1')); - if( isset($var['itm']['id']) ) { - $u->addItem($var['itm']['id'],$u->info['id'],'|fromlaba=1'); - }else{ - $var['itm']['name'] = 'Предмет рассыпался на глазах...'; - } - $var['text'] = ' '.$u->info['login'].' открыл'.$var['sex'].' сундук...и забрал "'.$var['itm']['name'].'"'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$var['text']."','".time()."','6','0','1','1')"); - $errors .= ' '.$u->info['login'].' открыл'.$var['sex'].' сундук...и забрал "'.$var['itm']['name'].'"'; - $var['obj']['use'] = $u->info['id']; - }elseif( $var['obj']['type'] == 5 ) { - //Пандору - $var['sex'] = ''; if($u->info['sex'] == 1) { $var['sex'] = 'а'; } - - //Выдаем ресурсы, свитки - if( rand(0,100) < 70 ) { - //Выдаем арт varsitmart - $var['itm'] = $varsitmart[rand(0,count($varsitmart)-1)]; - $var['itm'] = $var['itm'][0]; - $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$var['itm'].'" LIMIT 1')); - if( isset($var['itm']['id']) ) { - mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( - "'.$u->info['id'].'","'.$lab['id'].'","'.time().'","'.$var['itm']['id'].'","'.$u->info['x'].'","'.$u->info['y'].'","0" - )'); - }else{ - $var['itm']['name'] = 'Предмет рассыпался на глазах...'; - } - } - $var['itm'] = $varsitm[rand(0,count($varsitm)-1)]; - $var['itm'] = $var['itm'][0]; - $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$var['itm'].'" LIMIT 1')); - if( isset($var['itm']['id']) ) { - //$u->addItem($var['itm']['id'],$u->info['id'],'|fromlaba=1'); - mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( - "'.$u->info['id'].'","'.$lab['id'].'","'.time().'","'.$var['itm']['id'].'","'.$u->info['x'].'","'.$u->info['y'].'","0" - )'); - }else{ - $var['itm']['name'] = 'Предмет рассыпался на глазах...'; - } - $var['text'] = ' '.$u->info['login'].' открыл'.$var['sex'].' Ящик Пандоры...'; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$var['text']."','".time()."','6','0','1','1')"); - $errors .= ' '.$u->info['login'].' открыл'.$var['sex'].' Ящик Пандоры...'; - $var['obj']['use'] = $u->info['id']; - }elseif( $var['obj']['type'] == 3 ) { - //Хилка - $var['sex'] = ''; if($u->info['sex'] == 1) { $var['sex'] = 'а'; } - $var['hpp'] = rand(2,5)*10; - $var['hp'] = round($u->stats['hpAll']/100*$var['hpp']); - $u->stats['hpNow'] += $var['hp']; - if( $u->stats['hpNow'] > $u->stats['hpAll'] ) { - $u->stats['hpNow'] = $u->stats['hpAll']; - } - $var['text'] = ' '.$u->info['login'].' пополнил'.$var['sex'].' здоровье, Уровень Жизни +'.$var['hpp'].'% (+'.$var['hp'].'HP)'; - mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$var['text']."','".time()."','6','0','1','1')"); - $errors .= ' '.$u->info['login'].' пополнил'.$var['sex'].' здоровье, Уровень Жизни +'.$var['hpp'].'% (+'.$var['hp'].'HP)'; - $var['obj']['use'] = $u->info['id']; - } - if( $var['obj']['use'] > 0 ) { - mysql_query('UPDATE `laba_obj` SET `use` = "'.$var['obj']['use'].'" WHERE `id` = "'.$var['obj']['id'].'" LIMIT 1'); - } - }else{ - $errors = 'Кто-то уже использовал это до Вас...'; - } - }else{ - $errors = 'Обьект не найден...'; - } - - unset($var); - } - - //Генирация карты - $mapsee = ''; - $real_x = $u->info['x']; - $real_y = $u->info['y']; - - if( $real_y < 6 ) { - $real_y = 6; - } - if( $real_x < 6 ) { - $real_x = 6; - } - if( $real_y > count($map_d) - 7 ) { - $real_y = count($map_d) - 7; - } - if( $real_x > count($map_d) - 7 ) { - $real_x = count($map_d) - 7; - } - - $objs = array( ); - - $sp = mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "'.$lab['id'].'" AND `x` > '.($real_x - 7).' AND `x` < '.($real_x + 7).' AND `y` > '.($real_y - 12).' AND `y` < '.($real_y + 12).' LIMIT 144'); - while( $pl = mysql_fetch_array($sp) ) { - $objs[$pl['x']][$pl['y']] = $pl; - } - - $i = 1; - $goodgoo = array( 1 => 0 , 2 => 0 , 3 => 0 , 4 => 0 ); - while( $i <= 4 ) { - $goto = array( 'x' => $u->info['y'] , 'y' => $u->info['x'] ); - if( $i == 1 ) { - $goto['x']--; - }elseif( $i == 2 ) { - $goto['y']--; - }elseif( $i == 3 ) { - $goto['x']++; - }elseif( $i == 4 ) { - $goto['y']++; - } - if( $map_d[$goto['y']][$goto['x']] == 0 && $goto['x'] > 0 && $goto['x'] < count($map_d)-1 && $u->info['timeGo'] <= time() ) { - $goodgoo[$i] = 1; - } - $i++; - } - - if( isset($_GET['goto']) ) { - $goto = array( 'x' => $u->info['y'] , 'y' => $u->info['x'] ); - if( $_GET['goto'] == 1 ) { - $goto['x']--; - }elseif( $_GET['goto'] == 2 ) { - $goto['y']--; - }elseif( $_GET['goto'] == 3 ) { - $goto['x']++; - }elseif( $_GET['goto'] == 4 ) { - $goto['y']++; - } - if( $goodgoo[$_GET['goto']] == 1 && $u->info['timeGo'] <= time() ) { - //переходим - $u->info['y'] = $goto['x']; - $u->info['x'] = $goto['y']; - $real_x = $u->info['x']; - $real_y = $u->info['y']; - $varos['timego'] = 5; - if( isset($varos['trap1']['time']) ) { - $varos['timego'] += 3; - } - if( isset($u->stats['speed_dungeon']) ) { - $varos['timego'] = $varos['timego']-floor($varos['timego']/100*$u->stats['speed_dungeon']); - if( $varos['timego'] < 1 ) { - $varos['timego'] = 1; - } - } - $u->info['timeGo'] = time()+$varos['timego']; - $u->info['timeGoL'] = time(); - mysql_query('UPDATE `stats` SET `x` = "'.$u->info['x'].'" ,`y` = "'.$u->info['y'].'",`timeGoL` = "'.$u->info['timeGoL'].'",`timeGo` = "'.$u->info['timeGo'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - - $tmdg = ($u->info['timeGo']-time()); - $tmdgl = ($u->info['timeGo']-$u->info['timeGoL']); - $tmdgp = floor(100-$tmdg/$tmdgl*100); if( $tmdgp < 1 ) { $tmdgp = 1; }elseif( $tmdgp > 100 ) { $tmdgp = 100; } - $tmdgm = 25*$tmdgl; - - $tmdg = floor(40/100*$tmdgp); - - if( $tmdg < 1 ) { - $tmdg = 1; - }elseif( $tmdg > 40 ) { - $tmdg = 40; - } - - if( $real_y < 6 ) { - $real_y = 6; - } - if( $real_x < 6 ) { - $real_x = 6; - } - if( $real_y > count($map_d) - 7 ) { - $real_y = count($map_d) - 7; - } - if( $real_x > count($map_d) - 7 ) { - $real_x = count($map_d) - 7; - } - - if( isset($_POST['exit']) ) { - if( $lab['users'] < 2 ) { - //Удаляем подземелье - mysql_query('DELETE FROM `laba_now` WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "'.$lab['id'].'"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "'.$lab['id'].'"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "'.$lab['id'].'"'); - }else{ - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "'.$lab['users'].'" WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%"'); - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"'); - mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Выбрасываем предметы которые из подземелья - - die(''); - } - - //Предметы в локации - $itms = ''; - - if(isset($objs[$u->info['x']][$u->info['y']]['id'])) { - $var = array(); - $mitm = $objs[$u->info['x']][$u->info['y']]; - if( $mitm['type'] == 6 ) { - //Случайный предмет - if( $mitm['vars'] < 25 ) { - $i = 0; - while( $i < $mitm['vars'] ) { - $var['add'] = $varsitm[rand(0,count($varsitm)-1)]; - if( $var['add'][1] > 0 ) { - $j = 0; - while( $j < $var['add'][1] ) { - mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( - "'.$u->info['id'].'","'.$lab['id'].'","'.time().'","'.$var['add'][0].'","'.$u->info['x'].'","'.$u->info['y'].'","0" - )'); - $j++; - } - } - $i++; - } - }else{ - //Конкретный предмет - - } - mysql_query('DELETE FROM `laba_obj` WHERE `id` = "'.$mitm['id'].'" LIMIT 1'); - }elseif( $mitm['type'] == 2 ) { - if( $mitm['use'] == 0 ) { - $tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win` = -1 AND `dn_id` = "'.$lab['id'].'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'" LIMIT 1')); - if( isset($tbtl['id']) ) { - //вступаем в поединок - mysql_query('UPDATE `users` SET `battle` = "'.$tbtl['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Нападаем ... '; - }else{ - $var['bots'] = array( - array(357,5), - array(358,5), - array(359,5), - array(360,5), - array(361,3), - array(362,3), - array(363,3), - array(364,2), - array(365,5), - array(366,5), - array(367,3) - ); - //Создаем новый бой - if( $mitm['vars'] != NULL ) { - //Боты уже есть - }else{ - //Новый список составляем - $i = 0; - while( $i <= $u->info['level'] ) { - $var['ab'] = $var['bots'][rand(0,count($var['bots'])-1)]; - $mitm['vars'] .= '|'.$var['ab'][0]; - $i += $var['ab'][1]; - } - // - $mitm['vars'] = ltrim($mitm['vars'],'|'); - // - mysql_query('UPDATE `laba_obj` SET `vars` = "'.$mitm['vars'].'" WHERE `id` = "'.$mitm['id'].'" LIMIT 1'); - } - // - $mitm['vars'] = explode('|',$mitm['vars']); - // - if( count($mitm['vars']) > 0 ) { - $btl_id = 0; - $expB = 0; - $btld = array( - 'players'=>'', - 'timeout'=>180, - 'type'=>0, - 'invis'=>0, - 'noinc'=>0, - 'travmChance'=>0, - 'typeBattle'=>0, - 'addExp'=>$expB, - 'money'=>0 - ); - - $ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( - "102", - "'.$lab['id'].'", - "'.$u->info['x'].'", - "'.$u->info['y'].'", - "'.$u->info['city'].'", - "'.time().'", - "'.$btld['players'].'", - "'.$btld['timeout'].'", - "'.$btld['type'].'", - "'.$btld['invis'].'", - "'.$btld['noinc'].'", - "'.$btld['travmChance'].'", - "'.$btld['typeBattle'].'", - "'.$btld['addExp'].'", - "'.$btld['money'].'")'); - $btl_id = mysql_insert_id(); - } - if( $btl_id > 0 ) { - // - $i = 0; - while( $i < count($mitm['vars']) ) { - - $k = $u->addNewbot($mitm['vars'][$i],NULL,NULL,$logins_bot); - $logins_bot = $k['logins_bot']; - if($k!=false) - { - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'",`room` = "-100" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) - { - $upd = mysql_query('UPDATE `stats` SET `x`="'.$u->info['x'].'",`y`="'.$u->info['y'].'",`team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) - { - $j++; - } - } - } - - $i++; - } - unset($logins_bot); - if($j>0) - { - mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->error = 'Нападаем ... '; - }else{ - $u->error = 'Не удалось напасть, ошибка обьекта нападения ...'; - } - } - // - } - } - }elseif( $mitm['type'] == 1 ) { - //Сундук - if( $mitm['use'] == 0 ) { - $itms .= ''; - }else{ - $itms .= ''; - } - }elseif( $mitm['type'] == 3 ) { - //хилка - if( $mitm['use'] == 0 ) { - $itms .= ''; - }else{ - $itms .= ''; - } - }elseif( $mitm['type'] == 4 ) { - if( $mitm['use'] == 0 ) { - //Ловушка - $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`,`vals`,`time` FROM `laba_act` WHERE `uid` = "'.$u->info['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); - $var['time'] = rand(1,60); - if( isset($var['trap1']['id']) ) { - mysql_query('UPDATE `laba_act` SET `vals` = "'.( $var['trap1']['vals'] + $var['time'] ).'",`time` = "'.( $var['trap1']['time'] + $var['time']*60 ).'" WHERE `id` = "'.$var['trap1']['id'].'" LIMIT 1'); - }else{ - mysql_query('INSERT INTO `laba_act` (`uid`,`time`,`lib`,`vars`,`vals`) VALUES ( - "'.$u->info['id'].'","'.(time()+$var['time']*60).'","'.$lab['id'].'","trap1","'.$var['time'].'" - )'); - } - mysql_query('UPDATE `laba_obj` SET `use` = "'.$u->info['id'].'" WHERE `id` = "'.$mitm['id'].'" LIMIT 1'); - - $var['sex'] = ''; if($u->info['sex'] == 1) { $var['sex'] = 'а'; } - $var['text'] = ' '.$u->info['login'].' угодил'.$var['sex'].' в ловушку...'; - - $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "'.$u->info['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); - - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['dnow']."','".$u->info['city']."','".$u->info['room']."','','','".$var['text']."','".time()."','6','0','1','1')"); - $errors .= ' '.$u->info['login'].' угодил'.$var['sex'].' в ловушку... Время перехода +3 секунды (Длительность: +'.$var['time'].' мин.)'; - } - }elseif( $mitm['type'] == 5 ) { - //Пандора - if( $mitm['use'] == 0 ) { - $itms .= ''; - }else{ - $itms .= ''; - } - } - unset($var); - } - - $sp = mysql_query('SELECT `i`.*,`m`.`name`,`m`.`img` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`lib` = "'.$lab['id'].'" AND `i`.`x` = "'.$u->info['x'].'" AND `i`.`y` = "'.$u->info['y'].'" AND `i`.`take` = "0"'); - while( $pl = mysql_fetch_array($sp) ) { - $itms .= ' '; - } - - if( $itms != '' ) { - $itms = 'В этой комнате находится:

    '.$itms.'
    '; - }elseif( $u->info['y'] == count($map_d)-2 ) { - //Выход нашелся! - if( $lab['users'] < 2 ) { - //Удаляем подземелье - mysql_query('DELETE FROM `laba_now` WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "'.$lab['id'].'"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "'.$lab['id'].'"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "'.$lab['id'].'"'); - }else{ - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "'.$lab['users'].'" WHERE `id` = "'.$lab['id'].'" LIMIT 1'); - } - $u->addItem(4392,$u->info['id'],'|fromlaba=1|nosale=1'); - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%" AND `data` LIKE "%nosavelaba=1%"'); - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"'); - mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $r = ' Вы получили награду "Чек на предъявителя (50кр.)"'; - mysql_query("INSERT INTO `chat` (`typeTime`,`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','1','".$u->info['city']."','".$u->info['room']."','','".$u->info['login']."','".$r."','".time()."','6','0')"); - $r = ' Вы прошли лабиринт "Подземелья Драконов" и сохранили предметы из лабиринта!'; - mysql_query("INSERT INTO `chat` (`typeTime`,`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','1','".$u->info['city']."','".$u->info['room']."','','".$u->info['login']."','".$r."','".time()."','6','0')"); - //Выбрасываем предметы которые из подземелья - die(''); - } - - $sp = mysql_query('SELECT `s`.`x`,`s`.`y`,`u`.`id`,`u`.`login`,`u`.`level` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "'.$lab['id'].'" AND `s`.`id` != "'.$u->info['id'].'" LIMIT 5'); - $pi = 1; - while( $pl = mysql_fetch_array($sp) ) { - $objs[$pl['x']][$pl['y']] = array(2 => '
    '); //Персонаж 1 - $pi++; - } - - $objs[$u->info['x']][$u->info['y']] = array(2 => '
    '); //Персонаж 1 - $i = 0; - while( $i <= count($map_d) ) { - $j = 0; - while( $j < count($map_d[$i]) ) { - if( $i > $real_x - 6 && $i < $real_x + 6 && $j > $real_y - 6 && $j < $real_y + 6 ) { - if( $map_d[$i][$j] == 1 ) { - $mapsee .= '
    '.$objs[$i][$j][2].'
    '; - }else{ - if( !isset($objs[$i][$j]['id']) ) { - if( isset($objs[$i][$j][2]) ) { - // - }elseif( $j == 1 ) { - $objs[$i][$j][2] = '
    '; - }elseif( $j == count($map_d)-2 ) { - $objs[$i][$j][2] = '
    '; - } - }else{ - if( $objs[$i][$j]['use'] == 0 ) { - $objs[$i][$j][2] = '
    '; - }else{ - $objs[$i][$j][2] = ''; - } - } - $mapsee .= '
    '.$objs[$i][$j][2].'
    '; - } - } - $j++; - } - if( $i > $real_x - 6 && $i < $real_x + 6 ) { - $mapsee .= '
    '; - } - $i++; - } - $mapsee = '
    '.$mapsee.'
    '; - - - //Эффекты на персонаже - if( isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0 ) { - $effed .= '
    - Время перехода +3 секунды (Осталось: '.$u->timeOut($varos['trap1']['time']-time()).')
    '; - } - unset($varos); -?> - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - -
      -
    error?>
    -
    Карта:
    - -
    -
    -
    - usersDng($lab['id']);?> -
    - -
    -
    - -
    - 0 ) { - echo 'Кол-во смертей: '.$dies.'/3
    '; - } - ?> - координаты : X=info['y']?> Y=info['x']?>
     
      
      - '; } ?> - -  
      - - - - - - - - - + + + -
    - - - - - - - -
         
                                                                                                                           
      
    - -
     
    - - - - - - - - - - - - - - - - - +
    + } else { + $errors = 'Обьект не найден...'; + } + + unset($var); + } + + //Генирация карты + $mapsee = ''; + $real_x = $u->info['x']; + $real_y = $u->info['y']; + + if ($real_y < 6) { + $real_y = 6; + } + if ($real_x < 6) { + $real_x = 6; + } + if ($real_y > count($map_d) - 7) { + $real_y = count($map_d) - 7; + } + if ($real_x > count($map_d) - 7) { + $real_x = count($map_d) - 7; + } + + $objs = []; + + $sp = mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '" AND `x` > ' . ($real_x - 7) . ' AND `x` < ' . ($real_x + 7) . ' AND `y` > ' . ($real_y - 12) . ' AND `y` < ' . ($real_y + 12) . ' LIMIT 144'); + while ($pl = mysql_fetch_array($sp)) { + $objs[$pl['x']][$pl['y']] = $pl; + } + + $i = 1; + $goodgoo = [1 => 0, 2 => 0, 3 => 0, 4 => 0]; + while ($i <= 4) { + $goto = ['x' => $u->info['y'], 'y' => $u->info['x']]; + if ($i == 1) { + $goto['x']--; + } elseif ($i == 2) { + $goto['y']--; + } elseif ($i == 3) { + $goto['x']++; + } elseif ($i == 4) { + $goto['y']++; + } + if ($map_d[$goto['y']][$goto['x']] == 0 && $goto['x'] > 0 && $goto['x'] < count($map_d) - 1 && $u->info['timeGo'] <= time()) { + $goodgoo[$i] = 1; + } + $i++; + } + + if (isset($_GET['goto'])) { + $goto = ['x' => $u->info['y'], 'y' => $u->info['x']]; + if ($_GET['goto'] == 1) { + $goto['x']--; + } elseif ($_GET['goto'] == 2) { + $goto['y']--; + } elseif ($_GET['goto'] == 3) { + $goto['x']++; + } elseif ($_GET['goto'] == 4) { + $goto['y']++; + } + if ($goodgoo[$_GET['goto']] == 1 && $u->info['timeGo'] <= time()) { + //переходим + $u->info['y'] = $goto['x']; + $u->info['x'] = $goto['y']; + $real_x = $u->info['x']; + $real_y = $u->info['y']; + $varos['timego'] = 5; + if (isset($varos['trap1']['time'])) { + $varos['timego'] += 3; + } + if (isset($u->stats['speed_dungeon'])) { + $varos['timego'] = $varos['timego'] - floor($varos['timego'] / 100 * $u->stats['speed_dungeon']); + if ($varos['timego'] < 1) { + $varos['timego'] = 1; + } + } + $u->info['timeGo'] = time() + $varos['timego']; + $u->info['timeGoL'] = time(); + mysql_query('UPDATE `stats` SET `x` = "' . $u->info['x'] . '" ,`y` = "' . $u->info['y'] . '",`timeGoL` = "' . $u->info['timeGoL'] . '",`timeGo` = "' . $u->info['timeGo'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + } + + $tmdg = ($u->info['timeGo'] - time()); + $tmdgl = ($u->info['timeGo'] - $u->info['timeGoL']); + $tmdgp = floor(100 - $tmdg / $tmdgl * 100); + if ($tmdgp < 1) { + $tmdgp = 1; + } elseif ($tmdgp > 100) { + $tmdgp = 100; + } + $tmdgm = 25 * $tmdgl; + + $tmdg = floor(40 / 100 * $tmdgp); + + if ($tmdg < 1) { + $tmdg = 1; + } elseif ($tmdg > 40) { + $tmdg = 40; + } + + if ($real_y < 6) { + $real_y = 6; + } + if ($real_x < 6) { + $real_x = 6; + } + if ($real_y > count($map_d) - 7) { + $real_y = count($map_d) - 7; + } + if ($real_x > count($map_d) - 7) { + $real_x = count($map_d) - 7; + } + + if (isset($_POST['exit'])) { + if ($lab['users'] < 2) { + //Удаляем подземелье + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%"'); + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"'); + mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + //Выбрасываем предметы которые из подземелья + + die(''); + } + + //Предметы в локации + $itms = ''; + + if (isset($objs[$u->info['x']][$u->info['y']]['id'])) { + $var = []; + $mitm = $objs[$u->info['x']][$u->info['y']]; + if ($mitm['type'] == 6) { + //Случайный предмет + if ($mitm['vars'] < 25) { + $i = 0; + while ($i < $mitm['vars']) { + $var['add'] = $varsitm[rand(0, count($varsitm) - 1)]; + if ($var['add'][1] > 0) { + $j = 0; + while ($j < $var['add'][1]) { + mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES ( + "' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['add'][0] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0" + )'); + $j++; + } + } + $i++; + } + } else { + //Конкретный предмет + + } + mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $mitm['id'] . '" LIMIT 1'); + } elseif ($mitm['type'] == 2) { + if ($mitm['use'] == 0) { + $tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win` = -1 AND `dn_id` = "' . $lab['id'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" LIMIT 1')); + if (isset($tbtl['id'])) { + //вступаем в поединок + mysql_query('UPDATE `users` SET `battle` = "' . $tbtl['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->error = 'Нападаем ... '; + } else { + $var['bots'] = [[357, 5], [358, 5], [359, 5], [360, 5], [361, 3], [362, 3], [363, 3], [364, 2], [365, 5], [366, 5], [367, 3]]; + //Создаем новый бой + if ($mitm['vars'] != null) { + //Боты уже есть + } else { + //Новый список составляем + $i = 0; + while ($i <= $u->info['level']) { + $var['ab'] = $var['bots'][rand(0, count($var['bots']) - 1)]; + $mitm['vars'] .= '|' . $var['ab'][0]; + $i += $var['ab'][1]; + } + // + $mitm['vars'] = ltrim($mitm['vars'], '|'); + // + mysql_query('UPDATE `laba_obj` SET `vars` = "' . $mitm['vars'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1'); + } + // + $mitm['vars'] = explode('|', $mitm['vars']); + // + if (count($mitm['vars']) > 0) { + $btl_id = 0; + $expB = 0; + $btld = ['players' => '', 'timeout' => 180, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; + + $ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ( + "102", + "' . $lab['id'] . '", + "' . $u->info['x'] . '", + "' . $u->info['y'] . '", + "' . $u->info['city'] . '", + "' . time() . '", + "' . $btld['players'] . '", + "' . $btld['timeout'] . '", + "' . $btld['type'] . '", + "' . $btld['invis'] . '", + "' . $btld['noinc'] . '", + "' . $btld['travmChance'] . '", + "' . $btld['typeBattle'] . '", + "' . $btld['addExp'] . '", + "' . $btld['money'] . '")'); + $btl_id = mysql_insert_id(); + } + if ($btl_id > 0) { + // + $i = 0; + while ($i < count($mitm['vars'])) { + + $k = $u->addNewbot($mitm['vars'][$i], null, null, $logins_bot); + $logins_bot = $k['logins_bot']; + if ($k != false) { + $upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '",`room` = "-100" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $upd = mysql_query('UPDATE `stats` SET `x`="' . $u->info['x'] . '",`y`="' . $u->info['y'] . '",`team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); + if ($upd) { + $j++; + } + } + } + + $i++; + } + unset($logins_bot); + if ($j > 0) { + mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->error = 'Нападаем ... '; + } else { + $u->error = 'Не удалось напасть, ошибка обьекта нападения ...'; + } + } + // + } + } + } elseif ($mitm['type'] == 1) { + //Сундук + if ($mitm['use'] == 0) { + $itms .= ''; + } else { + $itms .= ''; + } + } elseif ($mitm['type'] == 3) { + //хилка + if ($mitm['use'] == 0) { + $itms .= ''; + } else { + $itms .= ''; + } + } elseif ($mitm['type'] == 4) { + if ($mitm['use'] == 0) { + //Ловушка + $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`,`vals`,`time` FROM `laba_act` WHERE `uid` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); + $var['time'] = rand(1, 60); + if (isset($var['trap1']['id'])) { + mysql_query('UPDATE `laba_act` SET `vals` = "' . ($var['trap1']['vals'] + $var['time']) . '",`time` = "' . ($var['trap1']['time'] + $var['time'] * 60) . '" WHERE `id` = "' . $var['trap1']['id'] . '" LIMIT 1'); + } else { + mysql_query('INSERT INTO `laba_act` (`uid`,`time`,`lib`,`vars`,`vals`) VALUES ( + "' . $u->info['id'] . '","' . (time() + $var['time'] * 60) . '","' . $lab['id'] . '","trap1","' . $var['time'] . '" + )'); + } + mysql_query('UPDATE `laba_obj` SET `use` = "' . $u->info['id'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1'); + + $var['sex'] = ''; + if ($u->info['sex'] == 1) { + $var['sex'] = 'а'; + } + $var['text'] = '' . $u->info['login'] . ' угодил' . $var['sex'] . ' в ловушку...'; + + $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1')); + + mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $u->info['dnow'] . "','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $var['text'] . "','" . time() . "','6','0','1','1')"); + $errors .= ' ' . $u->info['login'] . ' угодил' . $var['sex'] . ' в ловушку... Время перехода +3 секунды (Длительность: +' . $var['time'] . ' мин.)'; + } + } elseif ($mitm['type'] == 5) { + //Пандора + if ($mitm['use'] == 0) { + $itms .= ''; + } else { + $itms .= ''; + } + } + unset($var); + } + + $sp = mysql_query('SELECT `i`.*,`m`.`name`,`m`.`img` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`lib` = "' . $lab['id'] . '" AND `i`.`x` = "' . $u->info['x'] . '" AND `i`.`y` = "' . $u->info['y'] . '" AND `i`.`take` = "0"'); + while ($pl = mysql_fetch_array($sp)) { + $itms .= ' '; + } + + if ($itms != '') { + $itms = 'В этой комнате находится:

    ' . $itms . '
    '; + } elseif ($u->info['y'] == count($map_d) - 2) { + //Выход нашелся! + if ($lab['users'] < 2) { + //Удаляем подземелье + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + $u->addItem(4392, $u->info['id'], '|fromlaba=1|nosale=1'); + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%" AND `data` LIKE "%nosavelaba=1%"'); + mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"'); + mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $r = ' Вы получили награду "Чек на предъявителя (50кр.)"'; + mysql_query("INSERT INTO `chat` (`typeTime`,`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "','" . $r . "','" . time() . "','6','0')"); + $r = ' Вы прошли лабиринт "Подземелья Драконов" и сохранили предметы из лабиринта!'; + mysql_query("INSERT INTO `chat` (`typeTime`,`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "','" . $r . "','" . time() . "','6','0')"); + //Выбрасываем предметы которые из подземелья + die(''); + } + + $sp = mysql_query('SELECT `s`.`x`,`s`.`y`,`u`.`id`,`u`.`login`,`u`.`level` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "' . $lab['id'] . '" AND `s`.`id` != "' . $u->info['id'] . '" LIMIT 5'); + $pi = 1; + while ($pl = mysql_fetch_array($sp)) { + $objs[$pl['x']][$pl['y']] = [2 => '
    ']; //Персонаж 1 + $pi++; + } + + $objs[$u->info['x']][$u->info['y']] = [2 => '
    ']; //Персонаж 1 + $i = 0; + while ($i <= count($map_d)) { + $j = 0; + while ($j < count($map_d[$i])) { + if ($i > $real_x - 6 && $i < $real_x + 6 && $j > $real_y - 6 && $j < $real_y + 6) { + if ($map_d[$i][$j] == 1) { + $mapsee .= '
    ' . $objs[$i][$j][2] . '
    '; + } else { + if (!isset($objs[$i][$j]['id'])) { + if (isset($objs[$i][$j][2])) { + // + } elseif ($j == 1) { + $objs[$i][$j][2] = '
    '; + } elseif ($j == count($map_d) - 2) { + $objs[$i][$j][2] = '
    '; + } + } else { + if ($objs[$i][$j]['use'] == 0) { + $objs[$i][$j][2] = '
    '; + } else { + $objs[$i][$j][2] = ''; + } + } + $mapsee .= '
    ' . $objs[$i][$j][2] . '
    '; + } + } + $j++; + } + if ($i > $real_x - 6 && $i < $real_x + 6) { + $mapsee .= '
    '; + } + $i++; + } + $mapsee = '
    ' . $mapsee . '
    '; + + + //Эффекты на персонаже + if (isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0) { + $effed .= '
    - Время перехода +3 секунды (Осталось: ' . $u->timeOut($varos['trap1']['time'] - time()) . ')
    '; + } + unset($varos); + ?> + + + +
    + + + + + + + + - - - -
    + - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + -
    Вверх
      +
    error ?>
    +
    Карта:
    + +
    +
    +
    + usersDng($lab['id']); ?> +
    + +
    +
    + +
    + 0) { + echo 'Кол-во смертей: ' . $dies . '/3
    '; + } + ?> + координаты : X=info['y'] ?> Y=info['x'] ?>
     
     
    ВлевоОбновитьВправо
    Вниз
     
      + '; + } ?> + +  
    - - - - - - - -
    -
    - -
    -
    +
      + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + +
          +
    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +
    +
      
    + +
     
    +
    + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Вверх
    ВлевоОбновитьВправо
    Вниз
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    +
    - + \ No newline at end of file diff --git a/modules_data/location/dungeon.php b/modules_data/location/dungeon.php index 1674acfb..763fd48a 100644 --- a/modules_data/location/dungeon.php +++ b/modules_data/location/dungeon.php @@ -1,1218 +1,1382 @@ var elem = document.getElementById('se-pre-con'); elem.parentNode.removeChild(elem); "; -if(!defined('GAME')){ - die(); +if (!defined('GAME')) { + die(); } -if($u->room['file']=='dungeon'){ -$pd = array( - 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') { + $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]; - } - } - unset($dp); -} + 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); + } -require_once('_incl_data/class/__dungeon.php'); + $d = new Dungeon; + $d->start(); -if(!isset($d->info['id'])) { - $_GET['exitd'] = true; -} + 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]; + $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; -} + 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')); + $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($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['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 (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($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'].'" находится далеко от вас для паса!'; - } - }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'); + 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'] . '" находится далеко от вас для паса!'; + } + } 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: https://new-combats.com/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'] . ''); + } + } + } else { + if ($u->info['sex'] == 0) { + $d->sys_chat('' . $u->info['login'] . ' покинул подземелье!'); + } else { + $d->sys_chat('' . $u->info['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'); - //Удаляем текущего бота и инвентарь - 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'); - // - if( $pl['team'] == $tmwin ) { - //Выдаем награду за победу! - - } - // - } - header('location: https://new-combats.com/main.php'); - die('Матч закончился! Победила команда №'.$tmwin.''); - } - } - - if($d->info['bsid']==0 && $d->info['id2'] != 106){ - if(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'].''); - } - } - }else{ - if( $u->info['sex'] == 0 ) { - $d->sys_chat(''.$u->info['login'].' покинул подземелье!'); - }else{ - $d->sys_chat(''.$u->info['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(); - } - } -} + 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'] == 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 { -?> - - + - - - -
    - - - - - - '; + } else { + $itmAllSee = $itmAll[2]; + } + $itmAllSee = str_replace("'", "", $itmAllSee); + $itmAllSee = str_replace('"', '"', $itmAllSee); + $itmAllSee = str_replace("\n", '', $itmAllSee); + $itmAllSee = str_replace("\r", '', $itmAllSee); + $js .= '$(\'#inv' . $i . '\').html(\'' . $itmAllSee . '\');'; + $i++; + } + unset($itmAll, $itmAllSee); + } + if ($_POST['id'] == 'minireflesh' || $_POST['id'] == 'reflesh') { + //Мини обновление + if (($u->tfer['start2'] > 0 && $u->info['id'] == $u->tfer['uid1']) || ($u->tfer['start1'] > 0 && $u->info['id'] == $u->tfer['uid2'])) { + $js .= 's2g();'; + } + //Обновляем предметы + $f = 1; + if ($u->info['id'] == $u->tfer['uid2']) { + $f = 2; + } + if ($u->tfer['r' . $f] != $u->tfer['r0']) { + function itmInfotf($pl, $cl) + { + global $u, $c, $code; + $x = $u->itemsX($pl['id'], $pl['uid']); + if ($x > 1) { + $x = ' (x' . $x . ')'; + } else { + $x = ''; + } + $r = ''; + if ($pl['uid'] == $u->info['id']) { + $r .= ''; + } + $r .= '' . $pl['name'] . '' . $x . '
    '; + if ($pl['inTransfer'] == 1) { + $r .= ''; + } else { + $r .= '(налог: 1кр.)'; + } + $r = '
    -

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

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

    Выйти

    -
    - - '; - }else{ - $itmAllSee = $itmAll[2]; - } - $itmAllSee = str_replace("'","",$itmAllSee); - $itmAllSee = str_replace('"','"',$itmAllSee); - $itmAllSee = str_replace("\n",'',$itmAllSee); - $itmAllSee = str_replace("\r",'',$itmAllSee); - $js .= '$(\'#inv'.$i.'\').html(\''.$itmAllSee.'\');'; - $i++; - } - unset($itmAll,$itmAllSee); - } - if($_POST['id']=='minireflesh' || $_POST['id']=='reflesh') - { - //Мини обновление - if(($u->tfer['start2']>0 && $u->info['id']==$u->tfer['uid1']) || ($u->tfer['start1']>0 && $u->info['id']==$u->tfer['uid2'])) - { - $js .= 's2g();'; - } - //Обновляем предметы - $f = 1; - if($u->info['id']==$u->tfer['uid2']) - { - $f = 2; - } - if($u->tfer['r'.$f]!=$u->tfer['r0']) - { - function itmInfotf($pl,$cl) - { - global $u,$c,$code; - $x = $u->itemsX($pl['id'],$pl['uid']); - if($x>1) - { - $x = ' (x'.$x.')'; - }else{ - $x = ''; - } - $r = ''; - if($pl['uid']==$u->info['id']) - { - $r .= ''; - } - $r .= ''.$pl['name'].''.$x.'
    '; - if($pl['inTransfer']==1) - { - $r .= ''; - }else{ - $r .= '(налог: 1кр.)'; - } - $r = '
    - - - - -
    -
    info['bsid']==0){ echo $d->usersDng(); - if( $dies > 0 ) { - echo '

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

    '; - } - /*if($dies > 3) { + if (tgo > 0) { + tgo -= 1; + // console.log("старт после") + 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 . '

    '; + } + /*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 '

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

    '; - } - } - } - //Генерируем список текущих квестов - $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++; - } - } - $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.'
    + } 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 '

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

    '; + } + } + } + //Генерируем список текущих квестов + $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++; + } + } + $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; } ?>
    -
    - 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){ ?> - - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - info['admin']==0){ ?> -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    + $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) { ?> + + + + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + info['admin'] == 0){ ?> +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    -
    -
    -
     
    -
    -
    - -

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

    - S:'.$u->info['s'].''; -} -?> - \ No newline at end of file + location.href = "/main.php?look=2&rnd="; + }); + + }); + +

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

    + S:' . $u->info['s'] . ''; + } + ?> + diff --git a/modules_data/location/enterptp.php b/modules_data/location/enterptp.php index 284843d0..91b8ead2 100644 --- a/modules_data/location/enterptp.php +++ b/modules_data/location/enterptp.php @@ -24,7 +24,7 @@ $dungeon = mysql_fetch_assoc(mysql_query('SELECT `id` as room, `dungeon_id` as i $dungeon['list'] = array( // список подземелий, которые используются для вычита используемой репутации. // При добавлении в список нового города, следует проверить наличие ячеек в таблице `rep`. - // Так-же следует помнить, что в __user.php в выводе инвентаря, некоторых подземелий\городов, нету. + // Так-же следует помнить, что в User.php в выводе инвентаря, некоторых подземелий\городов, нету. // Да и вообще, херня получается, что наши подземелья считаются как Город, то есть два подземелья на город - технически нет такого. Так-как ПТП это capitalcity. 1=>'capitalcity', 2=>'demonscity', diff --git a/modules_data/location/izlom2.php b/modules_data/location/izlom2.php index 0c35a6a2..39acbb93 100644 --- a/modules_data/location/izlom2.php +++ b/modules_data/location/izlom2.php @@ -1,133 +1,160 @@ room['file']=='izlom2') -{ -if(isset($_POST['level'])) -{ - if((int)$_POST['level']<=$u->info['level'] && (int)$_POST['level']<=7) - { - $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = "31" AND `delete` = "0" LIMIT 1')); - if(!isset($eff1['id'])) - { - if(file_exists('_incl_data/class/__zv.php')) { - if(!isset($zv)) - { - require_once('_incl_data/class/__zv.php'); - } - $zv->startIzlom(1,((int)$_POST['level'])); - }else{ - echo '...'; - } - }else{ - echo 'Вы не можете начать новый поход пока действует эффект "Касание Хаоса"'; - } - } +if ($u->room['file'] != 'izlom2') { + return; +} +if (isset($_POST['level']) && (int)$_POST['level'] <= $u->info['level'] && (int)$_POST['level'] <= 7) { + $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = "31" AND `delete` = "0" LIMIT 1')); + if (isset($eff1['id'])) { + echo 'Вы не можете начать новый поход пока действует эффект "Касание Хаоса"'; + } elseif (!isset($zv)) { + $zv = new FightRequest(); + } +} + +$i = 0; +$text = ''; +$sp = mysql_query('SELECT * FROM `izlom_rating` ORDER BY `voln` DESC LIMIT 50'); +$uidz = []; +while ($pl = mysql_fetch_array($sp)) { + if (isset($uidz[$pl['uid']])) { + continue; + } + $i++; + $uidz[$pl['uid']] = $i; + $text .= $i . '. ' . date('d.m.Y H:i', $pl['time']) . ', Волна: ' . $pl['voln'] . ', ' . $u->microLogin($pl['uid'], 1) . '
    '; +} +if (empty($text)) { + $text = 'История пуста, скорее всего не нашлось смельчаков...'; } ?> - -
    '.$re.''; } ?>
    - - - -
    Излом Хаоса
    -
    - - - - -
      - - - -
    - - - - - - - - -
    - - - - - - - - -
    Излом Хаоса - 16
    Магазин Излома
     
    -
    -
    - + +
    + + + + +
    +
    Излом Хаоса
    +
    + + + + + +
      + + + + +
    + + + + + + + + + +
    + + + + + + + + + +
    Излом + Хаоса - 16
    Магазин + Излома
    +
     
    +
    +
    +
    +
    +
    - info['level']<7){ echo 'disabled'; } ?>> - Проход в «Излом Хаоса»
    + -
    -

    Рейтинг походов «Излом Хаоса»:
    '.date('d.m.Y H:i',$pl['time']).', Волна: '.$pl['voln'].', '.$u->microLogin($pl['uid'],1).'
    '; - } - } - if(!isset($text)) - { - $text = 'История пуста, скорее всего не нашлось смельчаков...'; - } - echo $text; - unset($text); - ?>

    - \ No newline at end of file + +

    Рейтинг походов «Излом Хаоса»:

    \ No newline at end of file diff --git a/modules_data/location/turnir.php b/modules_data/location/turnir.php index 2dbc88ee..80da5e6b 100644 --- a/modules_data/location/turnir.php +++ b/modules_data/location/turnir.php @@ -1,16 +1,10 @@ -room['file']=='turnir') -{ - - require_once('_incl_data/class/__turnir.php'); - - $tur->locationSee(); - +if($u->room['file'] != 'turnir') { + return; } - -?> \ No newline at end of file +$tur = new Tournir(); diff --git a/modules_data/titul.php b/modules_data/titul.php index 46a99c8f..02046d97 100644 --- a/modules_data/titul.php +++ b/modules_data/titul.php @@ -7,10 +7,7 @@ if (!defined('GAME')) { die(); } -if (empty($u)) { - $u = user::start(); -} - +$u = User::start(); $a = new Achievements($u); $ai = $a->getCheckedInfo(); @@ -120,8 +117,10 @@ if (isset($_GET['nagr'])) { $nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0]; } //Тоже Р±С‹ вынести РІ класс чата. - Db::sql('insert into chat (new, city, room, `to`, `text`, `time`, type) values (?,?,?,?,?,?,?)', - [1, $u->info['city'], $u->info['room'], $u->info['login'], $nagrtxt, -1, 6]); + Db::sql( + 'insert into chat (new, city, room, `to`, `text`, `time`, type) values (?,?,?,?,?,?,?)', + [1, $u->info['city'], $u->info['room'], $u->info['login'], $nagrtxt, -1, 6] + ); } diff --git a/modules_data/vip.php b/modules_data/vip.php index 462256d1..3f15f647 100644 --- a/modules_data/vip.php +++ b/modules_data/vip.php @@ -176,7 +176,6 @@ $vi = array( $i = 0; $seet = ''; $vnr = array(0 => 'на сегодня',1 => ' всего'); while($i < count($ability[$account])) { - if($ability[$account][$i][1]>0) { $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$ability[$account][$i][0].'" LIMIT 1')); diff --git a/mult.php b/mult.php index a28efc8a..d7b4d78a 100644 --- a/mult.php +++ b/mult.php @@ -1,38 +1,34 @@ info['id']) && $u->info['admin'] > 0 ) { - - $html = ''; - $i = 1; - $sp = mysql_query('SELECT `id`,`login`,`money`,`money2`,`level` FROM `users` WHERE `real` = 1 AND `admin` = 0 AND `level` >= 8 AND `pass` NOT LIKE "%saint%" ORDER BY `money` ASC'); - while( $pl = mysql_fetch_array($sp) ) { - // - //prckr - $b0 = mysql_fetch_array(mysql_query('SELECT SUM(`1price`) AS `a` , SUM(`2price`) AS `b` FROM `items_users` WHERE `uid` = "'.$pl['id'].'" AND `delete` = 0 LIMIT 1')); - $b1 = $pl['money'] + $b0['a']; - $b2 = $pl['money2'] + $b0['b']; - // - /*if( $b1 < 1000 ) { $html .= ''; } - $html .= $i.'. '.$u->microLogin($pl['id'],1).' ( '.$b1.' кр. / '.$b2.' екр. )
    '; - if( $b1 < 1000 ) { $html .= '
    '; }*/ - //$i++; - if( $b1 < 1000 ) { - $html .= ''; - $html .= $i.'. '.$u->microLogin($pl['id'],1).' ( '.$b1.' кр. / '.$b2.' екр. )
    '; - $html .= '
    '; - $i++; - } - } - - echo $html; - -}else{ - header('location: https://new-combats.com/'); - die(); +if (!$u->info['admin']) { + header('location: https://new-combats.com/'); + die(); } - -?> \ No newline at end of file +$html = ''; +$i = 1; +$sp = mysql_query( + 'SELECT `id`,`login`,`money`,`money2`,`level` FROM `users` WHERE `real` = 1 AND `admin` = 0 AND `level` >= 8 AND `pass` NOT LIKE "%saint%" ORDER BY `money` ASC' +); +while ($pl = mysql_fetch_array($sp)) { + // + //prckr + $b0 = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`1price`) AS `a` , SUM(`2price`) AS `b` FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" AND `delete` = 0 LIMIT 1' + ) + ); + $b1 = $pl['money'] + $b0['a']; + $b2 = $pl['money2'] + $b0['b']; + if ($b1 < 1000) { + $html .= ''; + $html .= $i . '. ' . $u->microLogin($pl['id'], 1) . ' ( ' . $b1 . ' кр. / ' . $b2 . ' екр. )
    '; + $html .= '
    '; + $i++; + } +} +echo $html; diff --git a/mults.php b/mults.php index 3c1b798b..2f89923d 100644 --- a/mults.php +++ b/mults.php @@ -1,15 +1,16 @@ info['admin'] > 0 ) { - $sp = mysql_query('SELECT * FROM `mults`'); - while( $pl = mysql_fetch_array($sp) ) { - echo ''.$u->microLogin($pl['uid'],1).' пересечение с '.$u->microLogin($pl['uid2'],1).'
    '; - } + +const GAME = true; +include('_incl_data/__config.php'); +include('_incl_data/class/__db_connect.php'); +$u = User::start(); + +if (!$u->info['admin']) { + return; +} +$sp = mysql_query('SELECT * FROM `mults`'); +while ($pl = mysql_fetch_array($sp)) { + echo '' . $u->microLogin($pl['uid'], 1) . ' пересечение с ' . $u->microLogin($pl['uid2'], 1) . '
    '; } -?> \ No newline at end of file diff --git a/myexp.php b/myexp.php index 749aec16..ea4e4bb8 100644 --- a/myexp.php +++ b/myexp.php @@ -1,29 +1,34 @@ \n"; var_dump($vars); echo "\n"; - if ($d) exit(); + if ($d) { + exit(); + } } -define('IP',GetRealIp()); + +define('IP', GetRealIp()); include('_incl_data/__config.php'); -define('GAME',true); +const GAME = true; include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); +$u = User::start(); -if(isset($u->info['id'])) { - $sp = mysql_query('SELECT * FROM `battle_last` WHERE `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC'); - while( $pl = mysql_fetch_array($sp) ) { - echo 'Бой № '.$pl['battle_id'].' , опыт до начала боя: '.$pl['exp'].'
    '; - } +if (isset($u->info['id'])) { + $sp = mysql_query('SELECT * FROM `battle_last` WHERE `uid` = "' . $u->info['id'] . '" ORDER BY `id` DESC'); + while ($pl = mysql_fetch_array($sp)) { + echo 'Бой № ' . $pl['battle_id'] . ' , опыт до начала боя: ' . $pl['exp'] . '
    '; + } } - -?> \ No newline at end of file diff --git a/obraz.php b/obraz.php index 151ad59f..f043ca1c 100644 --- a/obraz.php +++ b/obraz.php @@ -1,352 +1,116 @@ '; +if (in_array($rv, [1, 2])) { + if ($rv == 1) { + $sex = 0; + //Мужские стандартные + } else { + $sex = 1; + //Женские стандартные + } + $sp = Db::getRows( + 'select * from obraz where sex = ? and usr_add = 0 and align = 0 and clan = 0 and login = \'\' and tr = \'\' and itm = 0', + [$sex] + ); +} +if ($rv === 3) { + $sp = Db::getRows('select * from obraz where login != \'\''); } -/* разделы */ -$rz = array( - '', - 'Мужские', - 'Женские' -); - -// Отображать 3Д изображение? True - отображать в любом случае, False - только если существует. -$img3dShow = true; - -/* Пользователь */ -$u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_COOKIE['login']).'" AND `pass` = "'.mysql_real_escape_string($_COOKIE['pass']).'" LIMIT 1')); - -/* Предмет */ -$itm = mysql_fetch_array(mysql_query('SELECT * FROM `obraz` WHERE `id` = "'.mysql_real_escape_string($_GET['id']).'" LIMIT 1')); - - - function timeOut($ttm) { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мес. ";} - $time_still = $time_still-$tmp*2592000; - } - /* - $tmp = floor($time_still/604800); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." нед. ";} - $time_still = $time_still-$tmp*604800; - } - */ - $tmp = floor($time_still/86400); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." дн. ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." ч. ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) - { - $id++; - if ($id<3) {$out .= $tmp." мин. ";} - } - if($out=='') - { - if($time_still<0) - { - $time_still = 0; - } - $out = $time_still.' сек.'; - } - return $out; - } - -function lookStats($m) { - $ist = array(); - $di = explode('|',$m); - $i = 0; $de = false; - while($i + {$itm['name']} +
    {$itm['name']}
    + +HTML; + } } -$itd = lookStats($itm['tr']); -if( $itm['name'] == '' ) { - $itm['name'] = 'Образ №'.$itm['id'].''; -} -if( $itm['history'] == '' ) { - $itm['history'] = 'Летописи Алхимика о нем умалчивают...'; -} - -$items = array( - 'tr' => array('lvl','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','a1','a2','a3','a4','a5','a6','a7','mg1','mg2','mg3','mg4','mg5','mg6','mg7','mall','m2all','aall'), - 'add' => array('min_heal_proc','no_yv1','no_bl1','no_pr1','no_yv2','no_bl2','no_pr2','silver','pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','yron_min','yron_max','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack'), - 'sv' => array('pza','pza1','pza2','pza3','pza4','pzm','pzm1','pzm2','pzm3','pzm4','pzm5','pzm6','pzm7','notravma','min_zonb','min_zona','nokrit','pog','min_use_mp','za1proc','za2proc','za3proc','za4proc','zaproc','zmproc','zm1proc','zm2proc','zm3proc','zm4proc','shopSale','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','aall','a1','a2','a3','a4','a5','a6','a7','m2all','mall','mg1','mg2','mg3','mg4','mg5','mg6','mg7','hpAll','mpAll','m1','m2','m3','m4','m5','m6','m7','m8','m9','m14','m15','m16','m17','m18','m19','m20','pa1','pa2','pa3','pa4','pm1','pm2','pm3','pm4','pm5','pm6','pm7','min_use_mp','za','za1','za2','za3','za4','zma','zm','zm1','zm2','zm3','zm4','zm5','zm6','zm7','mib1','mab1','mib2','mab2','mib3','mab3','mib4','mab4','speedhp','speedmp','m10','m11','zona','zonb','maxves','minAtack','maxAtack') - ); - -$is = array('oza'=>'Защита от урона','oza1'=>'Защита от колющего урона','oza2'=>'Защита от рубящего урона','oza3'=>'Защита от дробящего урона','oza4'=>'Защита от режущего урона','hpAll'=>'Уровень жизни (HP)','mpAll'=>'Уровень маны','sex'=>'Пол','lvl'=>'Уровень','s1'=>'Сила','s2'=>'Ловкость','s3'=>'Интуиция','s4'=>'Выносливость','s5'=>'Интелект','s6'=>'Мудрость','s7'=>'Духовность','s8'=>'Воля','s9'=>'Свобода духа','s10'=>'Божественность','m1'=>'Мф. критического удара (%)','m2'=>'Мф. против критического удара (%)','m3'=>'Мф. мощности критического удара (%)','m4'=>'Мф. увертывания (%)','m5'=>'Мф. против увертывания (%)','m6'=>'Мф. контрудара (%)','m7'=>'Мф. парирования (%)','m8'=>'Мф. блока щитом (%)','m9'=>'Мф. пробоя брони (%)','m14'=>'Мф. абс. критического удара (%)','m15'=>'Мф. абс. увертывания (%)','m16'=>'Мф. абс. парирования (%)','m17'=>'Мф. абс. контрудара (%)','m18'=>'Мф. абс. блока щитом (%)','m19'=>'Мф. абс. магический промах (%)','m20'=>'Мф. удача (%)','a1'=>'Мастерство владения ножами, кинжалами','a2'=>'Мастерство владения топорами, секирами','a3'=>'Мастерство владения дубинами, молотами','a4'=>'Мастерство владения мечами','a5'=>'Мастерство владения магическими посохами','a6'=>'Мастерство владения луками','a7'=>'Мастерство владения арбалетами','aall'=>'Мастерство владения оружием','mall'=>'Мастерство владения магией стихий','m2all'=>'Мастерство владения магией','mg1'=>'Мастерство владения магией огня','mg2'=>'Мастерство владения магией воздуха','mg3'=>'Мастерство владения магией воды','mg4'=>'Мастерство владения магией земли','mg5'=>'Мастерство владения магией Света','mg6'=>'Мастерство владения магией Тьмы','mg7'=>'Мастерство владения серой магией','tj'=>'Тяжелая броня','lh'=>'Легкая броня','minAtack'=>'Минимальный урон','maxAtack'=>'Максимальный урон','m10'=>'Мф. мощности урона','m11'=>'Мф. мощности магии стихий','m11a'=>'Мф. мощности магии','pa1'=>'Мф. мощности колющего урона','pa2'=>'Мф. мощности рубящего урона','pa3'=>'Мф. мощности дробящий урона','pa4'=>'Мф. мощности режущий урона','pm1'=>'Мф. мощности магии огня','pm2'=>'Мф. мощности магии воздуха','pm3'=>'Мф. мощности магии воды','pm4'=>'Мф. мощности магии земли','pm5'=>'Мф. мощности магии Света','pm6'=>'Мф. мощности магии Тьмы','pm7'=>'Мф. мощности серой магии','za'=>'Защита от урона','zm'=>'Защита от магии стихий','zma'=>'Защита от магии','za1'=>'Защита от колющего урона','za2'=>'Защита от рубящего урона','za3'=>'Защита от дробящий урона','za4'=>'Защита от режущий урона','zm1'=>'Защита от магии огня','zm2'=>'Защита от магии воздуха','zm3'=>'Защита от магии воды','zm4'=>'Защита от магии земли','zm5'=>'Защита от магии Света','zm6'=>'Защита от магии Тьмы','zm7'=>'Защита от серой магии','pza'=>'Понижение защиты от урона','pzm'=>'Понижение защиты от магии','pza1'=>'Понижение защиты от колющего урона','min_heal_proc'=>'Эффект лечения (%)','silver'=>'Премиум','notravma'=>'Защита от травм','yron_min'=>'Минимальный урон','yron_max'=>'Максимальный урон','pza2'=>'Понижение защиты от рубящего урона','pza3'=>'Понижение защиты от дробящего урона','pza4'=>'Понижение защиты от режущего урона','pzm1'=>'Понижение защиты от магии огня','pzm2'=>'Понижение защиты от магии воздуха','pzm3'=>'Понижение защиты от магии воды','pzm4'=>'Понижение защиты от магии земли','pzm5'=>'Понижение защиты от магии Света','pzm6'=>'Понижение защиты от магии Тьмы','pzm7'=>'Понижение защиты от серой магии','speedhp'=>'Регенерация здоровья (НР)','speedmp'=>'Регенерация маны (МР)','tya1'=>'Колющие атаки','tya2'=>'Рубящие атаки','tya3'=>'Дробящие атаки','tya4'=>'Режущие атаки','tym1'=>'Огненные атаки','tym2'=>'Электрические атаки','tym3'=>'Ледяные атаки','tym4'=>'Земляные атаки','tym5'=>'Атаки Света','tym6'=>'Атаки Тьмы','tym7'=>'Серые атаки','min_use_mp'=>'Уменьшает расход маны','pog'=>'Поглощение урона','maxves'=>'Увеличивает рюкзак'); - -if( !file_exists('../img.new-combats.com/i/encicl/pict_'.$rz[$rt[$itm['type']]][0].'.jpg') == true ) { - //subject - $rz[$rt[$itm['type']]][0] = 'subject'; -} - -if( !isset($rz[$rt[$itm['type']]][1])) { - $rz[$rt[$itm['type']]][1] = ''; -} - ?> - + - -Новый Бойцовский клуб | Библиотека <? if(isset($itm['id'])) { ?>| <?=$rz[$rt[$itm['type']]][1]?> | <?=$itm['name']?><? } ?> - - + + Новый Бойцовский клуб | Библиотека образов + + - - - - - -
    - - - -
    - - - - - - - - - - - - - - - -
    -

    -
    -

    » Образы / -

    - -

    - -
    - - - - - - - - - - - - - - - - -
      
    -
    - -

     

    -
    - - - -
    - - - - - -
    - -

    -История образа:
    -
    + +
    + +
    -
    -

    - -

        
     
    - 0 ) { - - if($rv == 1) { - //Мужские стандартные - $sp = mysql_query('SELECT * FROM `obraz` WHERE `sex` = 0 AND `standart` = 1'); - }elseif($rv == 2) { - //Женские стандартные - $sp = mysql_query('SELECT * FROM `obraz` WHERE `sex` = 1 AND `standart` = 1'); - } - - } - - - -?> - - - - - - - - - - - - - - -
    -

    » Образы / -

    - -

    - '; - }else{ - - - while( $itm = mysql_fetch_array($sp) ) { - if( $itm['name'] == '' ) { - $itm['name'] = 'Образ №'.$itm['id']; - } - ?> - - - -
    - - - -


    <?=$itm['name']?>
    -
    - -

     

    -
    -

    - -

        
    - - - - Образы персонажей
    - +
    + + + + + + + - - - - -
    + + + +
    +
    +

    Библиотека образов Бойцовского Клуба

    + hr
    + +
    + + +      +

    - Мужские
    -    · Стандартные 
    - Женские
    -    · Стандартные 
    -


    - - -
     
    - -
    - - - - - - - - - + + + +
    -  -
    Copyright © «www.new-combats.com»

    + Образы персонажей +
    + Мужские
    + +
    + Женские
    + +
    + · Именные +
    + + +   +
    + diff --git a/online.php b/online.php index 92e7655c..95578f12 100644 --- a/online.php +++ b/online.php @@ -1,11 +1,11 @@ info['id']) || @@ -21,34 +21,37 @@ if ($u->info['bithday'] == '01.01.1800') { $_GET['r3'] = 1; } -if ($u->info['admin'] == 0) { - //Эта перемычка ЗАПРЕЩАЕТ просмотр всех пользователей чата одновременно РїРѕ запросу. - //unset($_GET['r3']); -} - if ($u->info['online'] < time() - 60) { mysql_query('UPDATE users SET online = unix_timestamp() WHERE id = ' . $u->info['id']); - $filter->setOnline($u->info['online'], $u->info['id'], 0); + $filter->setOnline($u->info['online'], $u->info['id']); $u->onlineBonus(); } -if ( - isset($_POST['delMsg']) && - ( - $u->info['admin'] > 0 || +function isModerOrAdmin($uinfo) +{ + return $uinfo['admin'] > 0 || ( - $u->info['align'] > 1 && - $u->info['align'] < 2) || + $uinfo['align'] > 1 && + $uinfo['align'] < 2) || ( - $u->info['align'] > 3 && - $u->info['align'] < 4 - ) - ) -) { + $uinfo['align'] > 3 && + $uinfo['align'] < 4 + ); +} + +if (isset($_POST['delMsg']) && isModerOrAdmin($u->info)) { if (((int)$_POST['delMsg']) > 0) { - mysql_query('UPDATE `chat` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string(((int)$_POST['delMsg'])) . '" LIMIT 1'); + mysql_query( + 'UPDATE `chat` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string( + ((int)$_POST['delMsg']) + ) . '" LIMIT 1' + ); } else { - mysql_query('UPDATE `users` SET `molch3` = "' . (time() + 3600 * 3) . '" WHERE `id` = "' . mysql_real_escape_string(-((int)$_POST['delMsg'])) . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `molch3` = "' . (time() + 3600 * 3) . '" WHERE `id` = "' . mysql_real_escape_string( + -((int)$_POST['delMsg']) + ) . '" LIMIT 1' + ); } } @@ -58,12 +61,14 @@ $r = [ 'list' => null, 'msg' => null, 'js' => null, - 'xu' => 0 + 'xu' => 0, ]; $u->onlineBonus(); if ($u->info['battle'] > 0) { - $btl = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" AND `time_over` = 0 LIMIT 1')); + $btl = mysql_fetch_array( + mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" AND `time_over` = 0 LIMIT 1') + ); if (!isset($btl['id'])) { $r['js'] .= 'top.frames["main"].location="main.php";'; } @@ -80,50 +85,74 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $x = explode(" ", $buf); $newbuf = ''; for ($j = 0; $j < count($x); $j++) { - $uname = '<Внутренняя ссылка>'; + $uname = '<Внутренняя ссылка>'; // if (strripos($x[$j], 'new-combats.com/info/')) { $ulogin = explode('/info/', $x[$j]); $ulogin = $ulogin[1]; - $ulogin = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "' . mysql_real_escape_string($ulogin) . '" OR `login` = "' . mysql_real_escape_string($ulogin) . '" LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `login` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $ulogin + ) . '" OR `login` = "' . mysql_real_escape_string($ulogin) . '" LIMIT 1' + ) + ); if (isset($ulogin['login'])) { $ulogin = htmlspecialchars($ulogin['login']); - $uname = '<Рнформация Рѕ "' . $ulogin . '">'; + $uname = '<Информация о "' . $ulogin . '">'; } - } elseif (strripos($x[$j], 'audio_1610649509.mp3')) { //РўРЈРў аудио - $uname = '<Голосовое сообщение>'; + } elseif (strripos($x[$j], 'audio_1610649509.mp3')) { //ТУТ аудио + $uname = '<Голосовое сообщение>'; } elseif (strripos($x[$j], 'new-combats.com/item/')) { $ulogin = explode('/item/', $x[$j]); $ulogin = $ulogin[1]; - $ulogin = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($ulogin) . '" LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `name` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string( + $ulogin + ) . '" LIMIT 1' + ) + ); if (isset($ulogin['name'])) { $ulogin = htmlspecialchars($ulogin['name']); - $uname = '<Предмет "' . $ulogin . '">'; + $uname = '<Предмет "' . $ulogin . '">'; } else { - $uname = '<Библиотека предметов>'; + $uname = '<Библиотека предметов>'; } } elseif (strripos($x[$j], 'new-combats.com/news')) { $ulogin = explode('/news', $x[$j]); $ulogin = $ulogin[1]; $ulogin = ltrim($ulogin, '/'); - $ulogin = mysql_fetch_array(mysql_query('SELECT `title` FROM `events_news` WHERE `id` = "' . mysql_real_escape_string($ulogin) . '" LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `title` FROM `events_news` WHERE `id` = "' . mysql_real_escape_string( + $ulogin + ) . '" LIMIT 1' + ) + ); if (isset($ulogin['title'])) { $ulogin = htmlspecialchars($ulogin['title']); - $uname = '<Новость "' . $ulogin . '">'; + $uname = '<Новость "' . $ulogin . '">'; } else { - $uname = '<Новостная лента>'; + $uname = '<Новостная лента>'; } } elseif (strripos($x[$j], 'new-combats.com/lib')) { $ulogin = explode('/lib', $x[$j]); $ulogin = $ulogin[1]; $ulogin = ltrim($ulogin, '/'); $ulogin = rtrim($ulogin, '/'); - $ulogin = mysql_fetch_array(mysql_query('SELECT `title` FROM `library_content` WHERE `url_name` = "' . mysql_real_escape_string($ulogin) . '" AND `moder` > 0 LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `title` FROM `library_content` WHERE `url_name` = "' . mysql_real_escape_string( + $ulogin + ) . '" AND `moder` > 0 LIMIT 1' + ) + ); if (isset($ulogin['title'])) { $ulogin = htmlspecialchars($ulogin['title']); - $uname = '<Библиотека "' . $ulogin . '">'; + $uname = '<Библиотека "' . $ulogin . '">'; } else { - $uname = '<Библиотека>'; + $uname = '<Библиотека>'; } } elseif (strripos($x[$j], 'new-combats.com/forum')) { $ulogin = explode('/forum?read=', $x[$j]); @@ -131,29 +160,45 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $ulogin = explode('&', $ulogin); $ulogin = $ulogin[0]; // - $ulogin = mysql_fetch_array(mysql_query('SELECT `title` FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string($ulogin) . '" AND `delete` = 0 LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `title` FROM `forum_msg` WHERE `id` = "' . mysql_real_escape_string( + $ulogin + ) . '" AND `delete` = 0 LIMIT 1' + ) + ); if (isset($ulogin['title'])) { $ulogin = htmlspecialchars($ulogin['title']); - $uname = '<Форум "' . $ulogin . '">'; + $uname = '<Форум "' . $ulogin . '">'; } else { $ulogin = explode('/forum?r=', $x[$j]); $ulogin = $ulogin[1]; $ulogin = explode('&', $ulogin); $ulogin = $ulogin[0]; // - $ulogin = mysql_fetch_array(mysql_query('SELECT `name` FROM `forum_menu` WHERE `id` = "' . mysql_real_escape_string($ulogin) . '" LIMIT 1')); + $ulogin = mysql_fetch_array( + mysql_query( + 'SELECT `name` FROM `forum_menu` WHERE `id` = "' . mysql_real_escape_string( + $ulogin + ) . '" LIMIT 1' + ) + ); if (isset($ulogin['name'])) { - $uname = '<Конференция форума "' . $ulogin['name'] . '">'; + $uname = '<Конференция форума "' . $ulogin['name'] . '">'; } else { - $uname = '<Форум проекта>'; + $uname = '<Форум проекта>'; } } } // $newbuf .= preg_match - ("/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/", - $x[$j], $ok) ? str_replace($ok[2], "" . $uname . "", - str_replace("https://", "", $x[$j])) . " " : $x[$j] . " "; + ( + "/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/", + $x[$j], $ok + ) ? str_replace( + $ok[2], "" . $uname . "", + str_replace("https://", "", $x[$j]) + ) . " " : $x[$j] . " "; } return $newbuf; } @@ -187,9 +232,19 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $_POST['msg'] = str_replace(' ', ' ', $_POST['msg']); - $smg = mysql_fetch_array(mysql_query('SELECT * FROM `chat` WHERE `login` = "' . $u->info['login'] . '" AND `time` > ' . (time() - 20) . ' ORDER BY `time` DESC LIMIT 1')); + $smg = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `chat` WHERE `login` = "' . $u->info['login'] . '" AND `time` > ' . (time( + ) - 20) . ' ORDER BY `time` DESC LIMIT 1' + ) + ); if ($u->info['exp'] < 499999999) { - $lmg = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `chat` WHERE `login` = "' . $u->info['login'] . '" AND `time` > ' . (time() - 5) . ' LIMIT 2')); + $lmg = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `chat` WHERE `login` = "' . $u->info['login'] . '" AND `time` > ' . (time( + ) - 5) . ' LIMIT 2' + ) + ); } else { $lmg[0] = 0; } @@ -198,15 +253,19 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { if ($u->info['molch1'] < time()) { - //Молчанка Р·Р° флуд РЅР° 5 РјРёРЅСѓС‚ + //Молчанка за флуд на 5 минут $u->info['molch1'] = time() + 1200; - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’С‹ наказаны Р·Р° спам РЅР° 20 РјРёРЅСѓС‚ ","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вы наказаны за спам на 20 минут ","Black","1","1","0"]);'; - mysql_query('UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); mysql_query("UPDATE `chat` SET `delete` = 1 WHERE `login` = '" . $u->info['login'] . "' LIMIT 1000"); - $_POST['msg'] = 'РЇ спамер ' . $u->info['login'] . ' Рё меня нужно заблокировать https://new-combats.com/info/' . $u->info['id'] . ''; + $_POST['msg'] = 'Я спамер ' . $u->info['login'] . ' и меня нужно заблокировать https://new-combats.com/info/' . $u->info['id'] . ''; - mysql_query('INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( + mysql_query( + 'INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( "0", "' . $u->info['invis'] . '", "1", @@ -225,11 +284,13 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { "red", "0", "0", - "0")'); + "0")' + ); - $_POST['msg'] = 'Это супер проект! Всем успехов!'; + $_POST['msg'] = 'Это супер проект! Всем успехов!'; - mysql_query('INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( + mysql_query( + 'INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( "0", "' . $u->info['invis'] . '", "1", @@ -248,27 +309,35 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { "Black", "0", "0", - "0")'); + "0")' + ); } } elseif ($lmg[0] > 0) { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’С‹ РЅРµ можете отправлять так часто сообщения... ","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вы не можете отправлять так часто сообщения... ","Black","1","1","0"]);'; if ($u->info['molch1'] < time()) { if ($u->info['molch1'] < -5) { $u->info['molch1'] = time() + 300; - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’С‹ наказаны Р·Р° флуд РЅР° 5 РјРёРЅСѓС‚ ","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вы наказаны за флуд на 5 минут ","Black","1","1","0"]);'; } elseif ($u->info['molch1'] < 0) { $u->info['molch1']--; } else { $u->info['molch1'] = -1; } - mysql_query('UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); } - } elseif ((preg_match("/private\[(.*?)\]/", $_POST['msg'], $msg['to']) || preg_match("/private \[(.*?)\]/", $_POST['msg'], $msg['to'])) && $u->info['exp'] < 150000) { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’С‹ РЅРµ можете отправлять приват РґРѕ достижения 150000 опыта.","Black","1","1","0"]);'; + } elseif ((preg_match("/private\[(.*?)\]/", $_POST['msg'], $msg['to']) || preg_match( + "/private \[(.*?)\]/", $_POST['msg'], $msg['to'] + )) && $u->info['exp'] < 150000) { + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вы не можете отправлять приват до достижения 150000 опыта.","Black","1","1","0"]);'; } else { - //Записываем данные + //Записываем данные $msg['time'] = time(); $msg['spam'] = 0; $msg['type'] = 1; @@ -285,7 +354,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $msg['da'] = 0; $msg['color'] = $u->info['chatColor']; - //Нормируем типы сообщений + //Нормируем типы сообщений if (preg_match("/private\[(.*?)\]/", $_POST['msg'], $msg['to'])) { $msg['to'] = $msg['to'][1]; $_POST['msg'] = str_replace('private[' . $msg['to'] . ']', 'private [' . $msg['to'] . ']', $_POST['msg']); @@ -305,41 +374,65 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $msg['type'] = 2; $_POST['msg'] = str_replace('to [' . $msg['to'] . ']', ' ', $_POST['msg']); } - if ($u->info['admin'] == 0) { //РўРЈРў SPAM + if ($u->info['admin'] == 0) { //ТУТ SPAM if ($msg['to'] != '' && !isset($admq['id'])) { - $admq = mysql_fetch_array(mysql_query('SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string($msg['to']) . '" AND `admin` > 0 LIMIT 1')); + $admq = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $msg['to'] + ) . '" AND `admin` > 0 LIMIT 1' + ) + ); if ($msg['type'] != 3) { unset($admq); } } if (!isset($admq['id'])) { - $msg['fspam'] = $filter->spamFiltr(str_replace('точка', '.', str_replace('СЂСѓ', 'ru', $_POST['msg']))); + $msg['fspam'] = $filter->spamFiltr(str_replace('точка', '.', str_replace('ру', 'ru', $_POST['msg']))); if ($msg['fspam'] != '0') { $msg['spam'] = 1; $msg['delete'] = 1; - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’ нашем чате запрещается сообщать ссылки РЅР° атльтернативные проекты. Повторные попытки РјРѕРіСѓС‚ привести Рє блокировке персонажа.","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Повторные попытки могут привести к блокировке персонажа.","Black","1","1","0"]);'; } if ($msg['spam'] == 1 && $u->info['molch1'] < time() && $u->info['admin'] == 0) { - $mban = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` >= ' . strtotime('now 00:00:00') . ' AND `vars` = "msg_bans" LIMIT 1', 1); + $mban = $u->testAction( + '`uid` = "' . $u->info['id'] . '" AND `time` >= ' . strtotime( + 'now 00:00:00' + ) . ' AND `vars` = "msg_bans" LIMIT 1', 1 + ); if (!isset($mban['id'])) { $u->addAction(time(), 'msg_bans', '1'); $mban['vals'] = 0; } else { - mysql_query('UPDATE `actions` SET `vals` = `vals` + 1 WHERE `id` = "' . $mban['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `actions` SET `vals` = `vals` + 1 WHERE `id` = "' . $mban['id'] . '" LIMIT 1' + ); $msg['delete'] = time(); } if ($mban['vals'] + 1 < 2) { $msg['fspam'] = str_replace('%', ',', $msg['fspam']); $msg['fspam'] = '' . ltrim($msg['fspam'], '0,') . ''; - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’ нашем чате запрещается сообщать ссылки РЅР° атльтернативные проекты. Запрещенные слова: ' . $msg['fspam'] . '. Предупреждения [' . ($mban['vals'] + 1) . '/1]","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Запрещенные слова: ' . $msg['fspam'] . '. Предупреждения [' . ($mban['vals'] + 1) . '/1]","Black","1","1","0"]);'; } else { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’ нашем чате запрещается сообщать ссылки РЅР° атльтернативные проекты. Р’С‹ наказаны Р·Р° нарушение правил общения.","Black","1","1","0"]);'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','0','','','Автоинформатор: Персонаж " . $u->info['login'] . " [" . $u->info['level'] . "] был наказан Р·Р° нарушение правил общения.','-1','6','0')"); - mysql_query('UPDATE `users` SET `molch1` = "' . (time() + 1 * 60 * 60) . '",`molch2` = "' . (time() + 1 * 60 * 60) . '",`info_delete` = "' . (time() + 1 * 60 * 60) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $rtxt = $rang . ' "' . $u->info['login'] . '" Автоинформатор: ' . $msg['text'] . ' [' . $msg['fspam'] . '].'; - mysql_query("INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('" . $u->info['id'] . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $u->info['city'] . "','" . time() . "','" . $rtxt . "','" . $u->info['login'] . "',0)"); + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Вы наказаны за нарушение правил общения.","Black","1","1","0"]);'; + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','0','','','Автоинформатор: Персонаж " . $u->info['login'] . " [" . $u->info['level'] . "] был наказан за нарушение правил общения.','-1','6','0')" + ); + mysql_query( + 'UPDATE `users` SET `molch1` = "' . (time() + 1 * 60 * 60) . '",`molch2` = "' . (time( + ) + 1 * 60 * 60) . '",`info_delete` = "' . (time( + ) + 1 * 60 * 60) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + $rtxt = $rang . ' "' . $u->info['login'] . '" Автоинформатор: ' . $msg['text'] . ' [' . $msg['fspam'] . '].'; + mysql_query( + "INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('" . $u->info['id'] . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $u->info['city'] . "','" . time( + ) . "','" . $rtxt . "','" . $u->info['login'] . "',0)" + ); } } unset($admq); @@ -348,14 +441,24 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { } } - $qix = mysql_fetch_array(mysql_query('SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string($pl['login']) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1')); + $qix = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string( + $pl['login'] + ) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1' + ) + ); if (isset($qix['id'])) { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Вас добавили РІ РёРіРЅРѕСЂ: Р’С‹ РЅРµ можете отправлять сообщения персонажу "' . htmlspecialchars($msg['to']) . '".","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вас добавили в игнор: Вы не можете отправлять сообщения персонажу "' . htmlspecialchars( + $msg['to'] + ) . '".","Black","1","1","0"]);'; $msg['cancel']++; } if ($msg['type'] == 3 && $msg['to'] == 'klan') { if ($u->info['clan'] == 0) { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’С‹ РЅРµ являетесь частью РѕРґРЅРѕРіРѕ РёР· Кланов Рё РЅРµ можете общаться РїРѕ этому каналу.","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Вы не являетесь частью одного из Кланов и не можете общаться по этому каналу.","Black","1","1","0"]);'; $msg['cancel']++; } else { $msg['to'] = 'k' . $u->info['clan']; @@ -364,7 +467,13 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { } if ($u->info['molch1'] > time()) { if ($msg['to'] != '' && !isset($admq['id'])) { - $admq = mysql_fetch_array(mysql_query('SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string($msg['to']) . '" AND `admin` > 0 LIMIT 1')); + $admq = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $msg['to'] + ) . '" AND `admin` > 0 LIMIT 1' + ) + ); if ($msg['type'] != 3) { unset($admq); } @@ -389,31 +498,34 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $msg['to'] = ''; $msg['type'] = 21; if ($msw == 'USER IS FALSE') { - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Персонажа нет РІ данной комнате.","Black","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","Персонажа нет в данной комнате.","Black","1","1","0"]);'; $nosend = 1; } } elseif ($chat->str_count($_POST['msg'], 3) == '/e ') { $msg['type'] = 21; $_POST['msg'] = ltrim($_POST['msg'], '/e '); - } elseif ($chat->str_count($_POST['msg'], 3) == '/Рµ ') { + } elseif ($chat->str_count($_POST['msg'], 3) == '/е ') { $msg['type'] = 21; - $_POST['msg'] = ltrim($_POST['msg'], '/Рµ '); + $_POST['msg'] = ltrim($_POST['msg'], '/е '); } elseif ($chat->str_count($_POST['msg'], 4) == ' /e ') { $msg['type'] = 21; $_POST['msg'] = ltrim($_POST['msg'], ' /e '); - } elseif ($chat->str_count($_POST['msg'], 4) == ' /Рµ ') { + } elseif ($chat->str_count($_POST['msg'], 4) == ' /е ') { $msg['type'] = 21; - $_POST['msg'] = ltrim($_POST['msg'], ' /Рµ '); + $_POST['msg'] = ltrim($_POST['msg'], ' /е '); } if ($nosend == 0) { - //Рменные смайлики - $_POST['msg'] = str_replace('%usersmile%-', '%usРµrsmilРµ%-', $_POST['msg']); + //Именные смайлики + $_POST['msg'] = str_replace('%usersmile%-', '%usеrsmilе%-', $_POST['msg']); $usml = explode(',', $u->info['add_smiles']); $i = 0; while ($i < count($usml)) { - $_POST['msg'] = str_replace(':' . $usml[$i] . ':', ':%usersmile%-' . $usml[$i] . ':', $_POST['msg']); + $_POST['msg'] = str_replace( + ':' . $usml[$i] . ':', ':%usersmile%-' . $usml[$i] . ':', $_POST['msg'] + ); $i++; } @@ -428,11 +540,13 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $msg['nosee'] = round($u->info['host_reg']); if ($msg['nosee'] == 0) { $msg['nosee'] = -1; - $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","Р’ целях Р±РѕСЂСЊР±С‹ против рекламы, общение РІ чате доступно СЃ 8-РіРѕ СѓСЂРѕРІРЅСЏ. ","red","1","1","0"]);'; + $r['js'] .= 'chat.sendMsg(["new","' . time( + ) . '","6","","' . $u->info['login'] . '","В целях борьбы против рекламы, общение в чате доступно с 8-го уровня. ","red","1","1","0"]);'; } } - mysql_query('INSERT INTO `chat` (`nosee`,`active`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( + mysql_query( + 'INSERT INTO `chat` (`nosee`,`active`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES ( "' . $msg['nosee'] . '", "' . $activ . '", "' . $u->info['invis'] . '", @@ -452,59 +566,85 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { "' . $msg['color'] . '", "' . $msg['typeTime'] . '", "' . $msg['sound'] . '", - "' . $msg['global'] . '")'); + "' . $msg['global'] . '")' + ); } } - if ($msg['type'] == 2 && mb_convert_case($msg['to'], MB_CASE_LOWER) == 'комментатор') { - if (preg_match("/анекдот/i", mb_convert_case($_POST['msg'], MB_CASE_LOWER))) { + if ($msg['type'] == 2 && mb_convert_case($msg['to'], MB_CASE_LOWER) == 'комментатор') { + if (preg_match("/анекдот/i", mb_convert_case($_POST['msg'], MB_CASE_LOWER))) { $text_com = ''; - $sp_all = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `a_com_act` WHERE `act` = "' . $com_act . '" AND `time` > "' . time() . '" LIMIT 5')); + $sp_all = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `a_com_act` WHERE `act` = "' . $com_act . '" AND `time` > "' . time( + ) . '" LIMIT 5' + ) + ); if ($sp_all[0] > 0) { if (rand(0, 100) < 75) { $text_com = [ - 'Отстань попрошайка! ... Рщу анекдоты, интернет РЅРµ маленький!', - 'Подожди... Сейчас что-РЅРёР±СѓРґСЊ найду', - 'Почти нашел...', - 'Р’РѕС‚ РѕРґРёРЅ есть, РЅРѕ РѕРЅ РЅРµ интересный...', - 'Рђ свет РЅР° центральной площади тьму "пинает"... Р­С…...' + 'Отстань попрошайка! ... Ищу анекдоты, интернет не маленький!', + 'Подожди... Сейчас что-нибудь найду', + 'Почти нашел...', + 'Вот один есть, но он не интересный...', + 'А свет на центральной площади тьму "пинает"... Эх...', ]; $text_com = $text_com[rand(0, (count($text_com) - 1))]; } } else { $sp_all = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `a_com_anekdot`')); $sp_all = rand(1, $sp_all[0]); - $sp_all = mysql_fetch_array(mysql_query('SELECT * FROM `a_com_anekdot` WHERE `id` = "' . $sp_all . '" LIMIT 1')); + $sp_all = mysql_fetch_array( + mysql_query('SELECT * FROM `a_com_anekdot` WHERE `id` = "' . $sp_all . '" LIMIT 1') + ); if (isset($sp_all['id'])) { $text_com = $sp_all['text']; $text_com = str_replace("
    ", "
        ", $text_com); $text_com = str_replace("
    ", "
        ", $text_com); $text_com = str_ireplace("\r\n", "", $text_com); $text_com = str_replace("", "", $text_com); - $text_com = 'Анекдот:
        ' . $text_com . '
    '; + $text_com = 'Анекдот:
        ' . $text_com . '
    '; } else { - $text_com = 'Анекдот РёР· головы вылетел...'; + $text_com = 'Анекдот из головы вылетел...'; } - mysql_query('INSERT INTO `a_com_act` (`act`,`time`,`uid`) VALUES ("0","' . (time() + 60) . '","' . $u->info['id'] . '")'); + mysql_query( + 'INSERT INTO `a_com_act` (`act`,`time`,`uid`) VALUES ("0","' . (time( + ) + 60) . '","' . $u->info['id'] . '")' + ); } if ($text_com != '') { - mysql_query('INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $text_com . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time() . '","1")'); + mysql_query( + 'INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $text_com . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time( + ) . '","1")' + ); } } else { include('commentator.php'); if ($comment != '') { - mysql_query('INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $comment . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time() . '","1")'); + mysql_query( + 'INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $comment . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time( + ) . '","1")' + ); } } } - mysql_query('UPDATE `users` SET `afk` = "",`dnd` = "",`timeMain` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `afk` = "",`dnd` = "",`timeMain` = "' . time( + ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); } } -//Получаем СЃРїРёСЃРѕРє онлайн +//Получаем список онлайн if ($_GET['r1'] != 0) { - $sp = mysql_query('SELECT `u`.`pass`,`u`.`sex`,`s`.`dnow`,`u`.`timeMain`,`s`.`bot`,`s`.`atack`,`u`.`afk`,`u`.`dnd`,`u`.`banned`,`u`.`molch1`,`u`.`room`,`u`.`id`,`u`.`city`,`u`.`cityreg`,`u`.`online`,`u`.`align`,`u`.`clan`,`u`.`login`,`u`.`level`,`u`.`inTurnir`,`u`.`battle`,`u`.`invis`,`u`.`inUser`,`s`.`x`,`s`.`y` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE ((`u`.`room` = "' . $u->info['room'] . '" AND "' . mysql_real_escape_string((int)$_GET['r3']) . '" != "1") OR ("' . mysql_real_escape_string((int)$_GET['r3']) . '" = "1" AND `pass` NOT LIKE "%saint%")) AND `mail`!="No E-mail" AND `room` != "303" ORDER BY `u`.`inUser` DESC,`u`.`online` DESC,`u`.`login` DESC LIMIT 1000'); + $sp = mysql_query( + 'SELECT `u`.`pass`,`u`.`sex`,`s`.`dnow`,`u`.`timeMain`,`s`.`bot`,`s`.`atack`,`u`.`afk`,`u`.`dnd`,`u`.`banned`,`u`.`molch1`,`u`.`room`,`u`.`id`,`u`.`city`,`u`.`cityreg`,`u`.`online`,`u`.`align`,`u`.`clan`,`u`.`login`,`u`.`level`,`u`.`inTurnir`,`u`.`battle`,`u`.`invis`,`u`.`inUser`,`s`.`x`,`s`.`y` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE ((`u`.`room` = "' . $u->info['room'] . '" AND "' . mysql_real_escape_string( + (int)$_GET['r3'] + ) . '" != "1") OR ("' . mysql_real_escape_string( + (int)$_GET['r3'] + ) . '" = "1" AND `pass` NOT LIKE "%saint%")) AND `mail`!="No E-mail" AND `room` != "303" ORDER BY `u`.`inUser` DESC,`u`.`online` DESC,`u`.`login` DESC LIMIT 1000' + ); $ar_id = 0; $ar_lvl = 0; $ar_all = 0; @@ -518,7 +658,9 @@ if ($_GET['r1'] != 0) { $ysee = 0; } else { if ($pl['online'] < time() - 120) { - mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); } } } else { @@ -570,9 +712,13 @@ if ($_GET['r1'] != 0) { if ($pl['clan'] > 0) { if ($u->info['clan'] > 0 && $pl['clan'] != $u->info['clan']) { if (!isset($cw['war'][$pl['clan']][$u->info['clan']])) { - $pl['cwar'] = mysql_fetch_array(mysql_query('SELECT `id`,`type` FROM `clan_wars` WHERE + $pl['cwar'] = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`type` FROM `clan_wars` WHERE ((`clan1` = "' . $pl['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $pl['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND - `time_finish` > ' . time() . ' LIMIT 1')); + `time_finish` > ' . time() . ' LIMIT 1' + ) + ); if (isset($pl['cwar']['id'])) { $cw['war'][$pl['clan']][$u->info['clan']] = $pl['cwar']['type']; } else { @@ -584,7 +730,9 @@ if ($_GET['r1'] != 0) { } } if (!isset($cw[$pl['clan']])) { - $pl['clan'] = mysql_fetch_array(mysql_query('SELECT `name_mini` FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')); + $pl['clan'] = mysql_fetch_array( + mysql_query('SELECT `name_mini` FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1') + ); } else { $pl['clan'] = $cw[$pl['clan']]; } @@ -597,7 +745,11 @@ if ($_GET['r1'] != 0) { } else { $pl['atack'] = 0; } - $trvm = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6')); + $trvm = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`name` FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6' + ) + ); $trvm = $trvm['name']; $r['list'] .= '"' . $r['xu'] . '":["' . $pl['id'] . '","' . $pl['login'] . '","' . $pl['level'] . '","' . $pl['align'] . '","' . $pl['clan'] . '","' . $pl['cityreg'] . '","' . $pl['city'] . '","' . $pl['room'] . '","' . $pl['afk'] . '","' . $pl['dnd'] . '","' . $pl['banned'] . '","' . $pl['molch1'] . '","' . $pl['battle'] . '","' . $pl['atack'] . '","' . $trvm . '","' . ($pl['sex'] * 0) . '","' . $pl['align2'] . '"],'; $ar_id += $pl['id']; @@ -621,13 +773,14 @@ function json_fix_cyr($json_str) } -//Получаем сообщения +//Получаем сообщения if (isset($_GET['mid']) && !isset($_POST['mid'])) { $_POST['mid'] = $_GET['mid']; } $i = 0; $l = 0; -$sp = mysql_query('SELECT `nosee`,`frv`,`id`,`dn`,`active`,`invis`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`,`delete`,`molch`,`da` FROM `chat` WHERE +$sp = mysql_query( + 'SELECT `nosee`,`frv`,`id`,`dn`,`active`,`invis`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`,`delete`,`molch`,`da` FROM `chat` WHERE ( ( `delete` > 0 @@ -685,7 +838,8 @@ $sp = mysql_query('SELECT `nosee`,`frv`,`id`,`dn`,`active`,`invis`,`login`,`to`, ) ) ) - ORDER BY `id` ASC'); + ORDER BY `id` ASC' +); while ($pl = mysql_fetch_array($sp)) { if ($pl['delete'] > 0) { @@ -698,20 +852,7 @@ while ($pl = mysql_fetch_array($sp)) { $see = 1; - if ( - $pl['type'] == 8 && - $u->info['admin'] == 0 && - ( - ( - $u->info['align'] <= 1 || - $u->info['align'] >= 2 - ) && - ( - $u->info['align'] <= 3 || - $u->info['align'] >= 4 - ) - ) - ) { + if ($pl['type'] == 8 && isModerOrAdmin($u->info)) { $see = 0; } @@ -720,7 +861,7 @@ while ($pl = mysql_fetch_array($sp)) { $pl['city'] = $u->info['city']; } - //Проверки РЅР° доступ Рє просмотру + //Проверки на доступ к просмотру if ( (( ( @@ -737,14 +878,7 @@ while ($pl = mysql_fetch_array($sp)) { $pl['type'] == 5 || $pl['type'] == 6 || ( - $pl['type'] == 8 && - ( - $u->info['admin'] > 0 || - ( - $u->info['align'] > 1 && - $u->info['align'] < 2 - ) - ) + $pl['type'] == 8 && isModerOrAdmin($u->info) ) ) && ( @@ -785,7 +919,7 @@ while ($pl = mysql_fetch_array($sp)) { } unset($n, $j, $ex); } - //Клановое сообщение (РїРѕ всем городам) + //Клановое сообщение (по всем городам) if ($pl['type'] == -3 && ($pl['to'] == 'k' . $u->info['clan'] || $u->info['admin'] > 0)) { $pl['type'] = 3; if ($pl['to'] == 'k' . $u->info['clan']) { @@ -796,7 +930,7 @@ while ($pl = mysql_fetch_array($sp)) { $see = 0; } - //Системное сообщение только РІ этой комнате + //Системное сообщение только в этой комнате if ( $pl['type'] == 6 && $pl['room'] > 0 && @@ -806,17 +940,17 @@ while ($pl = mysql_fetch_array($sp)) { $see = 0; } - //Системное сообщение РїРѕ всему РіРѕСЂРѕРґСѓ + //Системное сообщение по всему городу if ($pl['type'] == 8 && $pl['city'] != $u->info['city'] && $pl['global'] == 0) { $see = 0; } - //Сообщение СЃ молчанкой + //Сообщение с молчанкой if ($pl['molch'] > 0) { $see = 0; } - //Сообщение отправлено РІ РґСЂСѓРіРѕР№ комнате + //Сообщение отправлено в другой комнате if ( ( $pl['type'] == 1 || @@ -834,24 +968,24 @@ while ($pl = mysql_fetch_array($sp)) { $see = 0; } - //Сообщение прочее, РІ РґСЂСѓРіРѕРј РіРѕСЂРѕРґРµ + //Сообщение прочее, в другом городе if ($pl['city'] != $u->info['city'] && $pl['global'] == 0) { $see = 0; } - //Глобал + //Глобал if ($pl['global'] == 1 && $pl['city'] == $u->info['city'] && $pl['type'] != -3) { $see = 1; } - //Пещерное сообщение + //Пещерное сообщение if ($pl['dn'] > 0 && $u->info['dnow'] != $pl['dn']) { $see = 0; } $modr = 0; - if (($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) { + if (isModerOrAdmin($u->info)) { $modr = 1; } @@ -859,9 +993,9 @@ while ($pl = mysql_fetch_array($sp)) { $see = 0; } else { if ($pl['nosee'] != 0 && $pl['login'] != $u->info['login']) { - $noseein = 'скрыто'; + $noseein = 'скрыто'; if ($u->info['id'] == $pl['nosee']) { - $noseein = 'ваш реферал'; + $noseein = 'ваш реферал'; } $pl['text'] = '[' . $noseein . '] ' . $pl['text'] . ''; if ($u->info['admin'] > 0 || $modr == 1) { @@ -872,7 +1006,13 @@ while ($pl = mysql_fetch_array($sp)) { if ($see == 1 && $pl['delete'] == 0 && $pl['login'] != '') { - $qix = mysql_fetch_array(mysql_query('SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string($pl['login']) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1')); + $qix = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string( + $pl['login'] + ) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1' + ) + ); if (isset($qix['id'])) { $see = 0; } @@ -885,7 +1025,10 @@ while ($pl = mysql_fetch_array($sp)) { $lmsch = mysql_fetch_array(mysql_query('SELECT `id` FROM `chat` ORDER BY `id` DESC LIMIT 1')); if (isset($lmsch['id'])) { $lmsch['id']++; - mysql_query('UPDATE `chat` SET `id` = "' . $lmsch['id'] . '",`time` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `chat` SET `id` = "' . $lmsch['id'] . '",`time` = "' . time( + ) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); $pl['id'] = $lmsch['id']; } else { mysql_query('UPDATE `chat` SET `time` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); @@ -899,17 +1042,27 @@ while ($pl = mysql_fetch_array($sp)) { $r['msg'] .= ',"' . $i . '":{"s":"' . $pl['id'] . '"}'; } else { $reimg = []; - if (preg_match_all("/\[img\[(.*?)\]\]\[1\]/", $pl['text'], $reimg) && ($u->info['admin'] > 0 || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) { + if (preg_match_all( + "/\[img\[(.*?)\]\]\[1\]/", $pl['text'], $reimg + ) && ($u->info['admin'] > 0 || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) { $k = 0; while ($k <= count($reimg[1])) { - $pl['text'] = str_replace('[img[' . $reimg[1][$k] . ']][1]', '', $pl['text']); + $pl['text'] = str_replace( + '[img[' . $reimg[1][$k] . ']][1]', + '', $pl['text'] + ); $k++; } } - if (preg_match_all("/\[img\[(.*?)\]\]/", $pl['text'], $reimg) && ($u->info['admin'] > 0 || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) { + if (preg_match_all( + "/\[img\[(.*?)\]\]/", $pl['text'], $reimg + ) && ($u->info['admin'] > 0 || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) { $k = 0; while ($k <= count($reimg[1])) { - $pl['text'] = str_replace('[img[' . $reimg[1][$k] . ']]', '', $pl['text']); + $pl['text'] = str_replace( + '[img[' . $reimg[1][$k] . ']]', '', + $pl['text'] + ); $k++; } } @@ -917,31 +1070,43 @@ while ($pl = mysql_fetch_array($sp)) { if (preg_match_all("/item\[(.*?)\]/", $pl['text'], $reimg)) { $k = 0; while ($k <= count($reimg[1])) { - $pl['text'] = str_replace('item[' . $reimg[1][$k] . ']', 'Предмет', $pl['text']); + $pl['text'] = str_replace( + 'item[' . $reimg[1][$k] . ']', + 'Предмет', + $pl['text'] + ); $k++; } } - if (preg_match_all("/\.(?:mp3)$/i", $pl['text'], $reimg)) //РўРЈРў аудио audio + if (preg_match_all("/\.(?:mp3)$/i", $pl['text'], $reimg)) //ТУТ аудио audio { $k = 0; while ($k <= count($reimg[1])) { - $pl['text'] = str_replace('item[' . $reimg[1][$k] . ']', 'РђСѓРґРёРѕ запись', $pl['text']); + $pl['text'] = str_replace( + 'item[' . $reimg[1][$k] . ']', + 'Аудио запись', + $pl['text'] + ); $k++; } } if (preg_match_all("/item \[(.*?)\]/", $pl['text'], $reimg)) { $k = 0; while ($k <= count($reimg[1])) { - $pl['text'] = str_replace('item [' . $reimg[1][$k] . ']', 'Предмет', $pl['text']); + $pl['text'] = str_replace( + 'item [' . $reimg[1][$k] . ']', + 'Предмет', + $pl['text'] + ); $k++; } } if ($pl['type'] != 3 && ($pl['invis'] == 1 || $pl['invis'] > time())) { if ($u->info['admin'] == 0) { - $pl['login'] = 'Невидимка'; + $pl['login'] = 'Невидимка'; } else { - $pl['login'] = 'Невидимка (' . $pl['login'] . ')'; + $pl['login'] = 'Невидимка (' . $pl['login'] . ')'; } } @@ -950,7 +1115,9 @@ while ($pl = mysql_fetch_array($sp)) { $pl['color'] = 'Black'; } - $r['msg'] .= ',"m' . $i . '":["' . $pl['id'] . '","' . $pl['time'] . '","' . $pl['type'] . '","' . $pl['login'] . '","' . $pl['to'] . '","' . $pl['text'] . '","' . $pl['color'] . '","' . $pl['toChat'] . '","' . $pl['typeTime'] . '","' . $pl['sound'] . '","' . $pl['global'] . '","' . $pl['molch'] . '","' . $pl['active'] . '","' . date('H:i', $pl['time']) . '","' . date('d.m.Y H:i', $pl['time']) . '","' . $pl['frv'] . '","' . $pl['invis'] . '"]'; + $r['msg'] .= ',"m' . $i . '":["' . $pl['id'] . '","' . $pl['time'] . '","' . $pl['type'] . '","' . $pl['login'] . '","' . $pl['to'] . '","' . $pl['text'] . '","' . $pl['color'] . '","' . $pl['toChat'] . '","' . $pl['typeTime'] . '","' . $pl['sound'] . '","' . $pl['global'] . '","' . $pl['molch'] . '","' . $pl['active'] . '","' . date( + 'H:i', $pl['time'] + ) . '","' . date('d.m.Y H:i', $pl['time']) . '","' . $pl['frv'] . '","' . $pl['invis'] . '"]'; } } if ($l < $pl['id']) { @@ -960,26 +1127,27 @@ while ($pl = mysql_fetch_array($sp)) { } $r['msg'] = '{"ld":"' . (0 + $l) . '","id":"' . $i . '"' . $r['msg'] . '}'; -$rsys = $u->sys_see(0); -if ($rsys != '') { - $r['js'] .= $rsys; -} -unset($rsys); -//Генерируем ключ + +//Генерируем ключ $r['key'] = md5($u->room['name'] . '+' . $ar_id . '+' . $ar_lvl . '+' . $ar_all); unset($ar_id, $ar_lvl); if ($_COOKIE['chatCfg12'] == 0) { $_GET['key'] = time(); } if ($r['key'] == $_GET['key']) { - //РЎРїРёСЃРѕРє онлайн остается неизменным + //Список онлайн остается неизменным unset($r['rn'], $r['list'], $r['key'], $r['xu']); } elseif ($_GET['r1'] != 0) { $r['rn'] = iconv('cp1251', 'utf-8', $u->room['name']); $r['list'] = iconv('cp1251', 'utf-8', $r['list']); } -$posts = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` AS `iu` WHERE `iu`.`uid` = "-51' . $u->info['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `iu`.`lastUPD` < ' . time() . ' LIMIT 1')); +$posts = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `items_users` AS `iu` WHERE `iu`.`uid` = "-51' . $u->info['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `iu`.`lastUPD` < ' . time( + ) . ' LIMIT 1' + ) +); $posts = $posts[0]; if ($posts > 0) { @@ -988,17 +1156,25 @@ if ($posts > 0) { $r['js'] .= ' $("#postdiv").hide();'; } -//Предложения вступить РІ клан +//Предложения вступить в клан $sp = mysql_query('SELECT * FROM `clan_add` WHERE `uid` = "' . $u->info['id'] . '" AND `yes` = 0 AND `no` = 0'); while ($pl = mysql_fetch_array($sp)) { - $clns = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`align` FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')); - $usr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level` FROM `users` WHERE `id` = "' . $pl['uid_clan'] . '" LIMIT 1')); + $clns = mysql_fetch_array( + mysql_query('SELECT `id`,`name`,`align` FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1') + ); + $usr = mysql_fetch_array( + mysql_query('SELECT `id`,`login`,`level` FROM `users` WHERE `id` = "' . $pl['uid_clan'] . '" LIMIT 1') + ); $r['js'] .= 'top.inclanNew(' . $pl['id'] . ',"' . $clns['align'] . '","' . $clns['id'] . '","' . $clns['name'] . '","' . $usr['login'] . '
    [' . $usr['level'] . ']");'; } unset($clns); -//Предложение РЅР° обмен -$trf = mysql_fetch_array(mysql_query('SELECT * FROM `transfers` WHERE `uid2` = "' . $u->info['id'] . '" AND `start2` = 0 AND `cancel1` = 0 AND `cancel2` = 0 LIMIT 1')); +//Предложение на обмен +$trf = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `transfers` WHERE `uid2` = "' . $u->info['id'] . '" AND `start2` = 0 AND `cancel1` = 0 AND `cancel2` = 0 LIMIT 1' + ) +); if (isset($trf['id'])) { $utf = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "' . $trf['uid1'] . '" LIMIT 1')); if (isset($utf['login']) && $u->info['battle'] == 0) { @@ -1008,7 +1184,7 @@ if (isset($trf['id'])) { } } -//Перекодируем строки +//Перекодируем строки if ($r['js'] != null) { $r['js'] = iconv('cp1251', 'utf-8', $r['js']); } else { diff --git a/quest_dlg_edit.php b/quest_dlg_edit.php index f9036c3f..b29fc00e 100644 --- a/quest_dlg_edit.php +++ b/quest_dlg_edit.php @@ -1,4 +1,5 @@ info['admin'] > 0 ) { - - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($_GET['pid']).'" LIMIT 1')); - if(isset($itm['id'])) { - if($itm['qid'] == 0) { - if(isset($_POST['newdata'])) { - mysql_query('UPDATE `dungeon_dlg` SET `text` = "'.mysql_real_escape_string($_POST['newdata']).'" WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1'); - die(''); - }elseif(isset($_GET['delete']) && $_GET['delete'] == 'true') { - //Удаляем саму страницу диалога - mysql_query('DELETE FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1'); - //Удаляем ответы страницы диалога - mysql_query('DELETE FROM `dungeon_dlg` WHERE `qid` = "'.mysql_real_escape_string($itm['id']).'"'); - die(''); - } - echo '
    Номер диалога: '.$itm['id'].'

    '; - }else{ - if(isset($_POST['newdata'])) { - mysql_query('UPDATE `dungeon_dlg` SET `text` = "'.mysql_real_escape_string($_POST['newdata']).'",`action` = "'.mysql_real_escape_string($_POST['newdata2']).'",`tr` = "'.mysql_real_escape_string($_POST['newdata3']).'",`sort` = "'.mysql_real_escape_string((int)$_POST['newdata4']).'" WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1'); - die(''); - }elseif(isset($_GET['delete']) && $_GET['delete'] == 'true') { - //Удаляем саму страницу диалога - mysql_query('DELETE FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1'); - die(''); - } - echo '
    Номер варианта ответа: '.$itm['id'].'

    Действия:
    Требует:
    Приоритет вывода:
    '; - } - }else{ - echo 'Диалог не найден.'; - } +if ($u->info['admin'] <= 0) { + return; +} + +$itm = mysql_fetch_array( + mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id` = "' . mysql_real_escape_string($_GET['pid']) . '" LIMIT 1') +); +if (isset($itm['id'])) { + if ($itm['qid'] == 0) { + if (isset($_POST['newdata'])) { + mysql_query( + 'UPDATE `dungeon_dlg` SET `text` = "' . mysql_real_escape_string( + $_POST['newdata'] + ) . '" WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1' + ); + die(''); + } elseif (isset($_GET['delete']) && $_GET['delete'] == 'true') { + //Удаляем саму страницу диалога + mysql_query( + 'DELETE FROM `dungeon_dlg` WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1' + ); + //Удаляем ответы страницы диалога + mysql_query('DELETE FROM `dungeon_dlg` WHERE `qid` = "' . mysql_real_escape_string($itm['id']) . '"'); + die(''); + } + echo '
    Номер диалога: ' . $itm['id'] . '

    '; + } else { + if (isset($_POST['newdata'])) { + mysql_query( + 'UPDATE `dungeon_dlg` SET `text` = "' . mysql_real_escape_string( + $_POST['newdata'] + ) . '",`action` = "' . mysql_real_escape_string( + $_POST['newdata2'] + ) . '",`tr` = "' . mysql_real_escape_string( + $_POST['newdata3'] + ) . '",`sort` = "' . mysql_real_escape_string( + (int)$_POST['newdata4'] + ) . '" WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1' + ); + die(''); + } elseif (isset($_GET['delete']) && $_GET['delete'] == 'true') { + //Удаляем саму страницу диалога + mysql_query( + 'DELETE FROM `dungeon_dlg` WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1' + ); + die(''); + } + echo '
    Номер варианта ответа: ' . $itm['id'] . '

    Действия:
    Требует:
    Приоритет вывода:
    '; + } +} else { + echo 'Диалог не найден.'; } - -?> \ No newline at end of file diff --git a/recovery.php b/recovery.php index 136047d1..9a762817 100644 --- a/recovery.php +++ b/recovery.php @@ -1,106 +1,115 @@ info['id']) || $u->info['admin'] == 0) { +if(!$u->info['admin']) { header('location: https://new-combats.com/'); die(); } -// $_GET['id'] = (int)$_GET['id']; $_GET['exp'] = (int)$_GET['exp']; -// $us = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.mysql_real_escape_string($_GET['id']).'" LIMIT 1')); -if( !isset($us['id']) ) { - -}else{ - $st = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.mysql_real_escape_string($us['id']).'" LIMIT 1')); - $lvl = mysql_fetch_array(mysql_query('SELECT * FROM `levels` WHERE `upLevel` = "'.$st['upLevel'].'" LIMIT 1')); - $lvn = mysql_fetch_array(mysql_query('SELECT * FROM `levels` WHERE `exp` <= "'.mysql_real_escape_string($_GET['exp']).'" ORDER BY `exp` DESC LIMIT 1')); - // - echo 'Логин: '.$us['login'].' ['.$us['level'].', ап:'.$st['upLevel'].']
    Откатываем на '.$_GET['exp'].' опыта (Уровень: '.$lvn['nextLevel'].' , апп: '.$lvn['upLevel'].').
    '; - // - $r = array( 0 , 0 , 0 , 0 , 0 , 0 ); - // - $sp = mysql_query('SELECT * FROM `levels` WHERE `upLevel` <= '.$st['upLevel'].' AND `upLevel` > '.$lvn['upLevel'].''); - while( $pl = mysql_fetch_array($sp) ) { - if(isset($pl['vinosl'])) { - $pl['vinos'] = $pl['vinosl']; - } - $r[0] -= $pl['ability']; - $r[1] -= $pl['skills']; - $r[2] -= $pl['nskills']; - $r[3] -= $pl['vinos']; - $r[4] -= $pl['duh']; - $r[5] -= $pl['money']; - } - // - $sts = $u->lookStats($st['stats']); - $nst = array( - 's1' => 3, - 's2' => 3, - 's3' => 3, - 's4' => 3, - 's5' => 0, - 's6' => 0, - 's7' => 0 - ); - // - $sp = mysql_query('SELECT * FROM `levels` WHERE `upLevel` <= '.$lvn['upLevel'].''); - while( $pl = mysql_fetch_array($sp) ) { - if(isset($pl['vinosl'])) { - $pl['vinos'] = $pl['vinosl']; - } - $nst['s4'] += $pl['vinos']; - $nst['s7'] += $pl['duh']; - $nst['a'] += $pl['ability']; - $nst['s'] += $pl['skills']; - $nst['n'] += $pl['nskills']; - } - // - $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "'.$us['id'].'" LIMIT 1')); - $nst['a'] += $rep['add_stats']; - $nst['s'] += $rep['add_skills']; - $nst['n'] += $rep['add_skills2']; - // - echo '
    Откат уровня: '.($lvn['nextLevel']-$us['level']).'
    '; - echo '
    Откат статов: '. $r[0]; - echo '
    Откат умений: '. $r[1]; - echo '
    Откат навыков: '. $r[2]; - echo '
    Откат выносливости: '. $r[3]; - echo '
    Откат духа: '. $r[4]; - echo '
    Откат денег: '. $r[5]; - echo '
    '; - // - echo '
    '; - // - $stt = 's7='.$nst['s7'].'|s1=3|s2=3|s3=3|s4='.$nst['s4'].'|s5=0|s6=0|s8=0|s9=0|s10=0|s11=0|a1=0|mg1=0|a2=0|mg2=0|a3=0|mg3=0|a4=10|mg4=0|a5=0|mg5=0|a6=0|mg6=0|a7=0|mg7=0|os1=0|os2=0|os3=0|os4=0|os5=0|os6=0|os7=0|os8=0|os9=0|os10=0|os11=0|s12=0|s13=0|s14=0|s15=0'; - echo $stt; - print_r($nst); - // - if(isset($_GET['good'])) { - // - mysql_query('UPDATE `users` SET `level` = "'.$lvn['nextLevel'].'" , `money` = "'.($us['money'] + $r['5']).'" WHERE `id` = "'.$us['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET - - `stats` = "'.$stt.'", - `upLevel` = "'.$lvn['upLevel'].'", - `ability` = "'.$nst['a'].'", - `skills` = "'.$nst['s'].'", - `nskills` = "'.$nst['n'].'", - `exp` = "'.mysql_real_escape_string($_GET['exp']).'" - - WHERE `id` = "'.$us['id'].'" LIMIT 1'); - // - }else{ - echo '
    Откатить!'; - } - // +if(!isset($us['id'])) { + return; +} +$st = mysql_fetch_array( + mysql_query('SELECT * FROM `stats` WHERE `id` = "' . mysql_real_escape_string($us['id']) . '" LIMIT 1') +); +$lvl = mysql_fetch_array(mysql_query('SELECT * FROM `levels` WHERE `upLevel` = "' . $st['upLevel'] . '" LIMIT 1')); +$lvn = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `levels` WHERE `exp` <= "' . mysql_real_escape_string( + $_GET['exp'] + ) . '" ORDER BY `exp` DESC LIMIT 1' + ) +); +// +echo 'Логин: ' . $us['login'] . ' [' . $us['level'] . ', ап:' . $st['upLevel'] . ']
    Откатываем на ' . $_GET['exp'] . ' опыта (Уровень: ' . $lvn['nextLevel'] . ' , апп: ' . $lvn['upLevel'] . ').
    '; +// +$r = [0, 0, 0, 0, 0, 0]; +// +$sp = mysql_query( + 'SELECT * FROM `levels` WHERE `upLevel` <= ' . $st['upLevel'] . ' AND `upLevel` > ' . $lvn['upLevel'] . '' +); +while ($pl = mysql_fetch_array($sp)) { + if (isset($pl['vinosl'])) { + $pl['vinos'] = $pl['vinosl']; + } + $r[0] -= $pl['ability']; + $r[1] -= $pl['skills']; + $r[2] -= $pl['nskills']; + $r[3] -= $pl['vinos']; + $r[4] -= $pl['duh']; + $r[5] -= $pl['money']; +} +// +$sts = $u->lookStats($st['stats']); +$nst = [ + 's1' => 3, + 's2' => 3, + 's3' => 3, + 's4' => 3, + 's5' => 0, + 's6' => 0, + 's7' => 0 +]; +// +$sp = mysql_query('SELECT * FROM `levels` WHERE `upLevel` <= ' . $lvn['upLevel'] . ''); +while ($pl = mysql_fetch_array($sp)) { + if (isset($pl['vinosl'])) { + $pl['vinos'] = $pl['vinosl']; + } + $nst['s4'] += $pl['vinos']; + $nst['s7'] += $pl['duh']; + $nst['a'] += $pl['ability']; + $nst['s'] += $pl['skills']; + $nst['n'] += $pl['nskills']; +} +// +$rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $us['id'] . '" LIMIT 1')); +$nst['a'] += $rep['add_stats']; +$nst['s'] += $rep['add_skills']; +$nst['n'] += $rep['add_skills2']; +// +echo '
    Откат уровня: ' . ($lvn['nextLevel'] - $us['level']) . '
    '; +echo '
    Откат статов: ' . $r[0]; +echo '
    Откат умений: ' . $r[1]; +echo '
    Откат навыков: ' . $r[2]; +echo '
    Откат выносливости: ' . $r[3]; +echo '
    Откат духа: ' . $r[4]; +echo '
    Откат денег: ' . $r[5]; +echo '
    '; +// +echo '
    '; +// +$stt = 's7=' . $nst['s7'] . '|s1=3|s2=3|s3=3|s4=' . $nst['s4'] . '|s5=0|s6=0|s8=0|s9=0|s10=0|s11=0|a1=0|mg1=0|a2=0|mg2=0|a3=0|mg3=0|a4=10|mg4=0|a5=0|mg5=0|a6=0|mg6=0|a7=0|mg7=0|os1=0|os2=0|os3=0|os4=0|os5=0|os6=0|os7=0|os8=0|os9=0|os10=0|os11=0|s12=0|s13=0|s14=0|s15=0'; +echo $stt; +print_r($nst); +// +if (isset($_GET['good'])) { + // + mysql_query( + 'UPDATE `users` SET `level` = "' . $lvn['nextLevel'] . '" , `money` = "' . ($us['money'] + $r['5']) . '" WHERE `id` = "' . $us['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `stats` SET + + `stats` = "' . $stt . '", + `upLevel` = "' . $lvn['upLevel'] . '", + `ability` = "' . $nst['a'] . '", + `skills` = "' . $nst['s'] . '", + `nskills` = "' . $nst['n'] . '", + `exp` = "' . mysql_real_escape_string($_GET['exp']) . '" + + WHERE `id` = "' . $us['id'] . '" LIMIT 1' + ); + // +} else { + echo '
    Откатить!'; } -?> \ No newline at end of file diff --git a/reg.php b/reg.php index fcee65b4..f8566f85 100644 --- a/reg.php +++ b/reg.php @@ -1,333 +1,349 @@ info['id']) && $u->info['bithday'] == '01.01.1800') { - // - $_POST['reg_login'] = iconv('UTF-8', 'windows-1251', $_POST['reg_login']); - // - $reg_d = array( - 0 => $_POST['reg_login'], - 1 => $_POST['reg_pass'], - 2 => $_POST['reg_pass2'], - 3 => $_POST['reg_mail'], - 7 => $_POST['reg_dd'], - 8 => $_POST['reg_mm'], - 9 => $_POST['reg_yy'], - 15 => $_POST['reg_sex'] - ); - // - $error = ''; - // - //Запрещенные логины - $nologin = array(0=>'ангел',1=>'angel',2=>'администрация',3=>'administration',4=>'Комментатор',5=>'Мироздатель',6=>'Мусорщик',7=>'Падальщик',8=>'Повелитель',9=>'Архивариус',10=>'Пересмешник',11=>'Волынщик',12=>'Лорд Разрушитель',13=>'Милосердие',14=>'Справедливость',15=>'Искушение',16=>'Вознесение',17=>'coombats',18=>'коомбатс ру',19=>'Коомбатс _ру'); - $blacklist = "!@#$%^&*()\+Ёё|/'`\""; - $sr = '_-йцукенгшщзхъфывапролджэячсмитьбюё1234567890'; - $i = 0; - while($imystr($reg_d[0]))) - { - $error = 'Выберите, пожалуйста, другой ник.
    '; $_POST['step'] = 1; $i = count($nologin); - } - $i++; - } - $reg_d[0] = str_replace(' ',' ',$reg_d[0]); - //Логин от 2 до 20 символов - if(strlen($reg_d[0])>20) - { - $error = 'Логин должен содержать не более 20 символов.
    '; $_POST['step'] = 1; - } - if(strlen($reg_d[0])<2) - { - $error = 'Логин должен содержать не менее 2 символов.
    '; $_POST['step'] = 1; - } - //Один алфавит - $er = $r->en_ru($reg_d[0]); - if($er==true) - { - $error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.
    '; $_POST['step'] = 1; - } - //Запрещенный символы - if(strpos($sr,$reg_d[0])) - { - $error = 'Логин содержит запрещенные символы.
    '; $_POST['step'] = 1; - } - //Персонажи в базе - $log = mysql_fetch_array(mysql_query('SELECT `id` from `users` where `login`="'.mysql_real_escape_string($reg_d[0]).'" LIMIT 1')); - $log2 = mysql_fetch_array(mysql_query('SELECT `id` from `lastNames` where `login`="'.mysql_real_escape_string($reg_d[0]).'" LIMIT 1')); - $log3 = mysql_fetch_array(mysql_query('SELECT `id` from `test_bot` where `login`="'.mysql_real_escape_string($reg_d[0]).'" OR `login` LIKE "'.mysql_real_escape_string($reg_d[0]).' [%]" LIMIT 1')); - - if(isset($log['id']) || isset($log2['id']) || isset($log3['id'])) - { - $error = 'Логин '.$reg_d[0].' уже занят, выберите другой.
    '; $_POST['step'] = 1; - } - //Разделители - if(substr_count($reg_d[0],' ')+substr_count($reg_d[0],'-')+substr_count($reg_d[0],'_')>2) - { - $error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).
    '; $_POST['step'] = 1; - } - $reg_d[0] = trim($reg_d[0],' '); - - //проверяем пароль - if(strlen($reg_d[1])<6 || strlen($reg_d[1])>30) - { - $error = 'Длина пароля не может быть меньше 6 символов или более 30 символов.
    '; $_POST['step'] = 2; - } - if($reg_d[1]!=$reg_d[2]) - { - $error = 'В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее.
    '; $_POST['step'] = 2; - } - if(preg_match('/'.$reg_d[0].'/i',$reg_d[1])) - { - $error = 'Пароль содержит элементы логина.
    '; $_POST['step'] = 2; - } - if( $reg_d[1] != $reg_d[2] ) { - $error = 'Пароли не совпадают.
    '; $_POST['step'] = 2; - } - if($_POST['step']!=2) - { - $stp = 3; $noup = 0; - } - //проверяем e-mail - if(strlen($reg_d[3])<6 || strlen($reg_d[3])>50) - { - $error = 'E-mail не может быть короче 6-х символов и длинее 50-ти.
    '; $_POST['step'] = 3; - } - - if(!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3])) - { - $error = 'Вы указали явно ошибочный E-mail.
    '; $_POST['step'] = 3; - } - - if( $_POST['mail_post'] != 'true' ) { - $error = 'Дайте разрешение на возможность рассылки информации на ваш E-mail'; - } - - $reg_d[4] = $chat->str_count($reg_d[4],30); - $reg_d[5] = $chat->str_count($reg_d[5],30); - - if($_POST['step']!=3) - { - $stp = 4; $noup = 0; - } - - $reg_d[6] = $chat->str_count($reg_d[6],90); - $reg_d[7] = round($reg_d[7]); - $reg_d[8] = round($reg_d[8]); - $reg_d[9] = round($reg_d[9]); - - if($reg_d[7]<1 || $reg_d[7]>31 || $reg_d[8]<1 || $reg_d[8]>12 || $reg_d[9]<1920 || $reg_d[9]>2006) - { - $error = 'Ошибка в написании дня рождения.
    '; $_POST['step'] = 4; - } - - if($reg_d[15]!=1 && $reg_d[15]!=2) - { - $error = 'Вы указали не верный пол.
    '; $_POST['step'] = 4; - } - - if( $error == '' ) { - if( $reg_d[15] != 2 ) { - $reg_d[15] = 0; - }else{ - $reg_d[15] = 1; - } - setcookie('login',$reg_d[0],time()+60*60*24*7,'',$c['host']); - setcookie('pass',md5($reg_d[1]),time()+60*60*24*7,'',$c['host']); - mysql_query('UPDATE `users` SET - `login` = "'.mysql_real_escape_string($reg_d[0]).'", +if (isset($_POST['ajax_reg'])) { + $u = User::start(); + if (isset($u->info['id']) && $u->info['bithday'] == '01.01.1800') { + // + $_POST['reg_login'] = iconv('UTF-8', 'windows-1251', $_POST['reg_login']); + // + $reg_d = [0 => $_POST['reg_login'], 1 => $_POST['reg_pass'], 2 => $_POST['reg_pass2'], 3 => $_POST['reg_mail'], 7 => $_POST['reg_dd'], 8 => $_POST['reg_mm'], 9 => $_POST['reg_yy'], 15 => $_POST['reg_sex']]; + // + $error = ''; + // + //Запрещенные логины + $nologin = [0 => 'ангел', 1 => 'angel', 2 => 'администрация', 3 => 'administration', 4 => 'Комментатор', 5 => 'Мироздатель', 6 => 'Мусорщик', 7 => 'Падальщик', 8 => 'Повелитель', 9 => 'Архивариус', 10 => 'Пересмешник', 11 => 'Волынщик', 12 => 'Лорд Разрушитель', 13 => 'Милосердие', 14 => 'Справедливость', 15 => 'Искушение', 16 => 'Вознесение', 17 => 'coombats', 18 => 'коомбатс ру', 19 => 'Коомбатс _ру']; + $blacklist = "!@#$%^&*()\+Ёё|/'`\""; + $sr = '_-йцукенгшщзхъфывапролджэячсмитьбюё1234567890'; + $i = 0; + while ($i < count($nologin)) { + if (preg_match("/" . $nologin[$i] . "/i", $filter->mystr($reg_d[0]))) { + $error = 'Выберите, пожалуйста, другой ник.
    '; + $_POST['step'] = 1; + $i = count($nologin); + } + $i++; + } + $reg_d[0] = str_replace(' ', ' ', $reg_d[0]); + //Логин от 2 до 20 символов + if (strlen($reg_d[0]) > 20) { + $error = 'Логин должен содержать не более 20 символов.
    '; + $_POST['step'] = 1; + } + if (strlen($reg_d[0]) < 2) { + $error = 'Логин должен содержать не менее 2 символов.
    '; + $_POST['step'] = 1; + } + //Один алфавит + $er = $r->en_ru($reg_d[0]); + if ($er) { + $error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.
    '; + $_POST['step'] = 1; + } + //Запрещенный символы + if (strpos($sr, $reg_d[0])) { + $error = 'Логин содержит запрещенные символы.
    '; + $_POST['step'] = 1; + } + //Персонажи в базе + $log = mysql_fetch_array( + mysql_query('SELECT `id` from `users` where `login`="' . mysql_real_escape_string($reg_d[0]) . '" LIMIT 1') + ); + $log2 = mysql_fetch_array( + mysql_query( + 'SELECT `id` from `lastNames` where `login`="' . mysql_real_escape_string($reg_d[0]) . '" LIMIT 1' + ) + ); + $log3 = mysql_fetch_array( + mysql_query( + 'SELECT `id` from `test_bot` where `login`="' . mysql_real_escape_string( + $reg_d[0] + ) . '" OR `login` LIKE "' . mysql_real_escape_string($reg_d[0]) . ' [%]" LIMIT 1' + ) + ); + + if (isset($log['id']) || isset($log2['id']) || isset($log3['id'])) { + $error = 'Логин ' . $reg_d[0] . ' уже занят, выберите другой.
    '; + $_POST['step'] = 1; + } + //Разделители + if (substr_count($reg_d[0], ' ') + substr_count($reg_d[0], '-') + substr_count($reg_d[0], '_') > 2) { + $error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).
    '; + $_POST['step'] = 1; + } + $reg_d[0] = trim($reg_d[0], ' '); + + //проверяем пароль + if (strlen($reg_d[1]) < 6 || strlen($reg_d[1]) > 30) { + $error = 'Длина пароля не может быть меньше 6 символов или более 30 символов.
    '; + $_POST['step'] = 2; + } + if ($reg_d[1] != $reg_d[2]) { + $error = 'В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее.
    '; + $_POST['step'] = 2; + } + if (preg_match('/' . $reg_d[0] . '/i', $reg_d[1])) { + $error = 'Пароль содержит элементы логина.
    '; + $_POST['step'] = 2; + } + if ($reg_d[1] != $reg_d[2]) { + $error = 'Пароли не совпадают.
    '; + $_POST['step'] = 2; + } + if ($_POST['step'] != 2) { + $stp = 3; + $noup = 0; + } + //проверяем e-mail + if (strlen($reg_d[3]) < 6 || strlen($reg_d[3]) > 50) { + $error = 'E-mail не может быть короче 6-х символов и длинее 50-ти.
    '; + $_POST['step'] = 3; + } + + if (!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3])) { + $error = 'Вы указали явно ошибочный E-mail.
    '; + $_POST['step'] = 3; + } + + if ($_POST['mail_post'] != 'true') { + $error = 'Дайте разрешение на возможность рассылки информации на ваш E-mail'; + } + + $reg_d[4] = $chat->str_count($reg_d[4], 30); + $reg_d[5] = $chat->str_count($reg_d[5], 30); + + if ($_POST['step'] != 3) { + $stp = 4; + $noup = 0; + } + + $reg_d[6] = $chat->str_count($reg_d[6], 90); + $reg_d[7] = round($reg_d[7]); + $reg_d[8] = round($reg_d[8]); + $reg_d[9] = round($reg_d[9]); + + if ($reg_d[7] < 1 || $reg_d[7] > 31 || $reg_d[8] < 1 || $reg_d[8] > 12 || $reg_d[9] < 1920 || $reg_d[9] > 2006) { + $error = 'Ошибка в написании дня рождения.
    '; + $_POST['step'] = 4; + } + + if ($reg_d[15] != 1 && $reg_d[15] != 2) { + $error = 'Вы указали не верный пол.
    '; + $_POST['step'] = 4; + } + + if ($error == '') { + if ($reg_d[15] != 2) { + $reg_d[15] = 0; + } else { + $reg_d[15] = 1; + } + setcookie('login', $reg_d[0], time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('pass', md5($reg_d[1]), time() + 60 * 60 * 24 * 7, '', $c['host']); + mysql_query( + 'UPDATE `users` SET + `login` = "' . mysql_real_escape_string($reg_d[0]) . '", `activ` = "1", - `pass` = "'.mysql_real_escape_string(md5($reg_d[1])).'", - `mail` = "'.mysql_real_escape_string($reg_d[3]).'", - `bithday` = "'.mysql_real_escape_string($reg_d[7].'.'.$reg_d[8].'.'.$reg_d[9]).'", - `sex` = "'.mysql_real_escape_string($reg_d[15]).'", + `pass` = "' . mysql_real_escape_string(md5($reg_d[1])) . '", + `mail` = "' . mysql_real_escape_string($reg_d[3]) . '", + `bithday` = "' . mysql_real_escape_string($reg_d[7] . '.' . $reg_d[8] . '.' . $reg_d[9]) . '", + `sex` = "' . mysql_real_escape_string($reg_d[15]) . '", `fnq` = "0" - WHERE `id` = "'.mysql_real_escape_string($u->info['id']).'" LIMIT 1'); - - if( $u->info['host_reg'] > 0 ) { - $refer = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "'.$u->info['host_reg'].'" LIMIT 1')); - if( isset($refer['id']) ) { - $u->addItem(3199,$u->info['id']); - $u->addItem(4005,$refer['id']); - }else{ - $u->addItem(3199,$u->info['id']); - $nast = 1001398; - mysql_query('UPDATE `users` SET - `host_reg` = "'.$nast.'" - WHERE `id` = "'.mysql_real_escape_string($u->info['id']).'" LIMIT 1'); - } - }else{ - $u->addItem(3199,$u->info['id']); - $nast = 1001398; - mysql_query('UPDATE `users` SET - `host_reg` = "'.$nast.'" - WHERE `id` = "'.mysql_real_escape_string($u->info['id']).'" LIMIT 1'); - } - - //Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат - - $text = ''.$reg_d[0].', если у Вас возникли затруднения с выполнением квеста, перейдите по следующей ссылке - www.new-combats.com/library/noobguide '; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','6','0','1')"); - /* $text = 'Для начала посмотри в свой инвентарь. Было решено избавить тебя от скучных, однотипных боёв с бездушным клоном. Советуем заглянуть в Инвентарь далее>> раздел Свитки, Использовать "СВИТОК ОБУЧЕНИЯ", который даст тебе +300 000 опыта, 8ой уровень, и позволит сразу же приступить к выбору класса и боям с равными тебе соперниками. Более того, для более лёгкого старта, мы организовали тебе презент, в виде: Статовых Эликсиров +15, Звёздных свитков, и Свитка Барыги -Таба- , который позволит продать вещи в ГОС магазин за 99% их стоимости, в случае если ты решишь сменить комплект! Будь акуратен, такая возможность даётся всего единожды. Из особенностей нашего проекта, хотелось бы отметить: Наличие уникальных ботов на Центральной Площади (подробнее events.new-combats.com ). По всем игровым вопросам, вы можете всегда обратиться сотруникам Ордена Света'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','".$reg_d[0]."','".$text."','".time()."','6','0','1')"); - */ - - $refer = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned`,`admin`,`level` FROM `users` WHERE `id` = "'.mysql_real_escape_string($_GET['ref']).'" LIMIT 1')); - if(isset($refer['id'])) { - mysql_query("INSERT INTO `items_users` (`gift`,`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('".$refer['login']."','".$u->info['id']."','3199','noodet=1|items_in_file=sunduk_new|var_id=1|open=1|noremont=1|nodelete=1|nosale=1|sudba=".mysql_real_escape_string($reg_d[0])."',1,2,'capitalcity',".time().")"); - } - - //Рубаха - $re = $u->addItem(1,$u->info['id'],'|'); - if( $re > 0 ) { - mysql_query('UPDATE `items_users` SET `gift` = "Мироздатель" WHERE `id` = "'.$re.'" LIMIT 1'); - } - //Штаны - $re = $u->addItem(73,$u->info['id'],'|'); - if( $re > 0 ) { - mysql_query('UPDATE `items_users` SET `gift` = "Мусорщик" WHERE `id` = "'.$re.'" LIMIT 1'); - } - $re = $u->addItem(2133,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1|srok='.(86400*14).''); - if( $re > 0 ) { - mysql_query('UPDATE `items_users` SET `gift` = "Архивариус" WHERE `id` = "'.$re.'" LIMIT 1'); - } - //Свиток +300.000 опыта - /*$re = $u->addItem(4014,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1|nodelete=1'); - if( $re > 0 ) { - mysql_query('UPDATE `items_users` SET `gift` = "Архивариус" WHERE `id` = "'.$re.'" LIMIT 1'); - } - //Свиток Таба - //$re = $u->addItem(1190,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,0); - //Зелье Жизни - $re = $u->addItem(724,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,50); - //Звезд сияние - $re = $u->addItem(1463,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Звезд тяжесть - $re = $u->addItem(1462,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Звезд Энергия - $re = $u->addItem(1461,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Нектар Предчувствия - $re = $u->addItem(4038,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Нектар Великана - $re = $u->addItem(4039,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Звезд Предчувствия - $re = $u->addItem(4037,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - //Звезд Змеи - $re = $u->addItem(4040,$u->info['id'],'|sudba='.$reg_d[0].'|nosale=1',NULL,1); - */ - //Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат - - $error = 'Регистрация прошла успешно! Спасибо!
    Через 3 сек. Вы будете перенаправлены в игру!'; - } - - die( $error ); - } -}else{ + WHERE `id` = "' . mysql_real_escape_string($u->info['id']) . '" LIMIT 1' + ); - function GetRealIp() - { - if (!empty($_SERVER['HTTP_CLIENT_IP'])) - { - $ip=$_SERVER['HTTP_CLIENT_IP']; - } - elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - { - $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; - } - else - { - $ip=$_SERVER['REMOTE_ADDR']; - } - return $ip; - } - - define('IP',GetRealIp()); - - function error($e) - { - global $c; - die(''); - } - - if( isset($_COOKIE['login']) ) { - setcookie('login','',time()-60*60*24*30,'','.new-combats.com/'); - setcookie('pass','',time()-60*60*24*30,'','.new-combats.com/'); - // - setcookie('login','',time()-60*60*24*30); - setcookie('pass','',time()-60*60*24*30); - // - } - - $lr = mysql_fetch_array(mysql_query('SELECT `id`,`ipreg`,`pass`,`bithday`,`login` FROM `users` WHERE `cityreg`="capitalcity" AND `timereg`>"'.(time()-60*60*1).'" AND `ipreg` = "'.mysql_real_escape_string(IP).'" LIMIT 1')); - if(/*isset($_COOKIE['reg_capitalcity']) || (int)$_COOKIE['reg_capitalcity']>time() ||*/ isset($lr['id2'])) { - if( isset($lr['id']) && $lr['bithday'] == '01.01.1800' ) { - if( isset($_GET['enter']) ) { - setcookie('login',$lr['login'],time()+60*60*24*7,'',$c['host']); - setcookie('pass',$lr['pass'],time()+60*60*24*7,'',$c['host']); - header('location: /bk'); - } - error('Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.
    Для авторизации '.$lr['login'].' перейдите по ссылке: Авторизироваться'); - }else{ - error('Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.
    '); - } - }else{ - //Создаем персонажа - if( (int)$_GET['ref'] > 0 ) { - mysql_query("UPDATE `users` SET `referals` = `referals` + 1 WHERE `id` = '".mysql_real_escape_string((int)$_GET['ref'])."' LIMIT 1"); - } - $pass = md5(md5(rand(0,100.).'#'.rand(0,1000))); - mysql_query('INSERT INTO `users` (`host_reg`,`pass`,`ip`,`ipreg`,`city`,`cityreg`,`room`,`timereg`) VALUES ( - "'.mysql_real_escape_string(0+$_GET['ref']).'", - "'.mysql_real_escape_string($pass).'", - "'.mysql_real_escape_string(IP).'", - "'.mysql_real_escape_string(IP).'", + if ($u->info['host_reg'] > 0) { + $refer = mysql_fetch_array( + mysql_query('SELECT `id` FROM `users` WHERE `id` = "' . $u->info['host_reg'] . '" LIMIT 1') + ); + if (isset($refer['id'])) { + $u->addItem(3199, $u->info['id']); + $u->addItem(4005, $refer['id']); + } else { + $u->addItem(3199, $u->info['id']); + $nast = 1001398; + mysql_query( + 'UPDATE `users` SET + `host_reg` = "' . $nast . '" + WHERE `id` = "' . mysql_real_escape_string($u->info['id']) . '" LIMIT 1' + ); + } + } else { + $u->addItem(3199, $u->info['id']); + $nast = 1001398; + mysql_query( + 'UPDATE `users` SET + `host_reg` = "' . $nast . '" + WHERE `id` = "' . mysql_real_escape_string($u->info['id']) . '" LIMIT 1' + ); + } + + //Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат//Выдаем предметы и отправляем сообщение в чат + + $text = '' . $reg_d[0] . ', если у Вас возникли затруднения с выполнением квеста, перейдите по следующей ссылке - www.new-combats.com/library/noobguide '; + mysql_query( + "INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','" . $reg_d[0] . "','" . $text . "','" . time( + ) . "','6','0','1')" + ); + $refer = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`banned`,`admin`,`level` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $_GET['ref'] + ) . '" LIMIT 1' + ) + ); + if (isset($refer['id'])) { + mysql_query( + "INSERT INTO `items_users` (`gift`,`uid`,`item_id`,`data`,`iznosMAX`,`geniration`,`maidin`,`time_create`) VALUES ('" . $refer['login'] . "','" . $u->info['id'] . "','3199','noodet=1|items_in_file=sunduk_new|var_id=1|open=1|noremont=1|nodelete=1|nosale=1|sudba=" . mysql_real_escape_string( + $reg_d[0] + ) . "',1,2,'capitalcity'," . time() . ")" + ); + } + + //Рубаха + $re = $u->addItem(1, $u->info['id'], '|'); + if ($re > 0) { + mysql_query('UPDATE `items_users` SET `gift` = "Мироздатель" WHERE `id` = "' . $re . '" LIMIT 1'); + } + //Штаны + $re = $u->addItem(73, $u->info['id'], '|'); + if ($re > 0) { + mysql_query('UPDATE `items_users` SET `gift` = "Мусорщик" WHERE `id` = "' . $re . '" LIMIT 1'); + } + $re = $u->addItem(2133, $u->info['id'], '|sudba=' . $reg_d[0] . '|nosale=1|srok=' . (86400 * 14) . ''); + if ($re > 0) { + mysql_query('UPDATE `items_users` SET `gift` = "Архивариус" WHERE `id` = "' . $re . '" LIMIT 1'); + } + $error = 'Регистрация прошла успешно! Спасибо!
    Через 3 сек. Вы будете перенаправлены в игру!'; + } + + die($error); + } +} else { + + function error($e) + { + exit($e); + } + + if (isset($_COOKIE['login'])) { + setcookie('login', '', time() - 60 * 60 * 24 * 30, '', '.new-combats.com/'); + setcookie('pass', '', time() - 60 * 60 * 24 * 30, '', '.new-combats.com/'); + // + setcookie('login', '', time() - 60 * 60 * 24 * 30); + setcookie('pass', '', time() - 60 * 60 * 24 * 30); + // + } + + $lr = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`ipreg`,`pass`,`bithday`,`login` FROM `users` WHERE `cityreg`="capitalcity" AND `timereg`>"' . (time( + ) - 60 * 60 * 1) . '" AND `ipreg` = "' . mysql_real_escape_string(IP) . '" LIMIT 1' + ) + ); + if (isset($lr['id2'])) { + if (isset($lr['id']) && $lr['bithday'] == '01.01.1800') { + if (isset($_GET['enter'])) { + setcookie('login', $lr['login'], time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('pass', $lr['pass'], time() + 60 * 60 * 24 * 7, '', $c['host']); + header('location: /bk'); + } + error( + 'Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.
    Для авторизации ' . $lr['login'] . ' перейдите по ссылке: Авторизироваться' + ); + } else { + error( + 'Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.
    ' + ); + } + } else { + //Создаем персонажа + if ((int)$_GET['ref'] > 0) { + mysql_query( + "UPDATE `users` SET `referals` = `referals` + 1 WHERE `id` = '" . mysql_real_escape_string( + (int)$_GET['ref'] + ) . "' LIMIT 1" + ); + } + $pass = md5(md5(rand(0, 100.) . '#' . rand(0, 1000))); + mysql_query( + 'INSERT INTO `users` (`host_reg`,`pass`,`ip`,`ipreg`,`city`,`cityreg`,`room`,`timereg`) VALUES ( + "' . mysql_real_escape_string(0 + $_GET['ref']) . '", + "' . mysql_real_escape_string($pass) . '", + "' . mysql_real_escape_string(IP) . '", + "' . mysql_real_escape_string(IP) . '", "capitalcity", "capitalcity", "0", - "'.time().'" - )'); - $uid = mysql_insert_id(); - if( $uid > 0 ) { - $login = 'Новичок'.$uid; - mysql_query('UPDATE `users` SET `login` = "'.mysql_real_escape_string($login).'" WHERE `id` = "'.$uid.'" LIMIT 1'); - //Создаем статы персонажа - mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('".$uid."','".time()."')"); - mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('".$uid."','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')"); - - //мульты - $ipm1 = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "'.mysql_real_escape_string($uid).'" AND `ip`!="'.mysql_real_escape_string(IP).'" ORDER BY `id` ASC LIMIT 1')); - $ppl = mysql_query('SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "'.mysql_real_escape_string(IP).'" OR `ip`="'.mysql_real_escape_string($ipm1['ip']).'" OR `ip`="'.mysql_real_escape_string($_COOKIE['ip']).'")'); - while($spl = mysql_fetch_array($ppl)) - { - $ml = mysql_fetch_array(mysql_query('SELECT `id` FROM `mults` WHERE (`uid` = "'.$spl['uid'].'" AND `uid2` = "'.$uid.'") OR (`uid2` = "'.$spl['uid'].'" AND `uid` = "'.$uid.'") LIMIT 1')); - if(!isset($ml['id']) && $spl['ip']!='' && $spl['ip']!='127.0.0.1') - { - mysql_query('INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("'.$uid.'","'.$spl['uid'].'","'.$spl['ip'].'")'); - } - } - mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('".$uid."','".mysql_real_escape_string(IP)."','".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."','1','".time()."','')"); - - //Обновяем таблицы - mysql_query("UPDATE `users` SET `online`='".time()."',`ip` = '".mysql_real_escape_string(IP)."' WHERE `uid` = '".$uid."' LIMIT 1"); - - if(!setcookie('login',$login, (time()+60*60*24*7) , '' , '.new-combats.com' ) || !setcookie('pass',$pass, (time()+60*60*24*7) , '' , '.new-combats.com' )) { - die('Ошибка сохранения cookie.'); - }else{ - /* - die('Спасибо за регистрацию!
    '); - */ - } - header('location: /bk'); - } - } -} + "' . time() . '" + )' + ); + $uid = mysql_insert_id(); + if ($uid > 0) { + $login = 'Новичок' . $uid; + mysql_query( + 'UPDATE `users` SET `login` = "' . mysql_real_escape_string( + $login + ) . '" WHERE `id` = "' . $uid . '" LIMIT 1' + ); + //Создаем статы персонажа + mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')"); + mysql_query( + "INSERT INTO `stats` (`id`,`stats`) VALUES ('" . $uid . "','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')" + ); -?> \ No newline at end of file + //мульты + $ipm1 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `logs_auth` WHERE `uid` = "' . mysql_real_escape_string( + $uid + ) . '" AND `ip`!="' . mysql_real_escape_string(IP) . '" ORDER BY `id` ASC LIMIT 1' + ) + ); + $ppl = mysql_query( + 'SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "' . mysql_real_escape_string( + IP + ) . '" OR `ip`="' . mysql_real_escape_string($ipm1['ip']) . '" OR `ip`="' . mysql_real_escape_string( + $_COOKIE['ip'] + ) . '")' + ); + while ($spl = mysql_fetch_array($ppl)) { + $ml = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `mults` WHERE (`uid` = "' . $spl['uid'] . '" AND `uid2` = "' . $uid . '") OR (`uid2` = "' . $spl['uid'] . '" AND `uid` = "' . $uid . '") LIMIT 1' + ) + ); + if (!isset($ml['id']) && $spl['ip'] != '' && $spl['ip'] != '127.0.0.1') { + mysql_query( + 'INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("' . $uid . '","' . $spl['uid'] . '","' . $spl['ip'] . '")' + ); + } + } + mysql_query( + "INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $uid . "','" . mysql_real_escape_string( + IP + ) . "','" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','1','" . time() . "','')" + ); + + //Обновяем таблицы + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`ip` = '" . mysql_real_escape_string( + IP + ) . "' WHERE `uid` = '" . $uid . "' LIMIT 1" + ); + + if (!setcookie('login', $login, (time() + 60 * 60 * 24 * 7), '', '.new-combats.com') || !setcookie( + 'pass', $pass, (time() + 60 * 60 * 24 * 7), '', '.new-combats.com' + )) { + die('Ошибка сохранения cookie.'); + } + header('location: /bk'); + } + } +} diff --git a/register.php b/register.php index 415ccf2f..eb4c70d1 100644 --- a/register.php +++ b/register.php @@ -1,9 +1,9 @@ - 'ангел', 1 => 'angel', 2 => 'администрация', 3 => 'administration', 4 => 'Комментатор', 5 => 'Мироздатель', 6 => 'Мусорщик', 7 => 'Падальщик', 8 => 'Повелитель', 9 => 'Архивариус', 10 => 'Пересмешник', 11 => 'Волынщик', 12 => 'Лорд Разрушитель', 13 => 'Милосердие', 14 => 'Справедливость', 15 => 'Рскушение', 16 => 'Вознесение']; + $nologin = [0 => 'ангел', 1 => 'angel', 2 => 'администрация', 3 => 'administration', 4 => 'Комментатор', 5 => 'Мироздатель', 6 => 'Мусорщик', 7 => 'Падальщик', 8 => 'Повелитель', 9 => 'Архивариус', 10 => 'Пересмешник', 11 => 'Волынщик', 12 => 'Лорд Разрушитель', 13 => 'Милосердие', 14 => 'Справедливость', 15 => 'Искушение', 16 => 'Вознесение']; $i = 0; while ($i < count($nologin)) { if (preg_match("/" . $nologin[$i] . "/i", $str_u)) { - $error = 'Выберите, пожалуйста, РґСЂСѓРіРѕР№ РЅРёРє.'; + $error = 'Выберите, пожалуйста, другой ник.'; $i = count($nologin); } $i++; } $str_u = str_replace(' ', ' ', $str_u); - //Логин РѕС‚ 4 РґРѕ 20 символов + //Логин от 4 до 20 символов if (strlen($str_u) > 20) { - $error = 'Логин должен содержать РЅРµ более 20 символов.'; - $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolСЏ)=-/.'; + $error = 'Логин должен содержать не более 20 символов.'; + $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolя)=-/.'; } if (strlen($str_u) < 4) { - $error = 'Логин должен содержать РЅРµ менее 4 символов.'; - $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolСЏ)=-/.'; + $error = 'Логин должен содержать не менее 4 символов.'; + $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolя)=-/.'; } - //РћРґРёРЅ алфавит + //Один алфавит $er = en_ru($str_u); if ($er) { - $error = 'Р’ логине разрешено использовать только Р±СѓРєРІС‹ РѕРґРЅРѕРіРѕ алфавита СЂСѓСЃСЃРєРѕРіРѕ или английского. Нельзя смешивать.'; - $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolСЏ)=-/.'; + $error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.'; + $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolя)=-/.'; } - //Разделители + //Разделители if (substr_count($str_u, ' ') + substr_count($str_u, '-') + substr_count($str_u, '_') > 2) { - $error = 'РќРµ более РґРІСѓС… разделителей одновременно (пробел, тире, нижнее подчеркивание).'; - $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolСЏ)=-/.'; + $error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).'; + $error = $error . '
    Пример правильного никнейма: Петя Убиватор, Коля, xalop.
    Пример неправильного никнейма: )))), kolя)=-/.'; } - //Персонажи РІ базе + //Персонажи в базе $q = mysql_query('SELECT `id` from `users` where `login`="' . mysql_real_escape_string($str_u) . '" LIMIT 1'); if ($q) { $log = mysql_fetch_array($q); unset($q); } - $q = mysql_query('SELECT `id` from `lastnames` where `login`="' . mysql_real_escape_string($str_u) . '" LIMIT 1'); + $q = mysql_query( + 'SELECT `id` from `lastnames` where `login`="' . mysql_real_escape_string($str_u) . '" LIMIT 1' + ); if ($q) { $log2 = mysql_fetch_array($q); unset($q); } if (isset($log['id']) || isset($log2['id'])) { - $error = 'Логин ' . $str_u . ' уже занят, выберите РґСЂСѓРіРѕР№.'; + $error = 'Логин ' . $str_u . ' уже занят, выберите другой.'; } } - if ($id == 2 && !empty($str_u)) //проверка емаила + if ($id == 2 && !empty($str_u)) //проверка емаила { if (strlen($str_u) < 6 || strlen($str_u) > 50) { - $error = 'E-mail РЅРµ может быть короче 6-С… символов Рё длинее 50-ти.'; + $error = 'E-mail не может быть короче 6-х символов и длинее 50-ти.'; } else { - $testEREm = mysql_fetch_array(mysql_query('SELECT `mail` FROM `users` WHERE `mail` LIKE "' . $str_u . '" LIMIT 1')); - $emails = mysql_fetch_array(mysql_query('SELECT * FROM `ban_email` WHERE `email` LIKE "' . $str_u . '" LIMIT 1')); + $testEREm = mysql_fetch_array( + mysql_query('SELECT `mail` FROM `users` WHERE `mail` LIKE "' . $str_u . '" LIMIT 1') + ); + $emails = mysql_fetch_array( + mysql_query('SELECT * FROM `ban_email` WHERE `email` LIKE "' . $str_u . '" LIMIT 1') + ); if (isset($testEREm['mail'])) { - $error = 'E-mail уже занят.'; + $error = 'E-mail уже занят.'; } if (isset($emails['email'])) { - $error = 'E-mail заблокирован свяжитесь СЃ Администрацией.'; + $error = 'E-mail заблокирован свяжитесь с Администрацией.'; } $x = 1; $i = 1; - $tx = '
    Возможно использовать только сервисы почты:
    '; + $tx = '
    Возможно использовать только сервисы почты:
    '; $sp = mysql_query('SELECT * FROM `trust_email`'); while ($pl = mysql_fetch_array($sp)) { $emailtest = $pl['email']; @@ -142,12 +153,12 @@ function error_check($id, $str_u, $name = 0) $x++; } if ($i == $x) { - $error = 'Данный почтовый сервис использовать нельзя.' . $tx; + $error = 'Данный почтовый сервис использовать нельзя.' . $tx; } } if (!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $str_u)) { - $error = 'Р’С‹ указали СЏРІРЅРѕ ошибочный E-mail.
    '; + $error = 'Вы указали явно ошибочный E-mail.
    '; } if ($error != '') { $gd[4] = $error; @@ -157,40 +168,45 @@ function error_check($id, $str_u, $name = 0) } } - if ($id == 3 && !empty($str_u) && !empty($name)) //отсылка емаила РїСЂРё удачном емаиле str_u -> mail name -> nickname + if ($id == 3 && !empty($str_u) && !empty($name)) //отсылка емаила при удачном емаиле str_u -> mail name -> nickname { $code = rand(10000000, 99999999); - mysql_query('INSERT INTO `secure_code`(`email`, `code`, `time`) VALUES ("' . $str_u . '","' . $code . '","' . time() . '");'); - mails($str_u, 'Секретный РљРѕРґ: ' . $code, 'Секретный РљРѕРґ - Новый Бойцовский Клуб ' . $name); + mysql_query( + 'INSERT INTO `secure_code`(`email`, `code`, `time`) VALUES ("' . $str_u . '","' . $code . '","' . time( + ) . '");' + ); + mails($str_u, 'Секретный Код: ' . $code, 'Секретный Код - Новый Бойцовский Клуб ' . $name); } - if ($id == 4 && !empty($str_u) && !empty($name)) //проверка РєРѕРґР° безопасности str_u -> введенный РєРѕРґ name -> email + if ($id == 4 && !empty($str_u) && !empty($name)) //проверка кода безопасности str_u -> введенный код name -> email { - $testcode = mysql_fetch_array(mysql_query('SELECT code FROM `secure_code` WHERE `email` = "' . $name . '" ORDER BY id DESC LIMIT 1')); + $testcode = mysql_fetch_array( + mysql_query('SELECT code FROM `secure_code` WHERE `email` = "' . $name . '" ORDER BY id DESC LIMIT 1') + ); if ($testcode['code'] != $str_u) { - $error = 'Неверный РєРѕРґ безопасности (Проверте пробелы Рё сам РєРѕРґ РІ последнем емеиле)'; + $error = 'Неверный код безопасности (Проверте пробелы и сам код в последнем емеиле)'; } } - if ($id == 5 && !empty($str_u) && !empty($name)) //проверка пароля str_u -> p1 РєРѕРґ name -> p2 + if ($id == 5 && !empty($str_u) && !empty($name)) //проверка пароля str_u -> p1 код name -> p2 { if (strlen($str_u) < 8 || strlen($str_u) > 30) { - $error = 'Длина пароля РЅРµ может быть меньше 8 символов или более 30 символов.'; - $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; + $error = 'Длина пароля не может быть меньше 8 символов или более 30 символов.'; + $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; } if ($str_u != $name) { - $error = 'Р’ анкете пароль нужно ввести дважды, для проверки. Р’Рѕ второй раз РІС‹ его ввели неверно, будьте внимательнее.'; - $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; + $error = 'В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее.'; + $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; } - if (!preg_match('/[a-zР°-СЏ]+/', $str_u)) { - $error = 'Пароль РЅРµ содержит Р±СѓРєРІ нижнего регитра Р°..СЏ/a..z.'; - $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; - } elseif (!preg_match('/[A-ZА-Я]+/', $str_u)) { - $error = 'Пароль не содержит букв верхнего регитра А..Я/A..Z .'; - $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; + if (!preg_match('/[a-zа-я]+/', $str_u)) { + $error = 'Пароль не содержит букв нижнего регитра а..я/a..z.'; + $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; + } elseif (!preg_match('/[A-ZА-Я]+/', $str_u)) { + $error = 'Пароль не содержит букв верхнего регитра А..Я/A..Z .'; + $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; } else { if (!preg_match('/[0-9]+/', $str_u)) { - $error = 'Пароль РЅРµ содержит цифр.'; - $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; + $error = 'Пароль не содержит цифр.'; + $error = $error . '
    Пример правильного пароля: Parol228, Kotik111, Pswerd112.
    Пример неправильного пароля: parol228, kotik.'; } } } @@ -200,32 +216,30 @@ function error_check($id, $str_u, $name = 0) return $error ? '

    ' . $error . '

    ' : ''; } -if ($_SERVER['HTTP_USER_AGENT'] != '' && - $_SERVER['HTTP_USER_AGENT'] != 'Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0' && - $_SERVER['HTTP_USER_AGENT'] != 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0' && - $_SERVER['HTTP_USER_AGENT'] != 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0' +if ($_SERVER['HTTP_USER_AGENT'] == '' || $_SERVER['HTTP_USER_AGENT'] == 'Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0' || $_SERVER['HTTP_USER_AGENT'] == 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0' || $_SERVER['HTTP_USER_AGENT'] == 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0' ) { - ?> + return; +} ?> - Регистрация - создай персонажа РІ РёРіСЂРµ Новый «Бойцовский клуб» + Регистрация - создай персонажа в игре Новый «Бойцовский клуб» + content="Пройдите простую регистрацию и станьте участником ? браузерной онлайн игры-легенды БК. Боец, мы ждем тебя в наших рядах, поэтому заводи аккаунт скорей. "/>
    - -
    -

    +

    -
    - -
    -

    -

    Введите никнейм для Вашего персонажа

    -
    - -
    -

    -

    Введите никнейм для Вашего персонажа

    -

    -
    - -
    -

    РРјСЏ вашего персонажа (login):

    -
    - - -
    -

    -

    Введите ваш действующий и настоящий "Email" адрес

    -

    -

    Внимание! Не используйте несуществующие "Email" адреса, а так же проверяйте то, какой эмеил вы вводите, - ибо перед стартом игры, вам необходимо будет подтвердить ваш эмеил адрес.

    -

    -

    Ваш "Email" Адрес не будет использоваться нигде и служит исключительно для того, чтобы вы смогли - восстановить пароль от своего персонажа, а так же для получения новостной рассылки.

    -
    - -
    -

    -

    Введите ваш действующий и настоящий "Email" адрес

    -

    -
    - -
    -

    -
    + ?>"/>

    + + +
    +

    +

    Введите никнейм для Вашего персонажа

    +
    + +
    +

    +

    Введите никнейм для Вашего персонажа

    +

    +
    + +
    +

    Имя вашего персонажа (login):

    +
    + + +
    +

    +

    Введите ваш действующий и настоящий "Email" адрес

    +

    +

    Внимание! Не используйте несуществующие "Email" адреса, а так же проверяйте то, какой эмеил вы вводите, + ибо перед стартом игры, вам необходимо будет подтвердить ваш эмеил адрес.

    +

    +

    Ваш "Email" Адрес не будет использоваться нигде и служит исключительно для того, чтобы вы смогли + восстановить пароль от своего персонажа, а так же для получения новостной рассылки.

    +
    + +
    +

    +

    Введите ваш действующий и настоящий "Email" адрес

    +

    +
    + +
    +

    +
    - + - -
    -

    -

    Войдите на "Email": и проверьте почту,
    вам пришло письмо с кодом - подтверждения, скопируйте его и вставьте сюда:

    -
    - -
    -

    -

    Войдите на "Email": и проверьте почту,
    вам пришло письмо с кодом - подтверждения, скопируйте его и вставьте сюда:

    -

    -
    - -
    -

    -
    + +
    +

    +

    Войдите на "Email": и проверьте почту,
    вам пришло письмо с кодом + подтверждения, скопируйте его и вставьте сюда:

    +
    + +
    +

    +

    Войдите на "Email": и проверьте почту,
    вам пришло письмо с кодом + подтверждения, скопируйте его и вставьте сюда:

    +

    +
    + +
    +

    +
    - + - -
    -

    -

    Придумайте пароль для Вашего персонажа

    -

    -

    Подтвердите придуманный пароль для Вашего персонажа


    -

    -

    Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и - цифры для надёжности.

    -
    - -
    -

    -

    Придумайте пароль для Вашего персонажа

    -

    -

    Подтвердите придуманный пароль для Вашего персонажа

    -

    -

    Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и - цифры для надёжности.

    -


    -
    - -
    -

    -

    -
    - + +
    +

    +

    Придумайте пароль для Вашего персонажа

    +

    +

    Подтвердите придуманный пароль для Вашего персонажа


    +

    +

    Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и + цифры для надёжности.

    +
    + +
    +

    +

    Придумайте пароль для Вашего персонажа

    +

    +

    Подтвердите придуманный пароль для Вашего персонажа

    +

    +

    Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и + цифры для надёжности.

    +


    +
    + +
    +

    +

    +
    + - -
    -

    -

    Выберите пол вашего персонажа:

    -

    -
    - -
    -

    -
    - + +
    +

    +

    Выберите пол вашего персонажа:

    +

    +
    + +
    +

    +
    + - -
    -

    Укажите дату вашего рождения:

    - -
    - -
    - -
    - + +
    +

    Укажите дату вашего рождения:

    + +
    + +
    + +
    + - -
    -

    -

    Выберите игровой класс для вашего персонажа:

    -

    -

    Внимание! Выбор игрового класса не влияет на игру в целом и нигде не фиксируется или же используется, - это необходимо для того, чтобы ваш персонаж получил нужные предметы в начале игры, а так же нужные - баффы.

    -
    -
    -

    -
    -
    -

    -

    -
    -
    -

    -
    -
    -

    -

    -
    -
    -

    -
    -
    -

    -

    -
    -
    -

    -

    -
    -
    -

    -

    -
    + +
    +

    +

    Выберите игровой класс для вашего персонажа:

    +

    +

    Внимание! Выбор игрового класса не влияет на игру в целом и нигде не фиксируется или же используется, + это необходимо для того, чтобы ваш персонаж получил нужные предметы в начале игры, а так же нужные + баффы.

    +
    +
    +

    +
    +
    +

    +

    +
    +
    +

    +
    +
    +

    +

    +
    +
    +

    +
    +
    +

    +

    +
    +
    +

    +

    +
    +
    +

    +

    -

    -

    Внимание! Выбрав класс персонажа вы автоматически соглашаетесь с правилами и законами игрового мира

    -
    - +

    Внимание! Выбрав класс персонажа вы автоматически соглашаетесь с правилами и законами игрового мира

    +
    +
    + 0) { + $ref = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login` FROM `users` WHERE `id` = "' . mysql_real_escape_string( + $_POST['ref'] + ) . '" LIMIT 1' + ) + ); + if (isset($ref['id'])) { + $_POST['ref'] = $ref['id']; + } else { + $_POST['ref'] = 0; + } + unset($ref); } - if (!empty($_POST['nick_u']) && !empty($_POST['email_u']) && !empty($_POST['secure_code']) && !empty($_POST['pol_u']) && !empty($_POST['bday_u']) && !empty($_POST['class_u']) && error_check(4, $_POST['secure_code'], $_POST['email_u']) == "") { - //================================ - session_start(); - include('_incl_data/class/__user.php'); - //Создаем персонажа + mysql_query( + 'INSERT INTO `users` (`name`,`align`,`real`,`login`,`host_reg`,`pass`,`ip`,`ipreg`,`city`,`cityreg`,`room`,`timereg`, + `activ`,`mail`,`bithday`,`sex`,`fnq`,`battle`,`design`,`molch2`,`level` + ) VALUES ( + "", + "0", + "1", + "' . mysql_real_escape_string($_POST['nick_u']) . '", + "' . mysql_real_escape_string(0 + (int)$_POST['ref']) . '", + "' . mysql_real_escape_string(md5($_POST['pass1_u'])) . '", + "' . mysql_real_escape_string(getIp()) . '", + "' . mysql_real_escape_string(getIp()) . '", + "capitalcity", + "capitalcity", + "9", + "' . time() . '", + "0", + "' . mysql_real_escape_string($_POST['email_u']) . '", + "' . mysql_real_escape_string(date('d.m.Y', strtotime($_POST['bday_u']))) . '", + "' . mysql_real_escape_string($_POST['pol_u'] - 10) . '", + "0", + "0", + "1", + "' . mysql_real_escape_string(time() + 86400) . '", + "8" + )' + ); + + $uid = mysql_insert_id(); + if ($uid > 0) { + //=================================================================== + + if (isset($_COOKIE['from'])) { + mysql_query( + 'INSERT INTO `from` (`type`,`ip`,`uid`,`time`,`val`) VALUES ( "0", "' . getIp( + ) . '","' . $uid . '", "' . time() . '", "' . mysql_real_escape_string($_COOKIE['from']) . '" ) ' + ); + } + //Сообщения при регистрации от паладинов. + $pal = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `users` WHERE `align` > 1 AND `align` < 2 AND `online` > "' . (time( + ) - 120) . '" ORDER BY `online` DESC LIMIT 1' + ) + ); + if (!isset($pal['id'])) { + $pal = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `users` WHERE `align` > 3 AND `align` < 4 AND `online` > "' . (time( + ) - 120) . '" ORDER BY `online` DESC LIMIT 1' + ) + ); + } + if (isset($pal['id'])) { + //отсылаем сообщение от $pal['login'] + $paltext = 'Приветствую ' . $_POST['nick_u'] . '. Отправляемся драться в хаоты, если нет заявок, создайте бой, дополнительно купите зверя и не забывайте выходить на центральную площать убивать Трупожора своего уровня!Приятной игры. '; + mysql_query( + "INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','" . $pal['login'] . "','" . $_POST['nick_u'] . "','" . $paltext . "','" . time( + ) . "','3','0','1')" + ); + } else { + //Не знаю что делать, пусть будет просто приветствие :) + $text = 'Приветствую ' . $_POST['nick_u'] . '. Отправляемся драться в хаоты, если нет заявок, создайте бой, дополнительно купите зверя и не забывайте выходить на центральную площать убивать Трупожора своего уровня!Приятной игры.'; + mysql_query( + "INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','" . $_POST['nick_u'] . "','" . $text . "','" . time( + ) . "','3','0','1')" + ); + } + + /** Много однотипых запросов это боль. + * + * @param array $itemset + * @param double $itemscost + * @param string $stats + * + * @return void + */ + function sql_01(array $itemset, $itemscost, $stats) + { + global $u, $uid; + array_unshift($itemset, null); + foreach ($itemset as $inodet => $itemId) { + if (empty($itemId)) { + continue; + } + mysql_query( + sprintf( + 'update items_users set + 1price = (select price_1 from items_shop where sid = 1 and item_id = %d), + inOdet = %d + where id = %d', + $itemId, $inodet, $u->addItem($itemId, $uid) + ) + ); + } + mysql_query(sprintf('update users set money = money - %f where id = %d', $itemscost, $uid)); + mysql_query( + sprintf( + 'insert into stats (id, stats, ability, skills, exp) + values (%d, %s, -75, -9, 100000)', $uid, $stats + ) + ); + } + + if ($_POST['class_u'] == 1) //топор + { + //кастим эфекты + $us = add_effn($uid, 1); // сила + $us = add_effn($uid, 20); // сокрушение + + $wear = [528, 540, 552, 291, 543, null, 627, 653, 681, 687, 687, 687, 320, 552, null, 709, 716]; + $itemcost = 2101; + $stats = 's1=62|s2=3|s3=3|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=9|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; + + } elseif ($_POST['class_u'] == 2) //уворот + { + //кастим эфекты + $us = add_effn($uid, 8); // ловка + $us = add_effn($uid, 20); // сокрушение + + $wear = [525, 539, 523, 290, 541, null, 633, 647, 680, 685, 685, 685, 1151, 523, null, 707, 712]; + $itemcost = 1972; + $stats = 's1=21|s2=31|s3=16|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=9|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0'; + + } elseif ($_POST['class_u'] == 3)//танк + { + //кастим эфекты + $us = add_effn($uid, 1); // сила + $us = add_effn($uid, 20); // сокрушение + + $wear = [533, 536, 558, 291, 545, null, 628, 654, 684, 689, 689, 689, 700, 722, null, 710, 718]; + $itemcost = 2101; + $stats = 's1=42|s2=3|s3=3|s4=50|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=9|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; + + } elseif ($_POST['class_u'] == 4)//крит + { + //кастим эфекты + $us = add_effn($uid, 7); // инта + $us = add_effn($uid, 20); // сокрушение + + $wear = [527, 537, 567, 291, 544, null, 626, 651, 683, 686, 686, 686, 706, 723, null, 708, 717]; + $itemcost = 1988; + $stats = 's1=24|s2=20|s3=24|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=9|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; + + } elseif ($_POST['class_u'] == 5)//воздух + { + //кастим эфекты + $us = add_effn($uid, 9); // интелект + $us = add_effn($uid, 32); // Холодный разум + $us = add_effn($uid, 53); // Маг уселок воздух + $us = add_effn($uid, 439); // Маг уселок + + + mysql_query( + "INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=6|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)" + ); + $re = $u->addItem(531, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(534, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(1026, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(291, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(548, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(629, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(698, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(711, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(714, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + ///------- юва + $re = $u->addItem(658, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "658" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(675, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "675" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(693, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(693, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(693, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + ///---- + mysql_query( + 'UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1' + );//коректировка денег 2244 - 1988 + } elseif ($_POST['class_u'] == 6)//огонь + { + //кастим эфекты + $us = add_effn($uid, 9); // интелект + $us = add_effn($uid, 32); // Холодный разум + $us = add_effn($uid, 51); // Маг уселок огонь + $us = add_effn($uid, 439); // Маг уселок + + mysql_query( + "INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=6|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)" + ); + $re = $u->addItem(531, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(534, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(1026, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(291, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(549, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "549" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(629, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(698, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(711, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(714, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + ///------- юва + $re = $u->addItem(655, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "655" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(679, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "679" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(696, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(696, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(696, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + ///---- + + mysql_query( + 'UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1' + );//коректировка денег 2244 - 1988 + } elseif ($_POST['class_u'] == 7)//земля + { + + + //кастим эфекты + $us = add_effn($uid, 9); // интелект + $us = add_effn($uid, 32); // Холодный разум + $us = add_effn($uid, 54); // Маг уселок земля + $us = add_effn($uid, 439); // Маг уселок + + mysql_query( + "INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=0|mg4=6|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)" + ); + $re = $u->addItem(531, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(534, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(1026, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(291, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(548, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(629, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(698, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(711, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(714, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + ///------- юва + $re = $u->addItem(657, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "657" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(674, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "674" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(692, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(692, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(692, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + ///---- + + mysql_query( + 'UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1' + );//коректировка денег 2244 - 1988 + } elseif ($_POST['class_u'] == 8)//вода + { + //кастим эфекты + $us = add_effn($uid, 9); // интелект + $us = add_effn($uid, 32); // Холодный разум + $us = add_effn($uid, 52); // Маг уселок вода + $us = add_effn($uid, 439); // Маг уселок + mysql_query( + "INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=6|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)" + ); + $re = $u->addItem(531, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(534, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(1026, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(291, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(548, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(629, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(318, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "318" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(711, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(714, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + ///------- юва + $re = $u->addItem(660, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "660" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(677, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "677" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + + $re = $u->addItem(695, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(695, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + $re = $u->addItem(695, $uid); + mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); + $price = mysql_fetch_array( + mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1') + ); + mysql_query( + 'UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1' + ); + ///---- + + mysql_query( + 'UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1' + );//коректировка денег 2244 - 1988 + } + + if (!empty($wear) && !empty($itemcost) && !empty($stats)) { + sql_01($wear, $itemcost, $stats); + unset($wear, $itemcost, $stats); + } + if ($_POST['ref'] > 0) { - $ref = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . mysql_real_escape_string($_POST['ref']) . '" LIMIT 1')); - if (isset($ref['id'])) { - $_POST['ref'] = $ref['id']; - } else { - $_POST['ref'] = 0; - } - unset($ref); + $re = $u->addItem(6417, $uid); } - mysql_query('INSERT INTO `users` (`name`,`align`,`real`,`login`,`host_reg`,`pass`,`ip`,`ipreg`,`city`,`cityreg`,`room`,`timereg`, - `activ`,`mail`,`bithday`,`sex`,`fnq`,`battle`,`design`,`molch2`,`level` - ) VALUES ( - "", - "0", - "1", - "' . mysql_real_escape_string($_POST['nick_u']) . '", - "' . mysql_real_escape_string(0 + (int)$_POST['ref']) . '", - "' . mysql_real_escape_string(md5($_POST['pass1_u'])) . '", - "' . mysql_real_escape_string(getIp()) . '", - "' . mysql_real_escape_string(getIp()) . '", - "capitalcity", - "capitalcity", - "9", - "' . time() . '", - "0", - "' . mysql_real_escape_string($_POST['email_u']) . '", - "' . mysql_real_escape_string(date('d.m.Y', strtotime($_POST['bday_u']))) . '", - "' . mysql_real_escape_string($_POST['pol_u'] - 10) . '", - "0", - "0", - "1", - "' . mysql_real_escape_string(time() + 86400) . '", - "8" - )'); - $uid = mysql_insert_id(); - if ($uid > 0) { - //=================================================================== + //катим эфекты + // + // + $us = add_effn($uid, 37); + $us = add_effn($uid, 38); + $us = add_effn($uid, 283); + $us = add_effn($uid, 25); + $us = add_effn($uid, 296); + $us = add_effn($uid, 472); - if (isset($_COOKIE['from'])) { - mysql_query('INSERT INTO `from` (`type`,`ip`,`uid`,`time`,`val`) VALUES ( "0", "' . getIp() . '","' . $uid . '", "' . time() . '", "' . mysql_real_escape_string($_COOKIE['from']) . '" ) '); + //Магическое усиление + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4942, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'oneType=72|onlyOne=1|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '439', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Защита от оружия + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (1001, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|oneType=7|noremont=1|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '25', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Защита от магии + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4941, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'oneType=71|onlyOne=1|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '438', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Жажда жизни +6 + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (3101, 50, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|noremont=1|oneType=33|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 2, '296', 'capitalcity', " . time( + ) . ", 0, 33, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Аптечка (Исцеляет легкие травмы) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4412, 7, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_1', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Аптечка (Исцеляет средние травмы) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4413, 14, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_2', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Аптечка (Исцеляет тяжелые травмы) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4414, 21, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_3', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Холодный разум + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (1460, 15, 0.00, 0.00, 0.00, " . $uid . ", 0, 'musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 5, '32', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Сокрушение + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (994, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|oneType=44|noremont=1|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 4, '20', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Эликсир жизни (восстанавливает +500 хп) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (4736, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'moment=1|moment_hp=500|nohaos=1|musor=2|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, 'elicsir_hp -w500', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Зелье жизни (восстанавливает +200 хп) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (724, 2, 0.00, 0.00, 0.00, " . $uid . ", 0, 'moment=1|moment_hp=200|nohaos=1|musor=2|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, 'elicsir_hp -w200', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Зелье могущества (+10 силы) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (870, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s1=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '1', 'capitalcity', " . time( + ) . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Зелье стремительности (+10 ловкости) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (872, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s2=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '8', 'capitalcity', " . time( + ) . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Зелье прозрения(+10 интуиции) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (871, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s3=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '7', 'capitalcity', " . time( + ) . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Зелье разума(+10 интеллекта) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (873, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s5=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '9', 'capitalcity', " . time( + ) . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Нектар Отрицания(+160 защиты от магии) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (2140, 30, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=8|musor=2|noremont=1|add_zm=160|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '38', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Нектар уязвимости(+160 защиты от урона) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (2139, 30, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=8|musor=2|noremont=1|add_za=160|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '37', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + //Бутер (+180 хп) + mysql_query( + "INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES + (3075, 10, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=4|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, '283', 'capitalcity', " . time( + ) . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);" + ); + + mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $uid . '" LIMIT 1'); + + //Создаем статы персонажа + mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')"); + + //добовляем благодать ангела 1н день + $ttime = time(); + mysql_query( + "INSERT INTO `eff_users`(`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES + (412,'" . $uid . "','Благодать Ангела [1]','add_gold=1|add_speedhp=35|add_speedmp=35|add_exp=35|add_repair_discount=25|add_speed_dungeon=10|add_hpVinos=5|add_m10=5|add_m11=5|add_za=25|add_zma=25',52," . $ttime . ",0,'',0,0,0,'',1,-1,0,0,1,'',0,0,0,0,0)" + ); + + //мульты + $ipm1 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `logs_auth` WHERE `uid` = "' . mysql_real_escape_string( + $uid + ) . '" AND `ip`!="' . mysql_real_escape_string(getIp()) . '" ORDER BY `id` ASC LIMIT 1' + ) + ); + $ppl = mysql_query( + 'SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "' . mysql_real_escape_string( + getIp() + ) . '" OR `ip`="' . mysql_real_escape_string($ipm1['ip']) . '" OR `ip`="' . mysql_real_escape_string( + $_COOKIE['ip'] + ) . '")' + ); + while ($spl = mysql_fetch_array($ppl)) { + $ml = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `mults` WHERE (`uid` = "' . $spl['uid'] . '" AND `uid2` = "' . $uid . '") OR (`uid2` = "' . $spl['uid'] . '" AND `uid` = "' . $uid . '") LIMIT 1' + ) + ); + if (!isset($ml['id']) && $spl['ip'] != '' && $spl['ip'] != '127.0.0.1') { + mysql_query( + 'INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("' . $uid . '","' . $spl['uid'] . '","' . $spl['ip'] . '")' + ); } - //Сообщения РїСЂРё регистрации РѕС‚ паладинов. - $pal = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `align` > 1 AND `align` < 2 AND `online` > "' . (time() - 120) . '" ORDER BY `online` DESC LIMIT 1')); - if (!isset($pal['id'])) { - $pal = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `align` > 3 AND `align` < 4 AND `online` > "' . (time() - 120) . '" ORDER BY `online` DESC LIMIT 1')); - } - if (isset($pal['id'])) { - //отсылаем сообщение РѕС‚ $pal['login'] - $paltext = 'Приветствую ' . $_POST['nick_u'] . '. Отправляемся драться РІ хаоты, если нет заявок, создайте Р±РѕР№, дополнительно купите зверя Рё РЅРµ забывайте выходить РЅР° центральную площать убивать Трупожора своего СѓСЂРѕРІРЅСЏ!Приятной РёРіСЂС‹. '; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','" . $pal['login'] . "','" . $_POST['nick_u'] . "','" . $paltext . "','" . time() . "','3','0','1')"); - } else { - //РќРµ знаю что делать, пусть будет просто приветствие :) - $text = 'Приветствую ' . $_POST['nick_u'] . '. Отправляемся драться РІ хаоты, если нет заявок, создайте Р±РѕР№, дополнительно купите зверя Рё РЅРµ забывайте выходить РЅР° центральную площать убивать Трупожора своего СѓСЂРѕРІРЅСЏ!Приятной РёРіСЂС‹.'; - mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','" . $_POST['nick_u'] . "','" . $text . "','" . time() . "','3','0','1')"); - } - - //$text = 'Приветствую '.$_POST['nick_u'].'. Крайне рекомендую прочесть РјРёРЅРё гайд РїРѕ ссылке https://new-combats.com/forum?read=5762&rnd=1 , если останутся РІРѕРїСЂРѕСЃС‹,задавайте РІ общий чат!'; - //mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('capitalcity','0','','".$_POST['nick_u']."','".$text."','".time()."','6','0','1')"); - - /** РњРЅРѕРіРѕ однотипых запросов это боль. - * - * @param array $itemset - * @param double $itemscost - * @param string $stats - * - * @return void - */ - function sql_01(array $itemset, $itemscost, $stats) - { - global $u, $uid; - array_unshift($itemset, null); - foreach ($itemset as $inodet => $itemId) { - if (empty($itemId)) { - continue; - } - mysql_query(sprintf('update items_users set - 1price = (select price_1 from items_shop where sid = 1 and item_id = %d), - inOdet = %d - where id = %d', - $itemId, $inodet, $u->addItem($itemId, $uid))); - } - mysql_query(sprintf('update users set money = money - %f where id = %d', $itemscost, $uid)); - mysql_query(sprintf('insert into stats (id, stats, ability, skills, exp) - values (%d, %s, -75, -9, 100000)', $uid, $stats)); - } - - if ($_POST['class_u'] == 1) //топор - { - //кастим эфекты - $us = add_effn($uid, 1); // сила - $us = add_effn($uid, 20); // сокрушение - - $wear = [528, 540, 552, 291, 543, null, 627, 653, 681, 687, 687, 687, 320, 552, null, 709, 716]; - $itemcost = 2101; - $stats = 's1=62|s2=3|s3=3|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=9|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; - - } elseif ($_POST['class_u'] == 2) //СѓРІРѕСЂРѕС‚ - { - //кастим эфекты - $us = add_effn($uid, 8); // ловка - $us = add_effn($uid, 20); // сокрушение - - $wear = [525, 539, 523, 290, 541, null, 633, 647, 680, 685, 685, 685, 1151, 523, null, 707, 712]; - $itemcost = 1972; - $stats = 's1=21|s2=31|s3=16|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=9|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0'; - - } elseif ($_POST['class_u'] == 3)//танк - { - //кастим эфекты - $us = add_effn($uid, 1); // сила - $us = add_effn($uid, 20); // сокрушение - - $wear = [533, 536, 558, 291, 545, null, 628, 654, 684, 689, 689, 689, 700, 722, null, 710, 718]; - $itemcost = 2101; - $stats = 's1=42|s2=3|s3=3|s4=50|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=9|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; - - } elseif ($_POST['class_u'] == 4)//РєСЂРёС‚ - { - //кастим эфекты - $us = add_effn($uid, 7); // инта - $us = add_effn($uid, 20); // сокрушение - - $wear = [527, 537, 567, 291, 544, null, 626, 651, 683, 686, 686, 686, 706, 723, null, 708, 717]; - $itemcost = 1988; - $stats = 's1=24|s2=20|s3=24|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=9|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0'; - - } elseif ($_POST['class_u'] == 5)//РІРѕР·РґСѓС… - { - //кастим эфекты - $us = add_effn($uid, 9); // интелект - $us = add_effn($uid, 32); // Холодный разум - $us = add_effn($uid, 53); // Маг уселок РІРѕР·РґСѓС… - $us = add_effn($uid, 439); // Маг уселок - - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=6|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(534, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(1026, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(291, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(548, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(629, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(698, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(711, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(714, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///------- СЋРІР° - $re = $u->addItem(658, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "658" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(675, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "675" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(693, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(693, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(693, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - mysql_query('UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1');//коректировка денег 2244 - 1988 - } elseif ($_POST['class_u'] == 6)//РѕРіРѕРЅСЊ - { - //кастим эфекты - $us = add_effn($uid, 9); // интелект - $us = add_effn($uid, 32); // Холодный разум - $us = add_effn($uid, 51); // Маг уселок РѕРіРѕРЅСЊ - $us = add_effn($uid, 439); // Маг уселок - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=6|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(534, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(1026, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(291, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(549, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "549" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(629, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(698, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(711, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(714, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - ///------- СЋРІР° - $re = $u->addItem(655, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "655" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(679, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "679" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(696, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(696, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(696, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "696" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - - mysql_query('UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1');//коректировка денег 2244 - 1988 - } elseif ($_POST['class_u'] == 7)//земля - { - - - //кастим эфекты - $us = add_effn($uid, 9); // интелект - $us = add_effn($uid, 32); // Холодный разум - $us = add_effn($uid, 54); // Маг уселок земля - $us = add_effn($uid, 439); // Маг уселок - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=0|mg4=6|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(534, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(1026, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(291, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(548, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(629, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(698, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "698" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(711, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(714, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - ///------- СЋРІР° - $re = $u->addItem(657, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "657" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(674, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "674" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(692, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(692, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(692, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - - mysql_query('UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1');//коректировка денег 2244 - 1988 - } elseif ($_POST['class_u'] == 8)//РІРѕРґР° - { - //кастим эфекты - $us = add_effn($uid, 9); // интелект - $us = add_effn($uid, 32); // Холодный разум - $us = add_effn($uid, 52); // Маг уселок РІРѕРґР° - $us = add_effn($uid, 439); // Маг уселок - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=6|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $u->addItem(531, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(534, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(1026, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(291, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(548, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(629, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(318, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "318" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(711, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(714, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - ///------- СЋРІР° - $re = $u->addItem(660, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "660" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(677, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "677" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $u->addItem(695, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(695, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $u->addItem(695, $uid); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "695" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - - mysql_query('UPDATE `users` SET `money` = `money`-1988 WHERE `id` = "' . $uid . '" LIMIT 1');//коректировка денег 2244 - 1988 - } - - if (!empty($wear) && !empty($itemcost) && !empty($stats)) { - sql_01($wear, $itemcost, $stats); - unset($wear, $itemcost, $stats); - } - - if ($_POST['ref'] > 0) { - $re = $u->addItem(6417, $uid); - } - - //катим эфекты - // - // - $us = add_effn($uid, 37); - $us = add_effn($uid, 38); - $us = add_effn($uid, 283); - $us = add_effn($uid, 25); - $us = add_effn($uid, 296); - $us = add_effn($uid, 472); - - //Магическое усиление - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4942, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'oneType=72|onlyOne=1|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '439', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Защита РѕС‚ оружия - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (1001, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|oneType=7|noremont=1|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '25', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Защита РѕС‚ магии - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4941, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'oneType=71|onlyOne=1|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 2, '438', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Жажда жизни +6 - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (3101, 50, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|noremont=1|oneType=33|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 2, '296', 'capitalcity', " . time() . ", 0, 33, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Аптечка (Рсцеляет легкие травмы) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4412, 7, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_1', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Аптечка (Рсцеляет средние травмы) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4413, 14, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_2', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Аптечка (Рсцеляет тяжелые травмы) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4414, 21, 0.00, 0.00, 0.00, " . $uid . ", 0, 'tr_lvl=1|useOnLogin=1|musor=1|noremont=1', 0, 0, 0, 0, 0.00, 2, 'Администрация', '', '', 1, 2, 'lech_free_3', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Холодный разум - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (1460, 15, 0.00, 0.00, 0.00, " . $uid . ", 0, 'musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 5, '32', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Сокрушение - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (994, 40, 0.00, 0.00, 0.00, " . $uid . ", 0, 'onlyOne=1|oneType=44|noremont=1|musor=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 4, 'Администрация', '', '', 1, 4, '20', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Эликсир жизни (восстанавливает +500 С…Рї) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (4736, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'moment=1|moment_hp=500|nohaos=1|musor=2|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, 'elicsir_hp -w500', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Зелье жизни (восстанавливает +200 С…Рї) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (724, 2, 0.00, 0.00, 0.00, " . $uid . ", 0, 'moment=1|moment_hp=200|nohaos=1|musor=2|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, 'elicsir_hp -w200', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Зелье могущества (+10 силы) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (870, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s1=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '1', 'capitalcity', " . time() . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Зелье стремительности (+10 ловкости) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (872, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s2=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '8', 'capitalcity', " . time() . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Зелье прозрения(+10 интуиции) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (871, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s3=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '7', 'capitalcity', " . time() . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Зелье разума(+10 интеллекта) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (873, 5, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=1|musor=2|noremont=1|nohaos=1|onlyOne=1|oneType=1|noremont=1|add_s5=15|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '9', 'capitalcity', " . time() . ", 0, 1, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Нектар Отрицания(+160 защиты РѕС‚ магии) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (2140, 30, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=8|musor=2|noremont=1|add_zm=160|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '38', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Нектар уязвимости(+160 защиты РѕС‚ СѓСЂРѕРЅР°) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (2139, 30, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=8|musor=2|noremont=1|add_za=160|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 5, 'Администрация', '', '', 1, 4, '37', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - //Бутер (+180 С…Рї) - mysql_query("INSERT INTO `items_users` (`item_id`, `1price`, `2price`, `3price`, `4price`, `uid`, `use_text`, `data`, `inOdet`, `inShop`, `inGroup`, `delete`, `iznosNOW`, `iznosMAX`, `gift`, `gtxt1`, `gtxt2`, `kolvo`, `geniration`, `magic_inc`, `maidin`, `lastUPD`, `timeOver`, `overType`, `secret_id`, `time_create`, `time_sleep`, `dn_delete`, `inTransfer`, `post_delivery`, `lbtl_`, `bexp`, `so`, `blvl`, `pok_itm`, `btl_zd`) VALUES - (3075, 10, 0.00, 0.00, 0.00, " . $uid . ", 0, 'nohaos=1|onlyOne=1|oneType=4|musor=1|noremont=1|sudba=1|nosale=1', 0, 0, 0, 0, 0.00, 10, 'Администрация', '', '', 1, 4, '283', 'capitalcity', " . time() . ", 0, 0, '', " . time() . ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"); - - mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $uid . '" LIMIT 1'); - - //Создаем статы персонажа - mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')"); - - //добовляем благодать ангела 1РЅ день - $ttime = time(); - mysql_query("INSERT INTO `eff_users`(`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (412,'" . $uid . "','Благодать Ангела [1]','add_gold=1|add_speedhp=35|add_speedmp=35|add_exp=35|add_repair_discount=25|add_speed_dungeon=10|add_hpVinos=5|add_m10=5|add_m11=5|add_za=25|add_zma=25',52," . $ttime . ",0,'',0,0,0,'',1,-1,0,0,1,'',0,0,0,0,0)"); - - //мульты - $ipm1 = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `ip`!="' . mysql_real_escape_string(getIp()) . '" ORDER BY `id` ASC LIMIT 1')); - $ppl = mysql_query('SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "' . mysql_real_escape_string(getIp()) . '" OR `ip`="' . mysql_real_escape_string($ipm1['ip']) . '" OR `ip`="' . mysql_real_escape_string($_COOKIE['ip']) . '")'); - while ($spl = mysql_fetch_array($ppl)) { - $ml = mysql_fetch_array(mysql_query('SELECT `id` FROM `mults` WHERE (`uid` = "' . $spl['uid'] . '" AND `uid2` = "' . $uid . '") OR (`uid2` = "' . $spl['uid'] . '" AND `uid` = "' . $uid . '") LIMIT 1')); - if (!isset($ml['id']) && $spl['ip'] != '' && $spl['ip'] != '127.0.0.1') { - mysql_query('INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("' . $uid . '","' . $spl['uid'] . '","' . $spl['ip'] . '")'); - } - } - mysql_query("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $uid . "','" . mysql_real_escape_string(getIp()) . "','" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','1','" . time() . "','')"); - - //Обновяем таблицы - mysql_query("UPDATE `users` SET `online`='" . time() . "',`ip` = '" . mysql_real_escape_string(getIp()) . "' WHERE `uid` = '" . $uid . "' LIMIT 1"); - - if (!setcookie('login', $_POST['nick_u'], (time() + 60 * 60 * 24 * 7), '', '.new-combats.com') || !setcookie('pass', md5($_POST['pass1_u']), (time() + 60 * 60 * 24 * 7), '', '.new-combats.com')) { - die('Ошибка сохранения cookie.'); - } else { - - die('Спасибо Р·Р° регистрацию РІ РёРіСЂРѕРІРѕРј РјРёСЂРµ Бойцовского Клуба, желаем вам побед Рё долгой РёРіСЂС‹. -Р’ случае РІРѕРїСЂРѕСЃРѕРІ РїРѕ РёРіСЂРµ, Вам будет доступен общий чат!
    '); - - } - - setcookie('login', $_POST['nick_u'], time() + 60 * 60 * 24 * 7, '', $c['host']); - setcookie('pass', md5($_POST['pass1_u']), time() + 60 * 60 * 24 * 7, '', $c['host']); - setcookie('login', $_POST['nick_u'], time() + 60 * 60 * 24 * 7); - setcookie('pass', md5($_POST['pass1_u']), time() + 60 * 60 * 24 * 7); - - header('location: https://new-combats.com/bk'); - - //=================================================================== } - //================================ - } else { - ?> -
    -

    -
    - + mysql_query( + "INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $uid . "','" . mysql_real_escape_string( + getIp() + ) . "','" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','1','" . time() . "','')" + ); - ' + ); + + } + + setcookie('login', $_POST['nick_u'], time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('pass', md5($_POST['pass1_u']), time() + 60 * 60 * 24 * 7, '', $c['host']); + setcookie('login', $_POST['nick_u'], time() + 60 * 60 * 24 * 7); + setcookie('pass', md5($_POST['pass1_u']), time() + 60 * 60 * 24 * 7); + + header('location: https://new-combats.com/bk'); + + //=================================================================== } + //================================ +} else { + ?> +
    +

    +
    + + + info['banned'] > 0) { - header('location: /index.php'); - die(); +if ($u->info['banned'] > 0) { + header('location: /index.php'); + die(); } $tjs = ''; -if($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { - unset($_GET,$_POST); +if ($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { + unset($_GET, $_POST); } -if($u->info['activ']>0) { - die('Вам необходимо активировать персонажа.
    Авторизируйтесь с главной страницы.'); +if ($u->info['activ'] > 0) { + die('Вам необходимо активировать персонажа.
    Авторизируйтесь с главной страницы.'); } -if(isset($_POST['set_name'])) { - $_POST['set_name'] = htmlspecialchars($_POST['set_name']); - $set_x = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" AND `name` != "'.mysql_real_escape_string($_POST['set_name']).'" LIMIT 1')); - if( $set_x[0] > 20 ) { - $u->error = 'Нельзя создавать более 20 профилей'; - }else{ - $set_x = mysql_fetch_array(mysql_query('SELECT `id` FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" AND `name` = "'.mysql_real_escape_string($_POST['set_name']).'" LIMIT 1')); - // - - $f = $free_stats; // свободных статов - $i = 1; - while( $i <= 6 ) { - $_POST['s'.$i] = round((int)$_POST['s'.$i]); - if( $_POST['s'.$i] < 0 ) { - $_POST['s'.$i] = 0; - } - $f -= $_POST['s'.$i]; - $i++; - } - - // - if( $f < 0 || $f > $free_stats ) { - $u->error = 'Ошибка в распределении статов.'; - }elseif(isset($set_x['id'])) { - mysql_query('UPDATE `ruine_sets` SET - `s1` = "'.mysql_real_escape_string($_POST['s1']).'", - `s2` = "'.mysql_real_escape_string($_POST['s2']).'", - `s3` = "'.mysql_real_escape_string($_POST['s3']).'", - `s4` = "'.mysql_real_escape_string($_POST['s4']).'", - `s5` = "'.mysql_real_escape_string($_POST['s5']).'", - `s6` = "'.mysql_real_escape_string($_POST['s6']).'", - `free` = "'.mysql_real_escape_string($f).'", - `time` = "'.time().'" - WHERE `id` = "'.$set_x['id'].'" LIMIT 1'); - $u->error = 'Профиль "'.$_POST['set_name'].'" был успешно перезаписан!'; - }else{ - mysql_query('INSERT INTO `ruine_sets` ( +if (isset($_POST['set_name'])) { + $_POST['set_name'] = htmlspecialchars($_POST['set_name']); + $set_x = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `name` != "' . mysql_real_escape_string( + $_POST['set_name'] + ) . '" LIMIT 1' + ) + ); + if ($set_x[0] > 20) { + $u->error = 'Нельзя создавать более 20 профилей'; + } else { + $set_x = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `name` = "' . mysql_real_escape_string( + $_POST['set_name'] + ) . '" LIMIT 1' + ) + ); + // + + $f = $free_stats; // свободных статов + $i = 1; + while ($i <= 6) { + $_POST['s' . $i] = round((int)$_POST['s' . $i]); + if ($_POST['s' . $i] < 0) { + $_POST['s' . $i] = 0; + } + $f -= $_POST['s' . $i]; + $i++; + } + + // + if ($f < 0 || $f > $free_stats) { + $u->error = 'Ошибка в распределении статов.'; + } elseif (isset($set_x['id'])) { + mysql_query( + 'UPDATE `ruine_sets` SET + `s1` = "' . mysql_real_escape_string($_POST['s1']) . '", + `s2` = "' . mysql_real_escape_string($_POST['s2']) . '", + `s3` = "' . mysql_real_escape_string($_POST['s3']) . '", + `s4` = "' . mysql_real_escape_string($_POST['s4']) . '", + `s5` = "' . mysql_real_escape_string($_POST['s5']) . '", + `s6` = "' . mysql_real_escape_string($_POST['s6']) . '", + `free` = "' . mysql_real_escape_string($f) . '", + `time` = "' . time() . '" + WHERE `id` = "' . $set_x['id'] . '" LIMIT 1' + ); + $u->error = 'Профиль "' . $_POST['set_name'] . '" был успешно перезаписан!'; + } else { + mysql_query( + 'INSERT INTO `ruine_sets` ( `uid`,`name`,`free`,`s1`,`s2`,`s3`,`s4`,`s5`,`s6`,`time` ) VALUES ( - "'.$u->info['id'].'","'.mysql_real_escape_string($_POST['set_name']).'","'.mysql_real_escape_string($f).'", - "'.mysql_real_escape_string($_POST['s1']).'", - "'.mysql_real_escape_string($_POST['s2']).'", - "'.mysql_real_escape_string($_POST['s3']).'", - "'.mysql_real_escape_string($_POST['s4']).'", - "'.mysql_real_escape_string($_POST['s5']).'", - "'.mysql_real_escape_string($_POST['s6']).'", - "'.time().'" - )'); - $u->error = 'Профиль "'.$_POST['set_name'].'" был создан.'; - } - } -}elseif( isset($_GET['use']) ) { - $set_x = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['use']).'" LIMIT 1')); - if(isset($set_x['id'])) { - mysql_query('UPDATE `ruine_sets` SET `use` = 0 WHERE `uid` = "'.$u->info['id'].'"'); - mysql_query('UPDATE `ruine_sets` SET `use` = 1 WHERE `id` = "'.$set_x['id'].'" LIMIT 1'); - $u->error = 'Профиль "'.$set_x['name'].'" был установлен по умолчанию.'; - } -}elseif( isset($_GET['delete']) ) { - $set_x = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['delete']).'" LIMIT 1')); - if(isset($set_x['id'])) { - mysql_query('DELETE FROM `ruine_sets` WHERE `id` = "'.$set_x['id'].'" LIMIT 1'); - $u->error = 'Профиль "'.$set_x['name'].'" был стерт.'; - } + "' . $u->info['id'] . '","' . mysql_real_escape_string( + $_POST['set_name'] + ) . '","' . mysql_real_escape_string($f) . '", + "' . mysql_real_escape_string($_POST['s1']) . '", + "' . mysql_real_escape_string($_POST['s2']) . '", + "' . mysql_real_escape_string($_POST['s3']) . '", + "' . mysql_real_escape_string($_POST['s4']) . '", + "' . mysql_real_escape_string($_POST['s5']) . '", + "' . mysql_real_escape_string($_POST['s6']) . '", + "' . time() . '" + )' + ); + $u->error = 'Профиль "' . $_POST['set_name'] . '" был создан.'; + } + } +} elseif (isset($_GET['use'])) { + $set_x = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string( + $_GET['use'] + ) . '" LIMIT 1' + ) + ); + if (isset($set_x['id'])) { + mysql_query('UPDATE `ruine_sets` SET `use` = 0 WHERE `uid` = "' . $u->info['id'] . '"'); + mysql_query('UPDATE `ruine_sets` SET `use` = 1 WHERE `id` = "' . $set_x['id'] . '" LIMIT 1'); + $u->error = 'Профиль "' . $set_x['name'] . '" был установлен по умолчанию.'; + } +} elseif (isset($_GET['delete'])) { + $set_x = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string( + $_GET['delete'] + ) . '" LIMIT 1' + ) + ); + if (isset($set_x['id'])) { + mysql_query('DELETE FROM `ruine_sets` WHERE `id` = "' . $set_x['id'] . '" LIMIT 1'); + $u->error = 'Профиль "' . $set_x['name'] . '" был стерт.'; + } } ?> - -Старый Бойцовский Клуб - Профили характеристик - - - + + Старый Бойцовский Клуб - Профили характеристик + + +

    Профили характеристик


    error != '' ) { - echo '
    '.$u->error.'

    '; +if ($u->error != '') { + echo '
    ' . $u->error . '

    '; } ?> -Статы не позволяют сходить в руины? Раскиньте ваши статы так, как вы хотите, и участвуйте в турнире! Выбранный по умолчанию профиль, загрузится сам. Вы можете создавать до двадцати профилей и менять их за секунды до турнира! +Статы не позволяют сходить в руины? Раскиньте ваши статы так, как вы хотите, и участвуйте в турнире! Выбранный по +умолчанию профиль, загрузится сам. Вы можете создавать до двадцати профилей и менять их за секунды до турнира!

    - - - - - - info['id'].'" ORDER BY `time` DESC'); - while( $pl = mysql_fetch_array($sp) ) { - ?> - - - - - - + + + + + + info['id'] . '" ORDER BY `time` DESC'); + while ($pl = mysql_fetch_array($sp)) { + ?> + + + + + +
    НазваниеПо умолчаниюУдалить
    - - Установить - - По умолчанию - удалить
    НазваниеПо умолчаниюУдалить
    + + Установить + + По умолчанию + удалить
    -Нет сохраненных профилей
    '; +Нет сохраненных профилей
    '; } ?>
    - +



    -Название:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ХарактеристикаЗначение
    Сила
    Ловкость
    Интуиция
    Выносливость
    Интеллект
    Мудрость
    Свободных статов
    -
    - + Название:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ХарактеристикаЗначение
    Сила
    Ловкость
    Интуиция
    Выносливость
    Интеллект
    Мудрость
    Свободных статов
    +
    +
    diff --git a/ruins.php b/ruins.php index a5006665..f7d26d38 100644 --- a/ruins.php +++ b/ruins.php @@ -1,8 +1,7 @@ - Лог Руин Старого Замка - +
    Обновить

                          # Руинный турнир в Старом Замке

    -
    Старый Бойцовский Клуб © , «www.new-combats.com»™    


    -
    - - < - - - -
    + diff --git a/ruletka.php b/ruletka.php index f3d4bddc..b876a852 100644 --- a/ruletka.php +++ b/ruletka.php @@ -2,663 +2,627 @@ die(); -define('GAME',true); +define('GAME', true); include_once('_incl_data/__config.php'); include_once('_incl_data/class/__db_connect.php'); -include_once('_incl_data/class/__user.php'); +$u = User::start(); -if(!isset($u->bank['id'])) { - die(); +if (!isset($u->bank['id'])) { + die(); } - if($u->info['admin'] == 0) { - //die(''); - } - /*mysql_query("LOCK TABLES - `actions` WRITE, - `bank` WRITE, - - `users` WRITE, - `users_delo` WRITE, - - `chat` WRITE, - - `stats` WRITE, - - `ruletka` WRITE, - `ruletka_coin` WRITE, - - `bandit` WRITE;");*/ +/* +33|2-0-0-0-2-0, +32|4-0-0-0-4-6, +11|4-0-0-42-4-0, +21|2-0-0-0-2-0, +2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35|8-0-8-0-0-0, +7|4-0-0-0-4-0, +2|4-0-0-0-4-0, +17|4-0-0-4-4-0, +1|6-0-0-0-0-6, +18|4-0-0-0-4-0, +30|4-0-0-6-4-6, +16|4-0-0-0-4-0, +13|4-0-0-0-4-0, +25|6-0-0-0-0-6, +27|2-0-0-0-2-0, +36|2-0-0-0-2-0, +3|4-0-0-0-4-0, +20|4-0-0-0-4-0, +8|8-0-0-16-4-0, +38|2-0-0-0-2-6, +4|8-0-0-16-0-0, +34|4-0-0-0-4-0, +37|1-0-0-0-4-7, +19|2-0-0-0-2-0, +10|4-0-0-10-2-0, +31|6-0-0-6-4-0 +*/ + +if ($u->room['name'] != 'Рулетка') { + die(); +} else { + + //Раздаем выйгрыши - /* - 33|2-0-0-0-2-0, - 32|4-0-0-0-4-6, - 11|4-0-0-42-4-0, - 21|2-0-0-0-2-0, - 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35|8-0-8-0-0-0, - 7|4-0-0-0-4-0, - 2|4-0-0-0-4-0, - 17|4-0-0-4-4-0, - 1|6-0-0-0-0-6, - 18|4-0-0-0-4-0, - 30|4-0-0-6-4-6, - 16|4-0-0-0-4-0, - 13|4-0-0-0-4-0, - 25|6-0-0-0-0-6, - 27|2-0-0-0-2-0, - 36|2-0-0-0-2-0, - 3|4-0-0-0-4-0, - 20|4-0-0-0-4-0, - 8|8-0-0-16-4-0, - 38|2-0-0-0-2-6, - 4|8-0-0-16-0-0, - 34|4-0-0-0-4-0, - 37|1-0-0-0-4-7, - 19|2-0-0-0-2-0, - 10|4-0-0-10-2-0, - 31|6-0-0-6-4-0 - */ + function get2str($key = '', $val = '') + { + $get = $_GET; + if (is_array($key)) { + if (count($key) > 0) { + foreach ($key as $k => $v) { + $get[$k] = $v; + } + } + } else { + $get[$key] = $val; + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + if (empty($v)) { + unset($get[$k]); + } + } + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + $get[$k] = $k . '=' . urlencode($v); + } + return '?' . implode('&', $get); + } + } -if($u->room['name']!='Рулетка') -{ - die(); -}else{ - - //Раздаем выйгрыши - - - function get2str($key='', $val='') { - $get = $_GET; - if ( is_array($key) ) { - if ( count($key)>0 ) foreach ( $key as $k=>$v ) $get[$k] = $v; - } else $get[$key] = $val; - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) if ( empty($v) ) unset($get[$k]); - } - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) $get[$k] = $k.'='.urlencode($v); - return '?'.implode('&', $get); - } - } + $r = ''; + $time = 74; //сек до новой игры + $status = 0; //статус игры, 2 - крутим колесо + $win = [ + 0 => 0, //число выйгрыша + 1 => '', //линии выйгрыша + 2 => 0, //сумма выйгрыша + 3 => 0, //ставка на эту игру текущего игрока + //ставки + 4 => '', + //игроки которые делали ставки + 5 => '', + ]; - $r = ''; - $time = 74; //сек до новой игры - $status = 0; //статус игры, 2 - крутим колесо - $win = array( - 0 => 0, //число выйгрыша - 1 => '', //линии выйгрыша - 2 => 0, //сумма выйгрыша - 3 => 0, //ставка на эту игру текущего игрока - //ставки - 4 => '', - //игроки которые делали ставки - 5 => '' - ); - - //Выделяем текущую игру, если её нет, то создаем новую - $gid = mysql_fetch_array(mysql_query('SELECT * FROM `ruletka` WHERE (`end` = 0 OR `id` = "'.((int)$_GET['id']).'") ORDER BY `id` DESC LIMIT 1')); - if($gid['time_start']+16>time() || isset($_GET['bet'])) - { - $mnr = true; - } - $gid3 = mysql_fetch_array(mysql_query('SELECT * FROM `ruletka` WHERE `end` >0 AND `id` = "'.((int)$_GET['id']).'" ORDER BY `id` DESC LIMIT 1')); - if(isset($gid3['id'])) - { - $gid = $gid3; - unset($gid3); - } - $add = false; - if(isset($gid['id'])) - { - //Игра существует, проверяем - $time = $gid['time_start']-time(); - if($time<1) - { - //крутим колесо и заканчиваем игру + выдаем выйгрыш - //mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$gid['id'].'" LIMIT 1'); - //выводим предыдущий выйгрыш - $win[0] = $gid['win']; - $win[1] = $gid['win_line']; - $win[2] = 0; - $win[3] = 0; - if($gid['end']==0) - { - $add = true; - } - }else{ - //ожидаем начала игры, делаем ставки - if(isset($_GET['bet'])) - { - $bt = $_GET['bet']; - $good = 0; - $i = 0; - while($i<=38) - { - if($i==$bt) - { - $good++; - } - $i++; - } - - /* - Ставки и значения - - 1, ... ,36 - ставка на числа [x8] - - 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35 - черное [x2] - 1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36 - красное [x2] - - 37 - два нуля [x36] - 38 - ноль [x36] - - 1-2-3-37-38 - потолок [x5] - - 1-2-3-4-5-6-7-8-9-10-11-12 - 1 сектор [x3] - 13-14-15-16-17-18-19-20-21-22-23-24 - 2 сектор [x3] - 25-26-27-28-29-30-31-32-33-34-35-36 - 3 сектор [x3] - - */ - - if($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '35-36' && $good == 0 ) { - $good++; - }elseif($bt == '34-35' && $good == 0 ) { - $good++; - }elseif($bt == '32-33' && $good == 0 ) { - $good++; - }elseif($bt == '31-32' && $good == 0 ) { - $good++; - }elseif($bt == '29-30' && $good == 0 ) { - $good++; - }elseif($bt == '28-29' && $good == 0 ) { - $good++; - }elseif($bt == '26-27' && $good == 0 ) { - $good++; - }elseif($bt == '25-26' && $good == 0 ) { - $good++; - }elseif($bt == '23-24' && $good == 0 ) { - $good++; - }elseif($bt == '22-23' && $good == 0 ) { - $good++; - }elseif($bt == '20-21' && $good == 0 ) { - $good++; - }elseif($bt == '19-20' && $good == 0 ) { - $good++; - }elseif($bt == '17-18' && $good == 0 ) { - $good++; - }elseif($bt == '16-17' && $good == 0 ) { - $good++; - }elseif($bt == '14-15' && $good == 0 ) { - $good++; - }elseif($bt == '13-14' && $good == 0 ) { - $good++; - }elseif($bt == '11-12' && $good == 0 ) { - $good++; - }elseif($bt == '10-11' && $good == 0 ) { - $good++; - }elseif($bt == '8-9' && $good == 0 ) { - $good++; - }elseif($bt == '7-8' && $good == 0 ) { - $good++; - }elseif($bt == '5-6' && $good == 0 ) { - $good++; - }elseif($bt == '4-5' && $good == 0 ) { - $good++; - }elseif($bt == '2-3' && $good == 0 ) { - $good++; - }elseif($bt == '1-2' && $good == 0 ) { - $good++; - }elseif($bt == '32-33-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-34-35' && $good == 0 ) { - $good++; - }elseif($bt == '29-30-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-31-32' && $good == 0 ) { - $good++; - }elseif($bt == '26-27-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-28-29' && $good == 0 ) { - $good++; - }elseif($bt == '23-24-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-25-26' && $good == 0 ) { - $good++; - }elseif($bt == '20-21-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-22-23' && $good == 0 ) { - $good++; - }elseif($bt == '17-18-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-19-20' && $good == 0 ) { - $good++; - }elseif($bt == '14-15-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-16-17' && $good == 0 ) { - $good++; - }elseif($bt == '11-12-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-13-14' && $good == 0 ) { - $good++; - }elseif($bt == '8-9-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-10-11' && $good == 0 ) { - $good++; - }elseif($bt == '5-6-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '4-5-7-8' && $good == 0 ) { - $good++; - }elseif($bt == '2-3-5-6' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-4-5' && $good == 0 ) { - $good++; - }elseif($bt == '2-3-37' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-38' && $good == 0 ) { - $good++; - }elseif($bt == '38-1' && $good == 0 ) { - $good++; - }elseif($bt == '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36' && $good == 0 ) { - $good++; - }elseif($bt == '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-30-31-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-24-25-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-18-19-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-12-13-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '4-5-6-7-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-33-34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-27-28-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21-22-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-15-16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-9-10-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3-4-5-6' && $good == 0 ) { - $good++; - }elseif($bt == '34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '6-5-4' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3' && $good == 0 ) { - $good++; - }elseif($bt == '3-6-9-12-15-18-21-24-27-30-33-36' && $good == 0 ) { - $good++; - }elseif($bt == '2-5-8-11-14-17-20-23-26-29-32-35' && $good == 0 ) { - $good++; - }elseif($bt == '1-4-7-10-13-16-19-22-25-28-31-34' && $good == 0 ) { - $good++; - }elseif($bt == '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35' && $good==0) - { - $good++; - }elseif($bt == '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36' && $good==0) - { - $good++; - }elseif($bt == '1-2-3-37-38' && $good==0) - { - $good++; - }elseif($bt == '1-2-3-4-5-6-7-8-9-10-11-12' && $good==0) - { - $good++; - }elseif($bt == '13-14-15-16-17-18-19-20-21-22-23-24' && $good==0) - { - $good++; - }elseif($bt == '25-26-27-28-29-30-31-32-33-34-35-36' && $good==0) - { - $good++; - }elseif($bt == '1-2-4-5' && $good==0) - { - $good++; - } - $_GET['coin'] = (int)$_GET['coin']; - if($_GET['coin']<1) - { - $good = 0; - } - if($_GET['coin']>$u->bank['money2']) - { - $good = 0; - } - if($good==1) - { - $u->bank['money2'] -= ((int)$_GET['coin']); - - $stvka = ''; - - if($stvka == '') { - $stvka = 'неизвестная зона ставки'; - } - - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','[Крупье] Игрок ".mysql_real_escape_string($u->info['login'])." сделал ставку: ".(0+((int)$_GET['coin'])).".00 екр. на ".$stvka.", игра №".$gid['id']."','".time()."','6','0')"); - - - mysql_query('UPDATE `bank` SET `money2` = '.$u->bank['money2'].' WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `ruletka_coin` (`uid`,`login`,`money`,`time`,`game_id`,`win2`) VALUES ("'.$u->info['id'].'","'.$u->info['login'].'","'.$_GET['coin'].'","'.time().'","'.$gid['id'].'","'.$bt.'")'); - } - } - } - }else{ - $add = true; - } - - //обновляем ставки - $pos = array( - 0 => '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35', - 1 => '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36', - 2 => '1-2-3-37-38', - 3 => '1-2-3-4-5-6-7-8-9-10-11-12', - 4 => '13-14-15-16-17-18-19-20-21-22-23-24', - 5 => '25-26-27-28-29-30-31-32-33-34-35-36', - 6 => '1-4-7-10-13-16-19-22-25-28-31-34', - 7 => '2-5-8-11-14-17-20-23-26-29-32-35', - 8 => '3-6-9-12-15-18-21-24-27-30-33-36', - 9 => '1-2-3', - 10 => '6-5-4', - 11 => '7-8-9', - 12 => '10-11-12', - 13 => '13-14-15', - 14 => '16-17-18', - 15 => '19-20-21', - 16 => '22-23-24', - 17 => '25-26-27', - 18 => '28-29-30', - 19 => '31-32-33', - 20 => '34-35-36', - 21 => '1-2-3-4-5-6', - 22 => '7-8-9-10-11-12', - 23 => '13-14-15-16-17-18', - 24 => '19-20-21-22-23-24', - 25 => '25-26-27-28-29-30', - 26 => '31-32-33-34-35-36', - 27 => '4-5-6-7-8-9', - 28 => '10-11-12-13-14-15', - 29 => '16-17-18-19-20-21', - 30 => '22-23-24-25-26-27', - 31 => '28-29-30-31-32-33', - 32 => '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18', - 33 => '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36', - 34 => '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35', - 35 => '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36', - 36 => '38-1', - 37 => '1-2-38', - 38 => '2-3-37', - 39 => '32-33-35-36', - 40 => '31-32-34-35', - 41 => '29-30-32-33', - 42 => '28-29-31-32', - 43 => '26-27-29-30', - 44 => '25-26-28-29', - 45 => '23-24-26-27', - 46 => '22-23-25-26', - 47 => '20-21-23-24', - 48 => '19-20-22-23', - 49 => '17-18-20-21', - 50 => '16-17-19-20', - 51 => '14-15-17-18', - 52 => '13-14-16-17', - 53 => '11-12-14-15', - 54 => '10-11-13-14', - 55 => '8-9-11-12', - 56 => '7-8-10-11', - 57 => '5-6-8-9', - 58 => '4-5-7-8', - 59 => '2-3-5-6', - 60 => '1-2-4-5', - 61 => '1-2', - 62 => '2-3', - 63 => '4-5', - 64 => '5-6', - 65 => '7-8', - 66 => '8-9', - 67 => '10-11', - 68 => '11-12', - 69 => '13-14', - 70 => '14-15', - 71 => '16-17', - 72 => '17-18', - 73 => '19-20', - 74 => '20-21', - 75 => '22-23', - 76 => '23-24', - 77 => '25-26', - 78 => '26-27', - 79 => '28-29', - 80 => '29-30', - 81 => '31-32', - 82 => '32-33', - 83 => '34-35', - 84 => '35-36' - ); - - function testCoin($s,$stt) - { - global $u,$win; - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `game_id` = "'.$s.'" AND `money` > 0 AND `win2` = "'.$stt.'" AND `uid` != "'.$u->info['id'].'"'); - $cr = 0; $am = 0; - $usr = ''; $lu = array(); - while($pl = mysql_fetch_array($sp)) - { - $cr = $pl['money']; - if(!isset($lu[$pl['uid']]) && count($lu)<4) - { - $usr .= '-'.$pl['money']; - $lu[$pl['uid']] = true; - } - $am++; - } - $us = 0; //Ставка игрока - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `game_id` = "'.$s.'" AND `money` > 0 AND `win2` = "'.$stt.'" AND `uid` = "'.$u->info['id'].'" LIMIT 100'); - while($pl = mysql_fetch_array($sp)) - { - $cr = $pl['money']; - $us += $pl['money']; - $am++; - } - $i = 0; - while($i<4) - { - if($i > count($lu)) - { - $usr .= '-0'; - } - $i++; - } - if($am>0) - { - $win[4] .= $stt.'|'.$cr.'-'.$us.''.$usr.','; - } - } - - //ставки на числа - $i = 1; - while($i<=38) - { - testCoin($gid['id'],$i); - $i++; - } - //комбинированные ставки - $i = 0; - while($i0,'room'=>$u->info['room'],'time'=>time(),'time_start'=>time()+74,'win'=>floor(rand(100,3800)/100),'win_line'=>'','end'=>0); - $s37 = mysql_fetch_array(mysql_query('SELECT `id` FROM `ruletka` WHERE `win` = "37" OR `win` = "38" AND `time` > "'.(time()-round(3600/10000*rand(5000,10000))).'" LIMIT 1')); - if(isset($s37['id'])) { - $gid2['win'] = floor(rand(100,3600)/100); - } - $ins = mysql_query('INSERT INTO `ruletka` (`room`,`time`,`time_start`,`win`,`win_line`) VALUES ("'.$gid2['room'].'","'.$gid2['time'].'","'.$gid2['time_start'].'","'.$gid2['win'].'","'.$gid2['win_line'].'")'); - $gid2['id'] = mysql_insert_id(); - if($ins) - { - $gid = $gid2; - } - unset($gid2); - } - - $u_w = array(0=>array(),1=>array(),2=>array(),3=>array()); - - $sm = $u->testAction('`city` = "'.$u->info['city'].'" AND `vars` = "casino_balance" LIMIT 1',1); - if(!isset($sm['id'])) { - $u->addAction(time(),'casino_balance',0); - } - - //обновляем выйгрыши - $sp = mysql_query('SELECT * FROM `ruletka` WHERE `end` = "0" AND `time_start` <= '.time().''); - while($pl = mysql_fetch_array($sp)) - { - /*$pl['win'] = floor(rand(10000000,360000000)/10000000); - if( rand(0,1) == 1 ) { - $pl['win'] = floor(rand(10000000,360000000)/10000000); - } - if( rand(0,1) == 1 ) { - $pl['win'] = floor(rand(10000000,360000000)/10000000); - }*/ - $end = mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - if($end) - { - //выдаем выйгрышь - $sp2 = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `game_id` = "'.$pl['id'].'"'); - while($pl2 = mysql_fetch_array($sp2)) - { - $upd = mysql_query('UPDATE `ruletka_coin` SET `end` = "'.time().'" WHERE `id` = "'.$pl2['id'].'" LIMIT 1'); - if($upd) - { - $wn = 0; $wn2 = 0; - $xv = 2; - if($pl2['win2']==$pl['win']) - { - $wn++; - }else{ - $i = 0; $j = explode('-',$pl2['win2']); - $xv = floor(1+34/count($j)); - while($i0) - { - //перечисляем деньги [x8], если зеро то [x36] - if($pl['win']>36) - { - $nmn = ((int)$pl2['money']*35); - }else{ - $nmn = ((int)$pl2['money']*35); - } - mysql_query('UPDATE `bank` SET `money2` = `money2` + "'.$nmn.'" WHERE `uid` = "'.$pl2['uid'].'" ORDER BY `useNow` DESC LIMIT 1'); - }elseif($wn2>0) - { - //перечисляем деньги по определенной формуле - $nmn = ((int)$pl2['money']*$xv); - mysql_query('UPDATE `bank` SET `money2` = `money2` + "'.$nmn.'" WHERE `uid` = "'.$pl2['uid'].'" ORDER BY `useNow` DESC LIMIT 1'); - }else{ - //проиграли - mysql_query('UPDATE `ruletka_coin` SET `end` = "1" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `actions` SET `vals` = `vals` + "'.mysql_real_escape_string(0+$pl2['money']).'" WHERE `id` = "'.$sm['id'].'" LIMIT 1'); - } - - if($wn > 0 || $wn2 > 0) { - $u->addDelo(1,$pl2['uid'],'"Casino.'.$u->info['city'].'": Выиграл '.$nmn.' еекр.',time(),$u->info['city'],'Casino.'.$u->info['city'].'',0,0); - if(!isset($u_w[1][$pl2['uid']])) { - $u_w[0][count($u_w[0])] = $pl2['uid']; - $u_w[2][count($u_w[0])-1] = $pl2['game_id']; - } - $u_w[1][$pl2['uid']] += (int)$nmn; - } - $u_w[3][$pl2['uid']] += (int)$pl2['money']; - - } - } - } - } - - if(count($u_w[0]) > 0) { - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$pl['city']."','225','Крупье','','Игрок ".$pl['login']." выиграл ".$nmn.".00 екр.','".time()."','6','0')"); - $i = 0; - while($i < count($u_w[0])) { - if($u_w[1][$u_w[0][$i]] > 0) { - $infu = mysql_fetch_array(mysql_query('SELECT + //Выделяем текущую игру, если её нет, то создаем новую + $gid = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruletka` WHERE (`end` = 0 OR `id` = "' . ((int)$_GET['id']) . '") ORDER BY `id` DESC LIMIT 1' + ) + ); + if ($gid['time_start'] + 16 > time() || isset($_GET['bet'])) { + $mnr = true; + } + $gid3 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruletka` WHERE `end` >0 AND `id` = "' . ((int)$_GET['id']) . '" ORDER BY `id` DESC LIMIT 1' + ) + ); + if (isset($gid3['id'])) { + $gid = $gid3; + unset($gid3); + } + $add = false; + if (isset($gid['id'])) { + //Игра существует, проверяем + $time = $gid['time_start'] - time(); + if ($time < 1) { + //крутим колесо и заканчиваем игру + выдаем выйгрыш + //mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$gid['id'].'" LIMIT 1'); + //выводим предыдущий выйгрыш + $win[0] = $gid['win']; + $win[1] = $gid['win_line']; + $win[2] = 0; + $win[3] = 0; + if ($gid['end'] == 0) { + $add = true; + } + } else { + //ожидаем начала игры, делаем ставки + if (isset($_GET['bet'])) { + $bt = $_GET['bet']; + $good = 0; + $i = 0; + while ($i <= 38) { + if ($i == $bt) { + $good++; + } + $i++; + } + + /* + Ставки и значения + + 1, ... ,36 - ставка на числа [x8] + + 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35 - черное [x2] + 1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36 - красное [x2] + + 37 - два нуля [x36] + 38 - ноль [x36] + + 1-2-3-37-38 - потолок [x5] + + 1-2-3-4-5-6-7-8-9-10-11-12 - 1 сектор [x3] + 13-14-15-16-17-18-19-20-21-22-23-24 - 2 сектор [x3] + 25-26-27-28-29-30-31-32-33-34-35-36 - 3 сектор [x3] + + */ + + if ($bt == '' && $good == 0) { + $good++; + } elseif ($bt == '35-36' && $good == 0) { + $good++; + } elseif ($bt == '34-35' && $good == 0) { + $good++; + } elseif ($bt == '32-33' && $good == 0) { + $good++; + } elseif ($bt == '31-32' && $good == 0) { + $good++; + } elseif ($bt == '29-30' && $good == 0) { + $good++; + } elseif ($bt == '28-29' && $good == 0) { + $good++; + } elseif ($bt == '26-27' && $good == 0) { + $good++; + } elseif ($bt == '25-26' && $good == 0) { + $good++; + } elseif ($bt == '23-24' && $good == 0) { + $good++; + } elseif ($bt == '22-23' && $good == 0) { + $good++; + } elseif ($bt == '20-21' && $good == 0) { + $good++; + } elseif ($bt == '19-20' && $good == 0) { + $good++; + } elseif ($bt == '17-18' && $good == 0) { + $good++; + } elseif ($bt == '16-17' && $good == 0) { + $good++; + } elseif ($bt == '14-15' && $good == 0) { + $good++; + } elseif ($bt == '13-14' && $good == 0) { + $good++; + } elseif ($bt == '11-12' && $good == 0) { + $good++; + } elseif ($bt == '10-11' && $good == 0) { + $good++; + } elseif ($bt == '8-9' && $good == 0) { + $good++; + } elseif ($bt == '7-8' && $good == 0) { + $good++; + } elseif ($bt == '5-6' && $good == 0) { + $good++; + } elseif ($bt == '4-5' && $good == 0) { + $good++; + } elseif ($bt == '2-3' && $good == 0) { + $good++; + } elseif ($bt == '1-2' && $good == 0) { + $good++; + } elseif ($bt == '32-33-35-36' && $good == 0) { + $good++; + } elseif ($bt == '31-32-34-35' && $good == 0) { + $good++; + } elseif ($bt == '29-30-32-33' && $good == 0) { + $good++; + } elseif ($bt == '28-29-31-32' && $good == 0) { + $good++; + } elseif ($bt == '26-27-29-30' && $good == 0) { + $good++; + } elseif ($bt == '25-26-28-29' && $good == 0) { + $good++; + } elseif ($bt == '23-24-26-27' && $good == 0) { + $good++; + } elseif ($bt == '22-23-25-26' && $good == 0) { + $good++; + } elseif ($bt == '20-21-23-24' && $good == 0) { + $good++; + } elseif ($bt == '19-20-22-23' && $good == 0) { + $good++; + } elseif ($bt == '17-18-20-21' && $good == 0) { + $good++; + } elseif ($bt == '16-17-19-20' && $good == 0) { + $good++; + } elseif ($bt == '14-15-17-18' && $good == 0) { + $good++; + } elseif ($bt == '13-14-16-17' && $good == 0) { + $good++; + } elseif ($bt == '11-12-14-15' && $good == 0) { + $good++; + } elseif ($bt == '10-11-13-14' && $good == 0) { + $good++; + } elseif ($bt == '8-9-11-12' && $good == 0) { + $good++; + } elseif ($bt == '7-8-10-11' && $good == 0) { + $good++; + } elseif ($bt == '5-6-8-9' && $good == 0) { + $good++; + } elseif ($bt == '4-5-7-8' && $good == 0) { + $good++; + } elseif ($bt == '2-3-5-6' && $good == 0) { + $good++; + } elseif ($bt == '1-2-4-5' && $good == 0) { + $good++; + } elseif ($bt == '2-3-37' && $good == 0) { + $good++; + } elseif ($bt == '1-2-38' && $good == 0) { + $good++; + } elseif ($bt == '38-1' && $good == 0) { + $good++; + } elseif ($bt == '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36' && $good == 0) { + $good++; + } elseif ($bt == '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '28-29-30-31-32-33' && $good == 0) { + $good++; + } elseif ($bt == '22-23-24-25-26-27' && $good == 0) { + $good++; + } elseif ($bt == '16-17-18-19-20-21' && $good == 0) { + $good++; + } elseif ($bt == '10-11-12-13-14-15' && $good == 0) { + $good++; + } elseif ($bt == '4-5-6-7-8-9' && $good == 0) { + $good++; + } elseif ($bt == '31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27-28-29-30' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21-22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15-16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '7-8-9-10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6' && $good == 0) { + $good++; + } elseif ($bt == '34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '31-32-33' && $good == 0) { + $good++; + } elseif ($bt == '28-29-30' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27' && $good == 0) { + $good++; + } elseif ($bt == '22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21' && $good == 0) { + $good++; + } elseif ($bt == '16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15' && $good == 0) { + $good++; + } elseif ($bt == '10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '7-8-9' && $good == 0) { + $good++; + } elseif ($bt == '6-5-4' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3' && $good == 0) { + $good++; + } elseif ($bt == '3-6-9-12-15-18-21-24-27-30-33-36' && $good == 0) { + $good++; + } elseif ($bt == '2-5-8-11-14-17-20-23-26-29-32-35' && $good == 0) { + $good++; + } elseif ($bt == '1-4-7-10-13-16-19-22-25-28-31-34' && $good == 0) { + $good++; + } elseif ($bt == '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35' && $good == 0) { + $good++; + } elseif ($bt == '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-37-38' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15-16-17-18-19-20-21-22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-4-5' && $good == 0) { + $good++; + } + $_GET['coin'] = (int)$_GET['coin']; + if ($_GET['coin'] < 1) { + $good = 0; + } + if ($_GET['coin'] > $u->bank['money2']) { + $good = 0; + } + if ($good == 1) { + $u->bank['money2'] -= ((int)$_GET['coin']); + + $stvka = ''; + + if ($stvka == '') { + $stvka = 'неизвестная зона ставки'; + } + + + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','','[Крупье] Игрок " . mysql_real_escape_string( + $u->info['login'] + ) . " сделал ставку: " . (0 + ((int)$_GET['coin'])) . ".00 екр. на " . $stvka . ", игра №" . $gid['id'] . "','" . time( + ) . "','6','0')" + ); + + + mysql_query( + 'UPDATE `bank` SET `money2` = ' . $u->bank['money2'] . ' WHERE `id` = "' . $u->bank['id'] . '" LIMIT 1' + ); + mysql_query( + 'INSERT INTO `ruletka_coin` (`uid`,`login`,`money`,`time`,`game_id`,`win2`) VALUES ("' . $u->info['id'] . '","' . $u->info['login'] . '","' . $_GET['coin'] . '","' . time( + ) . '","' . $gid['id'] . '","' . $bt . '")' + ); + } + } + } + } else { + $add = true; + } + + //обновляем ставки + $pos = [ + 0 => '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35', + 1 => '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36', + 2 => '1-2-3-37-38', + 3 => '1-2-3-4-5-6-7-8-9-10-11-12', + 4 => '13-14-15-16-17-18-19-20-21-22-23-24', + 5 => '25-26-27-28-29-30-31-32-33-34-35-36', + 6 => '1-4-7-10-13-16-19-22-25-28-31-34', + 7 => '2-5-8-11-14-17-20-23-26-29-32-35', + 8 => '3-6-9-12-15-18-21-24-27-30-33-36', + 9 => '1-2-3', + 10 => '6-5-4', + 11 => '7-8-9', + 12 => '10-11-12', + 13 => '13-14-15', + 14 => '16-17-18', + 15 => '19-20-21', + 16 => '22-23-24', + 17 => '25-26-27', + 18 => '28-29-30', + 19 => '31-32-33', + 20 => '34-35-36', + 21 => '1-2-3-4-5-6', + 22 => '7-8-9-10-11-12', + 23 => '13-14-15-16-17-18', + 24 => '19-20-21-22-23-24', + 25 => '25-26-27-28-29-30', + 26 => '31-32-33-34-35-36', + 27 => '4-5-6-7-8-9', + 28 => '10-11-12-13-14-15', + 29 => '16-17-18-19-20-21', + 30 => '22-23-24-25-26-27', + 31 => '28-29-30-31-32-33', + 32 => '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18', + 33 => '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36', + 34 => '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35', + 35 => '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36', + 36 => '38-1', + 37 => '1-2-38', + 38 => '2-3-37', + 39 => '32-33-35-36', + 40 => '31-32-34-35', + 41 => '29-30-32-33', + 42 => '28-29-31-32', + 43 => '26-27-29-30', + 44 => '25-26-28-29', + 45 => '23-24-26-27', + 46 => '22-23-25-26', + 47 => '20-21-23-24', + 48 => '19-20-22-23', + 49 => '17-18-20-21', + 50 => '16-17-19-20', + 51 => '14-15-17-18', + 52 => '13-14-16-17', + 53 => '11-12-14-15', + 54 => '10-11-13-14', + 55 => '8-9-11-12', + 56 => '7-8-10-11', + 57 => '5-6-8-9', + 58 => '4-5-7-8', + 59 => '2-3-5-6', + 60 => '1-2-4-5', + 61 => '1-2', + 62 => '2-3', + 63 => '4-5', + 64 => '5-6', + 65 => '7-8', + 66 => '8-9', + 67 => '10-11', + 68 => '11-12', + 69 => '13-14', + 70 => '14-15', + 71 => '16-17', + 72 => '17-18', + 73 => '19-20', + 74 => '20-21', + 75 => '22-23', + 76 => '23-24', + 77 => '25-26', + 78 => '26-27', + 79 => '28-29', + 80 => '29-30', + 81 => '31-32', + 82 => '32-33', + 83 => '34-35', + 84 => '35-36', + ]; + + function testCoin($s, $stt) + { + global $u, $win; + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` != "' . $u->info['id'] . '"' + ); + $cr = 0; + $am = 0; + $usr = ''; + $lu = []; + while ($pl = mysql_fetch_array($sp)) { + $cr = $pl['money']; + if (!isset($lu[$pl['uid']]) && count($lu) < 4) { + $usr .= '-' . $pl['money']; + $lu[$pl['uid']] = true; + } + $am++; + } + $us = 0; //Ставка игрока + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $cr = $pl['money']; + $us += $pl['money']; + $am++; + } + $i = 0; + while ($i < 4) { + if ($i > count($lu)) { + $usr .= '-0'; + } + $i++; + } + if ($am > 0) { + $win[4] .= $stt . '|' . $cr . '-' . $us . '' . $usr . ','; + } + } + + //ставки на числа + $i = 1; + while ($i <= 38) { + testCoin($gid['id'], $i); + $i++; + } + //комбинированные ставки + $i = 0; + while ($i < count($pos)) { + testCoin($gid['id'], $pos[$i]); + $i++; + } + + if ($add) { + //создаем новую игру + $gid2 = ['id' => 0, 'room' => $u->info['room'], 'time' => time(), 'time_start' => time() + 74, 'win' => floor( + rand(100, 3800) / 100 + ), 'win_line' => '', 'end' => 0]; + $s37 = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `ruletka` WHERE `win` = "37" OR `win` = "38" AND `time` > "' . (time() - round( + 3600 / 10000 * rand(5000, 10000) + )) . '" LIMIT 1' + ) + ); + if (isset($s37['id'])) { + $gid2['win'] = floor(rand(100, 3600) / 100); + } + $ins = mysql_query( + 'INSERT INTO `ruletka` (`room`,`time`,`time_start`,`win`,`win_line`) VALUES ("' . $gid2['room'] . '","' . $gid2['time'] . '","' . $gid2['time_start'] . '","' . $gid2['win'] . '","' . $gid2['win_line'] . '")' + ); + $gid2['id'] = mysql_insert_id(); + if ($ins) { + $gid = $gid2; + } + unset($gid2); + } + + $u_w = [0 => [], 1 => [], 2 => [], 3 => []]; + + $sm = $u->testAction('`city` = "' . $u->info['city'] . '" AND `vars` = "casino_balance" LIMIT 1', 1); + if (!isset($sm['id'])) { + $u->addAction(time(), 'casino_balance', 0); + } + + //обновляем выйгрыши + $sp = mysql_query('SELECT * FROM `ruletka` WHERE `end` = "0" AND `time_start` <= ' . time() . ''); + while ($pl = mysql_fetch_array($sp)) { + $end = mysql_query('UPDATE `ruletka` SET `end` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + if ($end) { + //выдаем выйгрышь + $sp2 = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `game_id` = "' . $pl['id'] . '"'); + while ($pl2 = mysql_fetch_array($sp2)) { + $upd = mysql_query( + 'UPDATE `ruletka_coin` SET `end` = "' . time() . '" WHERE `id` = "' . $pl2['id'] . '" LIMIT 1' + ); + if ($upd) { + $wn = 0; + $wn2 = 0; + $xv = 2; + if ($pl2['win2'] == $pl['win']) { + $wn++; + } else { + $i = 0; + $j = explode('-', $pl2['win2']); + $xv = floor(1 + 34 / count($j)); + while ($i < count($j)) { + if ($j[$i] == $pl['win']) { + $wn2++; + } + $i++; + } + } + + if ($wn > 0) { + //перечисляем деньги [x8], если зеро то [x36] + if ($pl['win'] > 36) { + $nmn = ((int)$pl2['money'] * 35); + } else { + $nmn = ((int)$pl2['money'] * 35); + } + mysql_query( + 'UPDATE `bank` SET `money2` = `money2` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1' + ); + } elseif ($wn2 > 0) { + //перечисляем деньги по определенной формуле + $nmn = ((int)$pl2['money'] * $xv); + mysql_query( + 'UPDATE `bank` SET `money2` = `money2` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1' + ); + } else { + //проиграли + mysql_query('UPDATE `ruletka_coin` SET `end` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string( + 0 + $pl2['money'] + ) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1' + ); + } + + if ($wn > 0 || $wn2 > 0) { + $u->addDelo( + 1, $pl2['uid'], + '"Casino.' . $u->info['city'] . '": Выиграл ' . $nmn . ' еекр.', + time(), $u->info['city'], 'Casino.' . $u->info['city'] . '', 0, 0 + ); + if (!isset($u_w[1][$pl2['uid']])) { + $u_w[0][count($u_w[0])] = $pl2['uid']; + $u_w[2][count($u_w[0]) - 1] = $pl2['game_id']; + } + $u_w[1][$pl2['uid']] += (int)$nmn; + } + $u_w[3][$pl2['uid']] += (int)$pl2['money']; + + } + } + } + } + + if (count($u_w[0]) > 0) { + $i = 0; + while ($i < count($u_w[0])) { + if ($u_w[1][$u_w[0][$i]] > 0) { + $infu = mysql_fetch_array( + mysql_query( + 'SELECT `u`.`id`, `u`.`align`, `u`.`login`, @@ -668,56 +632,63 @@ if($u->room['name']!=' `u`.`online`, `u`.`sex`, `u`.`cityreg` - FROM `users` AS `u` WHERE `u`.`id`="'.mysql_real_escape_string($u_w[0][$i]).'" LIMIT 1')); - - mysql_query('UPDATE `actions` SET `vals` = `vals` + "'.mysql_real_escape_string((0+$u_w[3][$u_w[0][$i]])-$u_w[1][$u_w[0][$i]]).'" WHERE `id` = "'.$sm['id'].'" LIMIT 1'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','389','','','[Крупье] Игрок ".mysql_real_escape_string($infu['login'])." выиграл ".$u_w[1][$u_w[0][$i]].".00 еекр., ставка: ".(0+$u_w[3][$u_w[0][$i]]).".00 еекр., игра №".$u_w[2][$i]."','".time()."','6','0')"); - } - $i++; - } - } - - if(isset($gid['id'])) - { - if($time<0) - { - $time = 0; - } - //Выбираем статус игры - if($time>0) - { - //делаем ставки - $status = 1; - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `uid` = "'.$u->info['id'].'" AND `game_id` = "'.$gid['id'].'"'); - $win[3] = 0; - while($pl = mysql_fetch_array($sp)) - { - $win[3] += $pl['money']; - } - }else{ - //играем - $status = 2; - //выводим выйгрыш + ставку - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` > "0" AND `uid` = "'.$u->info['id'].'" AND `game_id` = "'.$gid['id'].'"'); - $win[2] = 0; - while($pl = mysql_fetch_array($sp)) - { - $win[2] += $pl['money']; - $win[3] += $pl['money']; - $win[1] += $pl['money']; - } - } - if($win[0]>0) - { - unset($mnr); - } - if(isset($mnr)) - { - $mnr = '&cash='.floor(0+$u->bank['money2']); - } - $r = 'time='.$time.'&game='.$gid['id'].''.$mnr.'&betsum='.$win[3].'&status='.$status.'&players='.$win[5].'&bets='.$win[4].'&win='.$win[0].'&wbets='.$win[1].'&wmoney='.$win[2].''; - echo $r; - } + FROM `users` AS `u` WHERE `u`.`id`="' . mysql_real_escape_string($u_w[0][$i]) . '" LIMIT 1' + ) + ); + + mysql_query( + 'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string( + (0 + $u_w[3][$u_w[0][$i]]) - $u_w[1][$u_w[0][$i]] + ) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1' + ); + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','389','','','[Крупье] Игрок " . mysql_real_escape_string( + $infu['login'] + ) . " выиграл " . $u_w[1][$u_w[0][$i]] . ".00 еекр., ставка: " . (0 + $u_w[3][$u_w[0][$i]]) . ".00 еекр., игра №" . $u_w[2][$i] . "','" . time( + ) . "','6','0')" + ); + } + $i++; + } + } + + if (isset($gid['id'])) { + if ($time < 0) { + $time = 0; + } + //Выбираем статус игры + if ($time > 0) { + //делаем ставки + $status = 1; + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"' + ); + $win[3] = 0; + while ($pl = mysql_fetch_array($sp)) { + $win[3] += $pl['money']; + } + } else { + //играем + $status = 2; + //выводим выйгрыш + ставку + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `end` > "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"' + ); + $win[2] = 0; + while ($pl = mysql_fetch_array($sp)) { + $win[2] += $pl['money']; + $win[3] += $pl['money']; + $win[1] += $pl['money']; + } + } + if ($win[0] > 0) { + unset($mnr); + } + if (isset($mnr)) { + $mnr = '&cash=' . floor(0 + $u->bank['money2']); + } + $r = 'time=' . $time . '&game=' . $gid['id'] . '' . $mnr . '&betsum=' . $win[3] . '&status=' . $status . '&players=' . $win[5] . '&bets=' . $win[4] . '&win=' . $win[0] . '&wbets=' . $win[1] . '&wmoney=' . $win[2] . ''; + echo $r; + } } -//mysql_query('UNLOCK TABLES'); -?> \ No newline at end of file + diff --git a/ruletka2.php b/ruletka2.php index 19e23b4e..f7aff6d1 100644 --- a/ruletka2.php +++ b/ruletka2.php @@ -1,662 +1,646 @@ bank['id'])) { - //die(); +if ($u->info['level'] <= 7) { + die(''); } - if($u->info['level'] <= 7 ) { - die(''); - } - - mysql_query("LOCK TABLES +mysql_query( + "LOCK TABLES `actions` WRITE, `bank` WRITE, - `users` WRITE, `users_delo` WRITE, - `chat` WRITE, - `stats` WRITE, - `ruletka` WRITE, `ruletka_coin` WRITE, - - `bandit` WRITE;"); + `bandit` WRITE;" +); + +/* +33|2-0-0-0-2-0, +32|4-0-0-0-4-6, +11|4-0-0-42-4-0, +21|2-0-0-0-2-0, +2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35|8-0-8-0-0-0, +7|4-0-0-0-4-0, +2|4-0-0-0-4-0, +17|4-0-0-4-4-0, +1|6-0-0-0-0-6, +18|4-0-0-0-4-0, +30|4-0-0-6-4-6, +16|4-0-0-0-4-0, +13|4-0-0-0-4-0, +25|6-0-0-0-0-6, +27|2-0-0-0-2-0, +36|2-0-0-0-2-0, +3|4-0-0-0-4-0, +20|4-0-0-0-4-0, +8|8-0-0-16-4-0, +38|2-0-0-0-2-6, +4|8-0-0-16-0-0, +34|4-0-0-0-4-0, +37|1-0-0-0-4-7, +19|2-0-0-0-2-0, +10|4-0-0-10-2-0, +31|6-0-0-6-4-0 +*/ + +if ($u->room['name'] != 'Рулетка') { + die(); +} else { + + //Раздаем выйгрыши - /* - 33|2-0-0-0-2-0, - 32|4-0-0-0-4-6, - 11|4-0-0-42-4-0, - 21|2-0-0-0-2-0, - 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35|8-0-8-0-0-0, - 7|4-0-0-0-4-0, - 2|4-0-0-0-4-0, - 17|4-0-0-4-4-0, - 1|6-0-0-0-0-6, - 18|4-0-0-0-4-0, - 30|4-0-0-6-4-6, - 16|4-0-0-0-4-0, - 13|4-0-0-0-4-0, - 25|6-0-0-0-0-6, - 27|2-0-0-0-2-0, - 36|2-0-0-0-2-0, - 3|4-0-0-0-4-0, - 20|4-0-0-0-4-0, - 8|8-0-0-16-4-0, - 38|2-0-0-0-2-6, - 4|8-0-0-16-0-0, - 34|4-0-0-0-4-0, - 37|1-0-0-0-4-7, - 19|2-0-0-0-2-0, - 10|4-0-0-10-2-0, - 31|6-0-0-6-4-0 - */ + function get2str($key = '', $val = '') + { + $get = $_GET; + if (is_array($key)) { + if (count($key) > 0) { + foreach ($key as $k => $v) { + $get[$k] = $v; + } + } + } else { + $get[$key] = $val; + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + if (empty($v)) { + unset($get[$k]); + } + } + } + if (count($get) > 0) { + foreach ($get as $k => $v) { + $get[$k] = $k . '=' . urlencode($v); + } + return '?' . implode('&', $get); + } + } -if($u->room['name']!='Рулетка') -{ - die(); -}else{ - - //Раздаем выйгрыши - - - function get2str($key='', $val='') { - $get = $_GET; - if ( is_array($key) ) { - if ( count($key)>0 ) foreach ( $key as $k=>$v ) $get[$k] = $v; - } else $get[$key] = $val; - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) if ( empty($v) ) unset($get[$k]); - } - if ( count($get)>0 ) { - foreach ( $get as $k=>$v ) $get[$k] = $k.'='.urlencode($v); - return '?'.implode('&', $get); - } - } + $r = ''; + $time = 74; //сек до новой игры + $status = 0; //статус игры, 2 - крутим колесо + $win = [ + 0 => 0, //число выйгрыша + 1 => '', //линии выйгрыша + 2 => 0, //сумма выйгрыша + 3 => 0, //ставка на эту игру текущего игрока + //ставки + 4 => '', + //игроки которые делали ставки + 5 => '', + ]; - $r = ''; - $time = 74; //сек до новой игры - $status = 0; //статус игры, 2 - крутим колесо - $win = array( - 0 => 0, //число выйгрыша - 1 => '', //линии выйгрыша - 2 => 0, //сумма выйгрыша - 3 => 0, //ставка на эту игру текущего игрока - //ставки - 4 => '', - //игроки которые делали ставки - 5 => '' - ); - - //Выделяем текущую игру, если её нет, то создаем новую - $gid = mysql_fetch_array(mysql_query('SELECT * FROM `ruletka` WHERE (`end` = 0 OR `id` = "'.((int)$_GET['id']).'") ORDER BY `id` DESC LIMIT 1')); - if($gid['time_start']+16>time() || isset($_GET['bet'])) - { - $mnr = true; - } - $gid3 = mysql_fetch_array(mysql_query('SELECT * FROM `ruletka` WHERE `end` >0 AND `id` = "'.((int)$_GET['id']).'" ORDER BY `id` DESC LIMIT 1')); - if(isset($gid3['id'])) - { - $gid = $gid3; - unset($gid3); - } - $add = false; - if(isset($gid['id'])) - { - //Игра существует, проверяем - $time = $gid['time_start']-time(); - if($time<1) - { - //крутим колесо и заканчиваем игру + выдаем выйгрыш - //mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$gid['id'].'" LIMIT 1'); - //выводим предыдущий выйгрыш - $win[0] = $gid['win']; - $win[1] = $gid['win_line']; - $win[2] = 0; - $win[3] = 0; - if($gid['end']==0) - { - $add = true; - } - }else{ - //ожидаем начала игры, делаем ставки - if(isset($_GET['bet'])) - { - $bt = $_GET['bet']; - $good = 0; - $i = 0; - while($i<=38) - { - if($i==$bt) - { - $good++; - } - $i++; - } - - /* - Ставки и значения - - 1, ... ,36 - ставка на числа [x8] - - 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35 - черное [x2] - 1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36 - красное [x2] - - 37 - два нуля [x36] - 38 - ноль [x36] - - 1-2-3-37-38 - потолок [x5] - - 1-2-3-4-5-6-7-8-9-10-11-12 - 1 сектор [x3] - 13-14-15-16-17-18-19-20-21-22-23-24 - 2 сектор [x3] - 25-26-27-28-29-30-31-32-33-34-35-36 - 3 сектор [x3] - - */ - - if($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '' && $good == 0 ) { - $good++; - }elseif($bt == '35-36' && $good == 0 ) { - $good++; - }elseif($bt == '34-35' && $good == 0 ) { - $good++; - }elseif($bt == '32-33' && $good == 0 ) { - $good++; - }elseif($bt == '31-32' && $good == 0 ) { - $good++; - }elseif($bt == '29-30' && $good == 0 ) { - $good++; - }elseif($bt == '28-29' && $good == 0 ) { - $good++; - }elseif($bt == '26-27' && $good == 0 ) { - $good++; - }elseif($bt == '25-26' && $good == 0 ) { - $good++; - }elseif($bt == '23-24' && $good == 0 ) { - $good++; - }elseif($bt == '22-23' && $good == 0 ) { - $good++; - }elseif($bt == '20-21' && $good == 0 ) { - $good++; - }elseif($bt == '19-20' && $good == 0 ) { - $good++; - }elseif($bt == '17-18' && $good == 0 ) { - $good++; - }elseif($bt == '16-17' && $good == 0 ) { - $good++; - }elseif($bt == '14-15' && $good == 0 ) { - $good++; - }elseif($bt == '13-14' && $good == 0 ) { - $good++; - }elseif($bt == '11-12' && $good == 0 ) { - $good++; - }elseif($bt == '10-11' && $good == 0 ) { - $good++; - }elseif($bt == '8-9' && $good == 0 ) { - $good++; - }elseif($bt == '7-8' && $good == 0 ) { - $good++; - }elseif($bt == '5-6' && $good == 0 ) { - $good++; - }elseif($bt == '4-5' && $good == 0 ) { - $good++; - }elseif($bt == '2-3' && $good == 0 ) { - $good++; - }elseif($bt == '1-2' && $good == 0 ) { - $good++; - }elseif($bt == '32-33-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-34-35' && $good == 0 ) { - $good++; - }elseif($bt == '29-30-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-31-32' && $good == 0 ) { - $good++; - }elseif($bt == '26-27-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-28-29' && $good == 0 ) { - $good++; - }elseif($bt == '23-24-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-25-26' && $good == 0 ) { - $good++; - }elseif($bt == '20-21-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-22-23' && $good == 0 ) { - $good++; - }elseif($bt == '17-18-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-19-20' && $good == 0 ) { - $good++; - }elseif($bt == '14-15-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-16-17' && $good == 0 ) { - $good++; - }elseif($bt == '11-12-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-13-14' && $good == 0 ) { - $good++; - }elseif($bt == '8-9-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-10-11' && $good == 0 ) { - $good++; - }elseif($bt == '5-6-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '4-5-7-8' && $good == 0 ) { - $good++; - }elseif($bt == '2-3-5-6' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-4-5' && $good == 0 ) { - $good++; - }elseif($bt == '2-3-37' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-38' && $good == 0 ) { - $good++; - }elseif($bt == '38-1' && $good == 0 ) { - $good++; - }elseif($bt == '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36' && $good == 0 ) { - $good++; - }elseif($bt == '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-30-31-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-24-25-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-18-19-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-12-13-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '4-5-6-7-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-33-34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-27-28-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21-22-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-15-16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-9-10-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3-4-5-6' && $good == 0 ) { - $good++; - }elseif($bt == '34-35-36' && $good == 0 ) { - $good++; - }elseif($bt == '31-32-33' && $good == 0 ) { - $good++; - }elseif($bt == '28-29-30' && $good == 0 ) { - $good++; - }elseif($bt == '25-26-27' && $good == 0 ) { - $good++; - }elseif($bt == '22-23-24' && $good == 0 ) { - $good++; - }elseif($bt == '19-20-21' && $good == 0 ) { - $good++; - }elseif($bt == '16-17-18' && $good == 0 ) { - $good++; - }elseif($bt == '13-14-15' && $good == 0 ) { - $good++; - }elseif($bt == '10-11-12' && $good == 0 ) { - $good++; - }elseif($bt == '7-8-9' && $good == 0 ) { - $good++; - }elseif($bt == '6-5-4' && $good == 0 ) { - $good++; - }elseif($bt == '1-2-3' && $good == 0 ) { - $good++; - }elseif($bt == '3-6-9-12-15-18-21-24-27-30-33-36' && $good == 0 ) { - $good++; - }elseif($bt == '2-5-8-11-14-17-20-23-26-29-32-35' && $good == 0 ) { - $good++; - }elseif($bt == '1-4-7-10-13-16-19-22-25-28-31-34' && $good == 0 ) { - $good++; - }elseif($bt == '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35' && $good==0) - { - $good++; - }elseif($bt == '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36' && $good==0) - { - $good++; - }elseif($bt == '1-2-3-37-38' && $good==0) - { - $good++; - }elseif($bt == '1-2-3-4-5-6-7-8-9-10-11-12' && $good==0) - { - $good++; - }elseif($bt == '13-14-15-16-17-18-19-20-21-22-23-24' && $good==0) - { - $good++; - }elseif($bt == '25-26-27-28-29-30-31-32-33-34-35-36' && $good==0) - { - $good++; - }elseif($bt == '1-2-4-5' && $good==0) - { - $good++; - } - $_GET['coin'] = (int)$_GET['coin']; - if($_GET['coin']<1) - { - $good = 0; - } - if($_GET['coin']>$u->bank['money1']) - { - $good = 0; - } - if($good==1) - { - $u->bank['money1'] -= ((int)$_GET['coin']); - - $stvka = ''; - - if($stvka == '') { - $stvka = 'неизвестная зона ставки'; - } - - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','[Крупье] Игрок ".mysql_real_escape_string($u->info['login'])." сделал ставку: ".(0+((int)$_GET['coin'])).".00 кр. на ".$stvka.", игра №".$gid['id']."','".time()."','6','0')"); - - - mysql_query('UPDATE `bank` SET `money1` = '.$u->bank['money1'].' WHERE `id` = "'.$u->bank['id'].'" LIMIT 1'); - mysql_query('INSERT INTO `ruletka_coin` (`uid`,`login`,`money`,`time`,`game_id`,`win2`) VALUES ("'.$u->info['id'].'","'.$u->info['login'].'","'.$_GET['coin'].'","'.time().'","'.$gid['id'].'","'.$bt.'")'); - } - } - } - }else{ - $add = true; - } - - //обновляем ставки - $pos = array( - 0 => '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35', - 1 => '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36', - 2 => '1-2-3-37-38', - 3 => '1-2-3-4-5-6-7-8-9-10-11-12', - 4 => '13-14-15-16-17-18-19-20-21-22-23-24', - 5 => '25-26-27-28-29-30-31-32-33-34-35-36', - 6 => '1-4-7-10-13-16-19-22-25-28-31-34', - 7 => '2-5-8-11-14-17-20-23-26-29-32-35', - 8 => '3-6-9-12-15-18-21-24-27-30-33-36', - 9 => '1-2-3', - 10 => '6-5-4', - 11 => '7-8-9', - 12 => '10-11-12', - 13 => '13-14-15', - 14 => '16-17-18', - 15 => '19-20-21', - 16 => '22-23-24', - 17 => '25-26-27', - 18 => '28-29-30', - 19 => '31-32-33', - 20 => '34-35-36', - 21 => '1-2-3-4-5-6', - 22 => '7-8-9-10-11-12', - 23 => '13-14-15-16-17-18', - 24 => '19-20-21-22-23-24', - 25 => '25-26-27-28-29-30', - 26 => '31-32-33-34-35-36', - 27 => '4-5-6-7-8-9', - 28 => '10-11-12-13-14-15', - 29 => '16-17-18-19-20-21', - 30 => '22-23-24-25-26-27', - 31 => '28-29-30-31-32-33', - 32 => '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18', - 33 => '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36', - 34 => '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35', - 35 => '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36', - 36 => '38-1', - 37 => '1-2-38', - 38 => '2-3-37', - 39 => '32-33-35-36', - 40 => '31-32-34-35', - 41 => '29-30-32-33', - 42 => '28-29-31-32', - 43 => '26-27-29-30', - 44 => '25-26-28-29', - 45 => '23-24-26-27', - 46 => '22-23-25-26', - 47 => '20-21-23-24', - 48 => '19-20-22-23', - 49 => '17-18-20-21', - 50 => '16-17-19-20', - 51 => '14-15-17-18', - 52 => '13-14-16-17', - 53 => '11-12-14-15', - 54 => '10-11-13-14', - 55 => '8-9-11-12', - 56 => '7-8-10-11', - 57 => '5-6-8-9', - 58 => '4-5-7-8', - 59 => '2-3-5-6', - 60 => '1-2-4-5', - 61 => '1-2', - 62 => '2-3', - 63 => '4-5', - 64 => '5-6', - 65 => '7-8', - 66 => '8-9', - 67 => '10-11', - 68 => '11-12', - 69 => '13-14', - 70 => '14-15', - 71 => '16-17', - 72 => '17-18', - 73 => '19-20', - 74 => '20-21', - 75 => '22-23', - 76 => '23-24', - 77 => '25-26', - 78 => '26-27', - 79 => '28-29', - 80 => '29-30', - 81 => '31-32', - 82 => '32-33', - 83 => '34-35', - 84 => '35-36' - ); - - function testCoin($s,$stt) - { - global $u,$win; - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `game_id` = "'.$s.'" AND `money` > 0 AND `win2` = "'.$stt.'" AND `uid` != "'.$u->info['id'].'"'); - $cr = 0; $am = 0; - $usr = ''; $lu = array(); - while($pl = mysql_fetch_array($sp)) - { - $cr = $pl['money']; - if(!isset($lu[$pl['uid']]) && count($lu)<4) - { - $usr .= '-'.$pl['money']; - $lu[$pl['uid']] = true; - } - $am++; - } - $us = 0; //Ставка игрока - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `game_id` = "'.$s.'" AND `money` > 0 AND `win2` = "'.$stt.'" AND `uid` = "'.$u->info['id'].'" LIMIT 100'); - while($pl = mysql_fetch_array($sp)) - { - $cr = $pl['money']; - $us += $pl['money']; - $am++; - } - $i = 0; - while($i<4) - { - if($i > count($lu)) - { - $usr .= '-0'; - } - $i++; - } - if($am>0) - { - $win[4] .= $stt.'|'.$cr.'-'.$us.''.$usr.','; - } - } - - //ставки на числа - $i = 1; - while($i<=38) - { - testCoin($gid['id'],$i); - $i++; - } - //комбинированные ставки - $i = 0; - while($i0,'room'=>$u->info['room'],'time'=>time(),'time_start'=>time()+74,'win'=>floor(rand(100,3800)/100),'win_line'=>'','end'=>0); - $s37 = mysql_fetch_array(mysql_query('SELECT `id` FROM `ruletka` WHERE `win` = "37" OR `win` = "38" AND `time` > "'.(time()-round(3600/10000*rand(5000,10000))).'" LIMIT 1')); - if(isset($s37['id'])) { - $gid2['win'] = floor(rand(100,3600)/100); - } - $ins = mysql_query('INSERT INTO `ruletka` (`room`,`time`,`time_start`,`win`,`win_line`) VALUES ("'.$gid2['room'].'","'.$gid2['time'].'","'.$gid2['time_start'].'","'.$gid2['win'].'","'.$gid2['win_line'].'")'); - $gid2['id'] = mysql_insert_id(); - if($ins) - { - $gid = $gid2; - } - unset($gid2); - } - - $u_w = array(0=>array(),1=>array(),2=>array(),3=>array()); - - $sm = $u->testAction('`city` = "'.$u->info['city'].'" AND `vars` = "casino_balance" LIMIT 1',1); - if(!isset($sm['id'])) { - $u->addAction(time(),'casino_balance',0); - } - - //обновляем выйгрыши - $sp = mysql_query('SELECT * FROM `ruletka` WHERE `end` = "0" AND `time_start` <= '.time().''); - while($pl = mysql_fetch_array($sp)) - { - /*$pl['win'] = floor(rand(10000000,360000000)/10000000); - if( rand(0,1) == 1 ) { - $pl['win'] = floor(rand(10000000,360000000)/10000000); - } - if( rand(0,1) == 1 ) { - $pl['win'] = floor(rand(10000000,360000000)/10000000); - }*/ - $end = mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - if($end) - { - //выдаем выйгрышь - $sp2 = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `game_id` = "'.$pl['id'].'"'); - while($pl2 = mysql_fetch_array($sp2)) - { - $upd = mysql_query('UPDATE `ruletka_coin` SET `end` = "'.time().'" WHERE `id` = "'.$pl2['id'].'" LIMIT 1'); - if($upd) - { - $wn = 0; $wn2 = 0; - $xv = 2; - if($pl2['win2']==$pl['win']) - { - $wn++; - }else{ - $i = 0; $j = explode('-',$pl2['win2']); - $xv = floor(1+34/count($j)); - while($i0) - { - //перечисляем деньги [x8], если зеро то [x36] - if($pl['win']>36) - { - $nmn = ((int)$pl2['money']*35); - }else{ - $nmn = ((int)$pl2['money']*35); - } - mysql_query('UPDATE `bank` SET `money1` = `money1` + "'.$nmn.'" WHERE `uid` = "'.$pl2['uid'].'" ORDER BY `useNow` DESC LIMIT 1'); - }elseif($wn2>0) - { - //перечисляем деньги по определенной формуле - $nmn = ((int)$pl2['money']*$xv); - mysql_query('UPDATE `bank` SET `money1` = `money1` + "'.$nmn.'" WHERE `uid` = "'.$pl2['uid'].'" ORDER BY `useNow` DESC LIMIT 1'); - }else{ - //проиграли - mysql_query('UPDATE `ruletka_coin` SET `end` = "1" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - mysql_query('UPDATE `actions` SET `vals` = `vals` + "'.mysql_real_escape_string(0+$pl2['money']).'" WHERE `id` = "'.$sm['id'].'" LIMIT 1'); - } - - if($wn > 0 || $wn2 > 0) { - $u->addDelo(1,$pl2['uid'],'"Casino.'.$u->info['city'].'": Выиграл '.$nmn.' екр.',time(),$u->info['city'],'Casino.'.$u->info['city'].'',0,0); - if(!isset($u_w[1][$pl2['uid']])) { - $u_w[0][count($u_w[0])] = $pl2['uid']; - $u_w[2][count($u_w[0])-1] = $pl2['game_id']; - } - $u_w[1][$pl2['uid']] += (int)$nmn; - } - $u_w[3][$pl2['uid']] += (int)$pl2['money']; - - } - } - } - } - - if(count($u_w[0]) > 0) { - //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$pl['city']."','225','Крупье','','Игрок ".$pl['login']." выиграл ".$nmn.".00 кр.','".time()."','6','0')"); - $i = 0; - while($i < count($u_w[0])) { - if($u_w[1][$u_w[0][$i]] > 0) { - $infu = mysql_fetch_array(mysql_query('SELECT + //Выделяем текущую игру, если её нет, то создаем новую + $gid = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruletka` WHERE (`end` = 0 OR `id` = "' . ((int)$_GET['id']) . '") ORDER BY `id` DESC LIMIT 1' + ) + ); + if ($gid['time_start'] + 16 > time() || isset($_GET['bet'])) { + $mnr = true; + } + $gid3 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `ruletka` WHERE `end` >0 AND `id` = "' . ((int)$_GET['id']) . '" ORDER BY `id` DESC LIMIT 1' + ) + ); + if (isset($gid3['id'])) { + $gid = $gid3; + unset($gid3); + } + $add = false; + if (isset($gid['id'])) { + //Игра существует, проверяем + $time = $gid['time_start'] - time(); + if ($time < 1) { + //крутим колесо и заканчиваем игру + выдаем выйгрыш + //mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$gid['id'].'" LIMIT 1'); + //выводим предыдущий выйгрыш + $win[0] = $gid['win']; + $win[1] = $gid['win_line']; + $win[2] = 0; + $win[3] = 0; + if ($gid['end'] == 0) { + $add = true; + } + } else { + //ожидаем начала игры, делаем ставки + if (isset($_GET['bet'])) { + $bt = $_GET['bet']; + $good = 0; + $i = 0; + while ($i <= 38) { + if ($i == $bt) { + $good++; + } + $i++; + } + + /* + Ставки и значения + + 1, ... ,36 - ставка на числа [x8] + + 2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35 - черное [x2] + 1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36 - красное [x2] + + 37 - два нуля [x36] + 38 - ноль [x36] + + 1-2-3-37-38 - потолок [x5] + + 1-2-3-4-5-6-7-8-9-10-11-12 - 1 сектор [x3] + 13-14-15-16-17-18-19-20-21-22-23-24 - 2 сектор [x3] + 25-26-27-28-29-30-31-32-33-34-35-36 - 3 сектор [x3] + + */ + + if ($bt == '' && $good == 0) { + $good++; + } elseif ($bt == '35-36' && $good == 0) { + $good++; + } elseif ($bt == '34-35' && $good == 0) { + $good++; + } elseif ($bt == '32-33' && $good == 0) { + $good++; + } elseif ($bt == '31-32' && $good == 0) { + $good++; + } elseif ($bt == '29-30' && $good == 0) { + $good++; + } elseif ($bt == '28-29' && $good == 0) { + $good++; + } elseif ($bt == '26-27' && $good == 0) { + $good++; + } elseif ($bt == '25-26' && $good == 0) { + $good++; + } elseif ($bt == '23-24' && $good == 0) { + $good++; + } elseif ($bt == '22-23' && $good == 0) { + $good++; + } elseif ($bt == '20-21' && $good == 0) { + $good++; + } elseif ($bt == '19-20' && $good == 0) { + $good++; + } elseif ($bt == '17-18' && $good == 0) { + $good++; + } elseif ($bt == '16-17' && $good == 0) { + $good++; + } elseif ($bt == '14-15' && $good == 0) { + $good++; + } elseif ($bt == '13-14' && $good == 0) { + $good++; + } elseif ($bt == '11-12' && $good == 0) { + $good++; + } elseif ($bt == '10-11' && $good == 0) { + $good++; + } elseif ($bt == '8-9' && $good == 0) { + $good++; + } elseif ($bt == '7-8' && $good == 0) { + $good++; + } elseif ($bt == '5-6' && $good == 0) { + $good++; + } elseif ($bt == '4-5' && $good == 0) { + $good++; + } elseif ($bt == '2-3' && $good == 0) { + $good++; + } elseif ($bt == '1-2' && $good == 0) { + $good++; + } elseif ($bt == '32-33-35-36' && $good == 0) { + $good++; + } elseif ($bt == '31-32-34-35' && $good == 0) { + $good++; + } elseif ($bt == '29-30-32-33' && $good == 0) { + $good++; + } elseif ($bt == '28-29-31-32' && $good == 0) { + $good++; + } elseif ($bt == '26-27-29-30' && $good == 0) { + $good++; + } elseif ($bt == '25-26-28-29' && $good == 0) { + $good++; + } elseif ($bt == '23-24-26-27' && $good == 0) { + $good++; + } elseif ($bt == '22-23-25-26' && $good == 0) { + $good++; + } elseif ($bt == '20-21-23-24' && $good == 0) { + $good++; + } elseif ($bt == '19-20-22-23' && $good == 0) { + $good++; + } elseif ($bt == '17-18-20-21' && $good == 0) { + $good++; + } elseif ($bt == '16-17-19-20' && $good == 0) { + $good++; + } elseif ($bt == '14-15-17-18' && $good == 0) { + $good++; + } elseif ($bt == '13-14-16-17' && $good == 0) { + $good++; + } elseif ($bt == '11-12-14-15' && $good == 0) { + $good++; + } elseif ($bt == '10-11-13-14' && $good == 0) { + $good++; + } elseif ($bt == '8-9-11-12' && $good == 0) { + $good++; + } elseif ($bt == '7-8-10-11' && $good == 0) { + $good++; + } elseif ($bt == '5-6-8-9' && $good == 0) { + $good++; + } elseif ($bt == '4-5-7-8' && $good == 0) { + $good++; + } elseif ($bt == '2-3-5-6' && $good == 0) { + $good++; + } elseif ($bt == '1-2-4-5' && $good == 0) { + $good++; + } elseif ($bt == '2-3-37' && $good == 0) { + $good++; + } elseif ($bt == '1-2-38' && $good == 0) { + $good++; + } elseif ($bt == '38-1' && $good == 0) { + $good++; + } elseif ($bt == '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36' && $good == 0) { + $good++; + } elseif ($bt == '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '28-29-30-31-32-33' && $good == 0) { + $good++; + } elseif ($bt == '22-23-24-25-26-27' && $good == 0) { + $good++; + } elseif ($bt == '16-17-18-19-20-21' && $good == 0) { + $good++; + } elseif ($bt == '10-11-12-13-14-15' && $good == 0) { + $good++; + } elseif ($bt == '4-5-6-7-8-9' && $good == 0) { + $good++; + } elseif ($bt == '31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27-28-29-30' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21-22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15-16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '7-8-9-10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6' && $good == 0) { + $good++; + } elseif ($bt == '34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '31-32-33' && $good == 0) { + $good++; + } elseif ($bt == '28-29-30' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27' && $good == 0) { + $good++; + } elseif ($bt == '22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '19-20-21' && $good == 0) { + $good++; + } elseif ($bt == '16-17-18' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15' && $good == 0) { + $good++; + } elseif ($bt == '10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '7-8-9' && $good == 0) { + $good++; + } elseif ($bt == '6-5-4' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3' && $good == 0) { + $good++; + } elseif ($bt == '3-6-9-12-15-18-21-24-27-30-33-36' && $good == 0) { + $good++; + } elseif ($bt == '2-5-8-11-14-17-20-23-26-29-32-35' && $good == 0) { + $good++; + } elseif ($bt == '1-4-7-10-13-16-19-22-25-28-31-34' && $good == 0) { + $good++; + } elseif ($bt == '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35' && $good == 0) { + $good++; + } elseif ($bt == '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-37-38' && $good == 0) { + $good++; + } elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12' && $good == 0) { + $good++; + } elseif ($bt == '13-14-15-16-17-18-19-20-21-22-23-24' && $good == 0) { + $good++; + } elseif ($bt == '25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) { + $good++; + } elseif ($bt == '1-2-4-5' && $good == 0) { + $good++; + } + $_GET['coin'] = (int)$_GET['coin']; + if ($_GET['coin'] < 1) { + $good = 0; + } + if ($_GET['coin'] > $u->bank['money1']) { + $good = 0; + } + if ($good == 1) { + $u->bank['money1'] -= ((int)$_GET['coin']); + + $stvka = ''; + + if ($stvka == '') { + $stvka = 'неизвестная зона ставки'; + } + + + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','','[Крупье] Игрок " . mysql_real_escape_string( + $u->info['login'] + ) . " сделал ставку: " . (0 + ((int)$_GET['coin'])) . ".00 кр. на " . $stvka . ", игра №" . $gid['id'] . "','" . time( + ) . "','6','0')" + ); + + + mysql_query( + 'UPDATE `bank` SET `money1` = ' . $u->bank['money1'] . ' WHERE `id` = "' . $u->bank['id'] . '" LIMIT 1' + ); + mysql_query( + 'INSERT INTO `ruletka_coin` (`uid`,`login`,`money`,`time`,`game_id`,`win2`) VALUES ("' . $u->info['id'] . '","' . $u->info['login'] . '","' . $_GET['coin'] . '","' . time( + ) . '","' . $gid['id'] . '","' . $bt . '")' + ); + } + } + } + } else { + $add = true; + } + + //обновляем ставки + $pos = [ + 0 => '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35', + 1 => '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36', + 2 => '1-2-3-37-38', + 3 => '1-2-3-4-5-6-7-8-9-10-11-12', + 4 => '13-14-15-16-17-18-19-20-21-22-23-24', + 5 => '25-26-27-28-29-30-31-32-33-34-35-36', + 6 => '1-4-7-10-13-16-19-22-25-28-31-34', + 7 => '2-5-8-11-14-17-20-23-26-29-32-35', + 8 => '3-6-9-12-15-18-21-24-27-30-33-36', + 9 => '1-2-3', + 10 => '6-5-4', + 11 => '7-8-9', + 12 => '10-11-12', + 13 => '13-14-15', + 14 => '16-17-18', + 15 => '19-20-21', + 16 => '22-23-24', + 17 => '25-26-27', + 18 => '28-29-30', + 19 => '31-32-33', + 20 => '34-35-36', + 21 => '1-2-3-4-5-6', + 22 => '7-8-9-10-11-12', + 23 => '13-14-15-16-17-18', + 24 => '19-20-21-22-23-24', + 25 => '25-26-27-28-29-30', + 26 => '31-32-33-34-35-36', + 27 => '4-5-6-7-8-9', + 28 => '10-11-12-13-14-15', + 29 => '16-17-18-19-20-21', + 30 => '22-23-24-25-26-27', + 31 => '28-29-30-31-32-33', + 32 => '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18', + 33 => '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36', + 34 => '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35', + 35 => '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36', + 36 => '38-1', + 37 => '1-2-38', + 38 => '2-3-37', + 39 => '32-33-35-36', + 40 => '31-32-34-35', + 41 => '29-30-32-33', + 42 => '28-29-31-32', + 43 => '26-27-29-30', + 44 => '25-26-28-29', + 45 => '23-24-26-27', + 46 => '22-23-25-26', + 47 => '20-21-23-24', + 48 => '19-20-22-23', + 49 => '17-18-20-21', + 50 => '16-17-19-20', + 51 => '14-15-17-18', + 52 => '13-14-16-17', + 53 => '11-12-14-15', + 54 => '10-11-13-14', + 55 => '8-9-11-12', + 56 => '7-8-10-11', + 57 => '5-6-8-9', + 58 => '4-5-7-8', + 59 => '2-3-5-6', + 60 => '1-2-4-5', + 61 => '1-2', + 62 => '2-3', + 63 => '4-5', + 64 => '5-6', + 65 => '7-8', + 66 => '8-9', + 67 => '10-11', + 68 => '11-12', + 69 => '13-14', + 70 => '14-15', + 71 => '16-17', + 72 => '17-18', + 73 => '19-20', + 74 => '20-21', + 75 => '22-23', + 76 => '23-24', + 77 => '25-26', + 78 => '26-27', + 79 => '28-29', + 80 => '29-30', + 81 => '31-32', + 82 => '32-33', + 83 => '34-35', + 84 => '35-36', + ]; + + function testCoin($s, $stt) + { + global $u, $win; + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` != "' . $u->info['id'] . '"' + ); + $cr = 0; + $am = 0; + $usr = ''; + $lu = []; + while ($pl = mysql_fetch_array($sp)) { + $cr = $pl['money']; + if (!isset($lu[$pl['uid']]) && count($lu) < 4) { + $usr .= '-' . $pl['money']; + $lu[$pl['uid']] = true; + } + $am++; + } + $us = 0; //Ставка игрока + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $cr = $pl['money']; + $us += $pl['money']; + $am++; + } + $i = 0; + while ($i < 4) { + if ($i > count($lu)) { + $usr .= '-0'; + } + $i++; + } + if ($am > 0) { + $win[4] .= $stt . '|' . $cr . '-' . $us . '' . $usr . ','; + } + } + + //ставки на числа + $i = 1; + while ($i <= 38) { + testCoin($gid['id'], $i); + $i++; + } + //комбинированные ставки + $i = 0; + while ($i < count($pos)) { + testCoin($gid['id'], $pos[$i]); + $i++; + } + + if ($add == true) { + //создаем новую игру + $gid2 = ['id' => 0, 'room' => $u->info['room'], 'time' => time(), 'time_start' => time() + 74, 'win' => floor( + rand(100, 3800) / 100 + ), 'win_line' => '', 'end' => 0]; + $s37 = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `ruletka` WHERE `win` = "37" OR `win` = "38" AND `time` > "' . (time() - round( + 3600 / 10000 * rand(5000, 10000) + )) . '" LIMIT 1' + ) + ); + if (isset($s37['id'])) { + $gid2['win'] = floor(rand(100, 3600) / 100); + } + $ins = mysql_query( + 'INSERT INTO `ruletka` (`room`,`time`,`time_start`,`win`,`win_line`) VALUES ("' . $gid2['room'] . '","' . $gid2['time'] . '","' . $gid2['time_start'] . '","' . $gid2['win'] . '","' . $gid2['win_line'] . '")' + ); + $gid2['id'] = mysql_insert_id(); + if ($ins) { + $gid = $gid2; + } + unset($gid2); + } + + $u_w = [0 => [], 1 => [], 2 => [], 3 => []]; + + $sm = $u->testAction('`city` = "' . $u->info['city'] . '" AND `vars` = "casino_balance" LIMIT 1', 1); + if (!isset($sm['id'])) { + $u->addAction(time(), 'casino_balance', 0); + } + + //обновляем выйгрыши + $sp = mysql_query('SELECT * FROM `ruletka` WHERE `end` = "0" AND `time_start` <= ' . time() . ''); + while ($pl = mysql_fetch_array($sp)) { + /*$pl['win'] = floor(rand(10000000,360000000)/10000000); + if( rand(0,1) == 1 ) { + $pl['win'] = floor(rand(10000000,360000000)/10000000); + } + if( rand(0,1) == 1 ) { + $pl['win'] = floor(rand(10000000,360000000)/10000000); + }*/ + $end = mysql_query('UPDATE `ruletka` SET `end` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + if ($end) { + //выдаем выйгрышь + $sp2 = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `game_id` = "' . $pl['id'] . '"'); + while ($pl2 = mysql_fetch_array($sp2)) { + $upd = mysql_query( + 'UPDATE `ruletka_coin` SET `end` = "' . time() . '" WHERE `id` = "' . $pl2['id'] . '" LIMIT 1' + ); + if ($upd) { + $wn = 0; + $wn2 = 0; + $xv = 2; + if ($pl2['win2'] == $pl['win']) { + $wn++; + } else { + $i = 0; + $j = explode('-', $pl2['win2']); + $xv = floor(1 + 34 / count($j)); + while ($i < count($j)) { + if ($j[$i] == $pl['win']) { + $wn2++; + } + $i++; + } + } + + if ($wn > 0) { + //перечисляем деньги [x8], если зеро то [x36] + if ($pl['win'] > 36) { + $nmn = ((int)$pl2['money'] * 35); + } else { + $nmn = ((int)$pl2['money'] * 35); + } + mysql_query( + 'UPDATE `bank` SET `money1` = `money1` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1' + ); + } elseif ($wn2 > 0) { + //перечисляем деньги по определенной формуле + $nmn = ((int)$pl2['money'] * $xv); + mysql_query( + 'UPDATE `bank` SET `money1` = `money1` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1' + ); + } else { + //проиграли + mysql_query('UPDATE `ruletka_coin` SET `end` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string( + 0 + $pl2['money'] + ) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1' + ); + } + + if ($wn > 0 || $wn2 > 0) { + $u->addDelo( + 1, $pl2['uid'], + '"Casino.' . $u->info['city'] . '": Выиграл ' . $nmn . ' екр.', + time(), $u->info['city'], 'Casino.' . $u->info['city'] . '', 0, 0 + ); + if (!isset($u_w[1][$pl2['uid']])) { + $u_w[0][count($u_w[0])] = $pl2['uid']; + $u_w[2][count($u_w[0]) - 1] = $pl2['game_id']; + } + $u_w[1][$pl2['uid']] += (int)$nmn; + } + $u_w[3][$pl2['uid']] += (int)$pl2['money']; + + } + } + } + } + + if (count($u_w[0]) > 0) { + //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$pl['city']."','225','Крупье','','Игрок ".$pl['login']." выиграл ".$nmn.".00 кр.','".time()."','6','0')"); + $i = 0; + while ($i < count($u_w[0])) { + if ($u_w[1][$u_w[0][$i]] > 0) { + $infu = mysql_fetch_array( + mysql_query( + 'SELECT `u`.`id`, `u`.`align`, `u`.`login`, @@ -666,56 +650,63 @@ if($u->room['name']!=' `u`.`online`, `u`.`sex`, `u`.`cityreg` - FROM `users` AS `u` WHERE `u`.`id`="'.mysql_real_escape_string($u_w[0][$i]).'" LIMIT 1')); - - mysql_query('UPDATE `actions` SET `vals` = `vals` + "'.mysql_real_escape_string((0+$u_w[3][$u_w[0][$i]])-$u_w[1][$u_w[0][$i]]).'" WHERE `id` = "'.$sm['id'].'" LIMIT 1'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','389','','','[Крупье] Игрок ".mysql_real_escape_string($infu['login'])." выиграл ".$u_w[1][$u_w[0][$i]].".00 екр., ставка: ".(0+$u_w[3][$u_w[0][$i]]).".00 екр., игра №".$u_w[2][$i]."','".time()."','6','0')"); - } - $i++; - } - } - - if(isset($gid['id'])) - { - if($time<0) - { - $time = 0; - } - //Выбираем статус игры - if($time>0) - { - //делаем ставки - $status = 1; - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `uid` = "'.$u->info['id'].'" AND `game_id` = "'.$gid['id'].'"'); - $win[3] = 0; - while($pl = mysql_fetch_array($sp)) - { - $win[3] += $pl['money']; - } - }else{ - //играем - $status = 2; - //выводим выйгрыш + ставку - $sp = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` > "0" AND `uid` = "'.$u->info['id'].'" AND `game_id` = "'.$gid['id'].'"'); - $win[2] = 0; - while($pl = mysql_fetch_array($sp)) - { - $win[2] += $pl['money']; - $win[3] += $pl['money']; - $win[1] += $pl['money']; - } - } - if($win[0]>0) - { - unset($mnr); - } - if(isset($mnr)) - { - $mnr = '&cash='.floor(0+$u->bank['money1']); - } - $r = 'time='.$time.'&game='.$gid['id'].''.$mnr.'&betsum='.$win[3].'&status='.$status.'&players='.$win[5].'&bets='.$win[4].'&win='.$win[0].'&wbets='.$win[1].'&wmoney='.$win[2].''; - echo $r; - } + FROM `users` AS `u` WHERE `u`.`id`="' . mysql_real_escape_string($u_w[0][$i]) . '" LIMIT 1' + ) + ); + + mysql_query( + 'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string( + (0 + $u_w[3][$u_w[0][$i]]) - $u_w[1][$u_w[0][$i]] + ) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1' + ); + mysql_query( + "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','389','','','[Крупье] Игрок " . mysql_real_escape_string( + $infu['login'] + ) . " выиграл " . $u_w[1][$u_w[0][$i]] . ".00 екр., ставка: " . (0 + $u_w[3][$u_w[0][$i]]) . ".00 екр., игра №" . $u_w[2][$i] . "','" . time( + ) . "','6','0')" + ); + } + $i++; + } + } + + if (isset($gid['id'])) { + if ($time < 0) { + $time = 0; + } + //Выбираем статус игры + if ($time > 0) { + //делаем ставки + $status = 1; + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"' + ); + $win[3] = 0; + while ($pl = mysql_fetch_array($sp)) { + $win[3] += $pl['money']; + } + } else { + //играем + $status = 2; + //выводим выйгрыш + ставку + $sp = mysql_query( + 'SELECT * FROM `ruletka_coin` WHERE `end` > "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"' + ); + $win[2] = 0; + while ($pl = mysql_fetch_array($sp)) { + $win[2] += $pl['money']; + $win[3] += $pl['money']; + $win[1] += $pl['money']; + } + } + if ($win[0] > 0) { + unset($mnr); + } + if (isset($mnr)) { + $mnr = '&cash=' . floor(0 + $u->bank['money1']); + } + $r = 'time=' . $time . '&game=' . $gid['id'] . '' . $mnr . '&betsum=' . $win[3] . '&status=' . $status . '&players=' . $win[5] . '&bets=' . $win[4] . '&win=' . $win[0] . '&wbets=' . $win[1] . '&wmoney=' . $win[2] . ''; + echo $r; + } } mysql_query('UNLOCK TABLES'); -?> \ No newline at end of file diff --git a/seasons.php b/seasons.php index c8883a09..e9d24802 100644 --- a/seasons.php +++ b/seasons.php @@ -1,260 +1,303 @@ \n"; var_dump($vars); echo "\n"; - if ($d) exit(); + if ($d) { + exit(); + } } -define('IP',GetRealIp()); -die(); +define('IP', GetRealIp()); + +die('off'); include('_incl_data/__config.php'); -define('GAME',true); +const GAME = true; include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__magic.php'); -include('_incl_data/class/__user.php'); -include('_incl_data/class/__filter_class.php'); -include('_incl_data/class/__quest.php'); -include('_incl_data/class/__seasons.php'); +$u = User::start(); +$filter = new Filter(); -if(isset($_GET['upi'])) { - $k = explode(',',$_GET['upi']); - $i = 0; - while( $i < count($k) ) { - // - $i1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($k[$i-1]).'" LIMIT 1')); - $i2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($k[$i]).'" LIMIT 1')); - $i3 = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.mysql_real_escape_string($k[$i+1]).'" LIMIT 1')); - if(isset($i2['id'])) { - //Проводим работу - if(isset($i3['id'])) { - //Добавляем апгрейд i2 -> i3 - $test = mysql_fetch_array(mysql_query('SELECT * FROM `items_upgrade` WHERE `iid` = "'.$i2['id'].'" AND `iup` = "'.$i3['id'].'" LIMIT 1')); - if(!isset($test['id'])) { - mysql_query('INSERT INTO `items_upgrade` (`iid`,`iup`,`price1`,`price2`) VALUES ( - "'.$i2['id'].'","'.$i3['id'].'","0","'.($i3['price2']-$i2['price2']).'" - )'); - echo '['.$i2['id'].']->['.$i3['id'].'] за '.($i3['price2']-$i2['price2']).'екр.
    '; - } - } - if(isset($i1['id']) || !isset($i3['id'])) { - //Удаляем i2 из магазина - echo '[Удаляем '.$i2['id'].' с прилавка]
    '; - mysql_query('UPDATE `items_shop` SET `kolvo` = 0 WHERE `item_id` = "'.$i2['id'].'"'); - } - } - // - $i++; - } -}else{ - die(); +if (isset($_GET['upi'])) { + $k = explode(',', $_GET['upi']); + $i = 0; + while ($i < count($k)) { + // + $i1 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($k[$i - 1]) . '" LIMIT 1' + ) + ); + $i2 = mysql_fetch_array( + mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($k[$i]) . '" LIMIT 1') + ); + $i3 = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($k[$i + 1]) . '" LIMIT 1' + ) + ); + if (isset($i2['id'])) { + //Проводим работу + if (isset($i3['id'])) { + //Добавляем апгрейд i2 -> i3 + $test = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `items_upgrade` WHERE `iid` = "' . $i2['id'] . '" AND `iup` = "' . $i3['id'] . '" LIMIT 1' + ) + ); + if (!isset($test['id'])) { + mysql_query( + 'INSERT INTO `items_upgrade` (`iid`,`iup`,`price1`,`price2`) VALUES ( + "' . $i2['id'] . '","' . $i3['id'] . '","0","' . ($i3['price2'] - $i2['price2']) . '" + )' + ); + echo '[' . $i2['id'] . ']->[' . $i3['id'] . '] за ' . ($i3['price2'] - $i2['price2']) . 'екр.
    '; + } + } + if (isset($i1['id']) || !isset($i3['id'])) { + //Удаляем i2 из магазина + echo '[Удаляем ' . $i2['id'] . ' с прилавка]
    '; + mysql_query('UPDATE `items_shop` SET `kolvo` = 0 WHERE `item_id` = "' . $i2['id'] . '"'); + } + } + // + $i++; + } +} else { + die(); } $tjs = ''; -//if( $u->info['admin'] == 0 ) { -// header('location: main.php'); -// die(); -//} - -if($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { - header('location: main.php'); - die(); +if ($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { + header('location: main.php'); + die(); } -/*if( !eregi("new-combats\.com", $_SERVER['HTTP_REFERER']) ) { - //die('Перезайдите в игру, сессия закрыта.
    last_page:%'.$_SERVER['HTTP_REFERER'].''); -}*/ - -if( $u->info['id'] == 1000001 ) { - $u->info['admin'] = 0; +if ($u->info['id'] == 1000001) { + $u->info['admin'] = 0; } #--------для общаги, и позже для почты -if($u->info['online'] < time()-60) -{ - $filter->setOnline($u->info['online'],$u->info['id'],0); - $u->onlineBonus(); - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); -}elseif($u->info['timeMain'] < time()-60) -{ - mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1"); +if ($u->info['online'] < time() - 60) { + $filter->setOnline($u->info['online'], $u->info['id']); + $u->onlineBonus(); + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); +} elseif ($u->info['timeMain'] < time() - 60) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( + ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); } -if(!isset($u->info['id']) || ($u->info['joinIP']==1 && $u->info['ip']!=$_SERVER['HTTP_X_REAL_IP']) || $u->info['banned']>0) -{ - die($c['exit']); +if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']) || $u->info['banned'] > 0) { + die($c['exit']); } /* */ $rz = 1; -if( isset($_GET['rz']) ) { - if( $_GET['rz'] == 2 ) { - $rz = 2; - } +if (isset($_GET['rz'])) { + if ($_GET['rz'] == 2) { + $rz = 2; + } } /* */ -season::$date['Y'] = date('Y'); -season::$date['m'] = date('m'); -season::$date['d'] = date('d'); -season::$yy = season::$yy[season::$date['m']]; +Season::$date['Y'] = date('Y'); +Season::$date['m'] = date('m'); +Season::$date['d'] = date('d'); +Season::$yy = Season::$yy[Season::$date['m']]; ?> - - - - - - - + + + + + + + - -

    сезон,

    - - - - + + +

    сезон,

    +
    - - season::$date['d'] ) { - //Миссия еще закрыта - $html .= '
    '. - '
    Дата открытия
    '.$pl['dd'].'.'.season::$date['m'].'.'.season::$date['Y'].'
    '. - '
    '; - }else{ - //Открытая миссия - $html .= '
    '. - '
    Приступить!
    '. - '
    '; - } - } - if( $html == '' ) { - $html = 'Нет миссий для текущего сезона'; - } - echo '
    ' . $html . '
    '; - }elseif( $rz == 2 ) { - //Открытая миссия - $html = ''; - season::data( $_GET['mis'] ); - if( !isset(season::$m['id']) ) { - $html = 'Миссия для текущего сезона не найдена'; - }else{ - if( season::$m['dd'] > season::$date['d'] ) { - //Миссия еще закрыта - $html .= '
    '. - '
    Дата открытия
    '.season::$m['dd'].'.'.season::$date['m'].'.'.season::$date['Y'].'
    '. - '
    '; - }else{ - //Открытая миссия - $html .= '
    '. - '
     Выполнено заданий:
    0 / ??
    '. - '
    '; - //Задания в миссии - $sp = mysql_query('SELECT * FROM `sss_q` WHERE `m` = "'.season::$m['id'].'"'); - $ends = array(); - $i = 0; - $lstms = mysql_fetch_array(mysql_query('SELECT * FROM `sss_f` WHERE `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1')); - while( $pl = mysql_fetch_array($sp) ) { - - $qe = 0; - $tss = strtotime('01-'.season::$m['s'].'-'.season::$date['Y'].''); - if(isset($lstms['id'])) { - $tss = strtotime(''.date('d',$lstms['time']).'-'.date('m',$lstms['time']).'-'.date('Y',$lstms['time']).''); - } - // - if( $pl['type'] == 1 ) { - //Сбор ресурсов - $c1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `time_create` > "'.$tss.'" AND `uid` = "'.$u->info['id'].'" AND `delete` < 1001 AND `item_id` = "'.$pl['value'].'" LIMIT 1')); - $qe = $c1[0]; - }elseif( $pl['type'] == 2 || $pl['type'] == 3 ) { - $c1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `actions` WHERE `time` > "'.$tss.'" AND `uid` = "'.$u->info['id'].'" AND `vars` LIKE "%win_bot_'.$pl['value'].'" LIMIT 1')); - $qe = $c1[0]; - } - // - if( $qe > $pl['var'] ) { - $qe = $pl['var']; - } - $f = 0; - // - $nogo = false; - if( !isset($ends[$i-1]) && $i != 0 ) { - $nogo = true; - } - // - $plf = mysql_fetch_array(mysql_query('SELECT * FROM `sss_f` WHERE `uid` = "'.$u->info['id'].'" AND `m` = "'.$pl['id'].'" AND `y` = "'.season::$date['Y'].'" LIMIT 1')); - if(isset($plf['id'])) { - $f = 1; - } - // - $html .= '
    '; - $html .= '
    '; - - $html .= '
    ' . $pl['info'] . '
    '; - - if( $nogo == true ) { - //Еще не готов выполнять - }elseif( $f == 1 ) { - //Выполнено - }elseif( $nogo == false && $f == 0 && isset($_GET['endq']) && $_GET['endq'] == $pl['id'] && $qe == $pl['var'] ) { - $f = 1; - mysql_query('INSERT INTO `sss_f` (`m`,`y`,`uid`,`time`) VALUES ( - "'.$pl['id'].'", - "'.season::$date['Y'].'", - "'.$u->info['id'].'", - "'.time().'" - )'); - }else{ - $html .= '
    '; - if( $qe == $pl['var'] ) { - $html .= ' '; - } - $html .= '   '.$qe.' / '.$pl['var'].''; - } - - if( $f == 1 ) { - $ends[$i] = true; - $html .= ' Задание выполнено.'; - }elseif( $nogo == true ) { - $html .= ' Требует выполнение предыдущего задания.'; - } - - $html .= '
    '; - $html .= '
    '; - // - $html .= ''; - $i++; - } - } - } - echo '
    ' . $html . '
    '; - } - ?> - -
    + + +
    + + Season::$date['d']) { + //Миссия еще закрыта + $html .= '
    ' . + '
    Дата открытия
    ' . $pl['dd'] . '.' . Season::$date['m'] . '.' . Season::$date['Y'] . '
    ' . + '
    '; + } else { + //Открытая миссия + $html .= '
    ' . + '
    Приступить!
    ' . + '
    '; + } + } + if ($html == '') { + $html = 'Нет миссий для текущего сезона'; + } + echo '
    ' . $html . '
    '; + } elseif ($rz == 2) { + //Открытая миссия + $html = ''; + Season::data($_GET['mis']); + if (!isset(Season::$m['id'])) { + $html = 'Миссия для текущего сезона не найдена'; + } else { + if (Season::$m['dd'] > Season::$date['d']) { + //Миссия еще закрыта + $html .= '
    ' . + '
    Дата открытия
    ' . Season::$m['dd'] . '.' . Season::$date['m'] . '.' . Season::$date['Y'] . '
    ' . + '
    '; + } else { + //Открытая миссия + $html .= '
    ' . + '
     Выполнено заданий:
    0 / ??
    ' . + '
    '; + //Задания в миссии + $sp = mysql_query('SELECT * FROM `sss_q` WHERE `m` = "' . Season::$m['id'] . '"'); + $ends = []; + $i = 0; + $lstms = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `sss_f` WHERE `uid` = "' . $u->info['id'] . '" ORDER BY `id` DESC LIMIT 1' + ) + ); + while ($pl = mysql_fetch_array($sp)) { + + $qe = 0; + $tss = strtotime('01-' . Season::$m['s'] . '-' . Season::$date['Y'] . ''); + if (isset($lstms['id'])) { + $tss = strtotime( + '' . date('d', $lstms['time']) . '-' . date('m', $lstms['time']) . '-' . date( + 'Y', $lstms['time'] + ) . '' + ); + } + // + if ($pl['type'] == 1) { + //Сбор ресурсов + $c1 = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `items_users` WHERE `time_create` > "' . $tss . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` < 1001 AND `item_id` = "' . $pl['value'] . '" LIMIT 1' + ) + ); + $qe = $c1[0]; + } elseif ($pl['type'] == 2 || $pl['type'] == 3) { + $c1 = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `actions` WHERE `time` > "' . $tss . '" AND `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%win_bot_' . $pl['value'] . '" LIMIT 1' + ) + ); + $qe = $c1[0]; + } + // + if ($qe > $pl['var']) { + $qe = $pl['var']; + } + $f = 0; + // + $nogo = false; + if (!isset($ends[$i - 1]) && $i != 0) { + $nogo = true; + } + // + $plf = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `sss_f` WHERE `uid` = "' . $u->info['id'] . '" AND `m` = "' . $pl['id'] . '" AND `y` = "' . Season::$date['Y'] . '" LIMIT 1' + ) + ); + if (isset($plf['id'])) { + $f = 1; + } + // + $html .= '
    '; + $html .= '
    '; + + $html .= '
    ' . $pl['info'] . '
    '; + + if ($nogo == true) { + //Еще не готов выполнять + } elseif ($f == 1) { + //Выполнено + } elseif ($nogo == false && $f == 0 && isset($_GET['endq']) && $_GET['endq'] == $pl['id'] && $qe == $pl['var']) { + $f = 1; + mysql_query( + 'INSERT INTO `sss_f` (`m`,`y`,`uid`,`time`) VALUES ( + "' . $pl['id'] . '", + "' . Season::$date['Y'] . '", + "' . $u->info['id'] . '", + "' . time() . '" + )' + ); + } else { + $html .= '
    '; + if ($qe == $pl['var']) { + $html .= ' '; + } + $html .= '   ' . $qe . ' / ' . $pl['var'] . ''; + } + + if ($f == 1) { + $ends[$i] = true; + $html .= ' Задание выполнено.'; + } elseif ($nogo == true) { + $html .= ' Требует выполнение предыдущего задания.'; + } + + $html .= '
    '; + $html .= '
    '; + // + $html .= ''; + $i++; + } + } + } + echo '
    ' . $html . '
    '; + } + ?> + +
    diff --git a/settings.php b/settings.php index f3ea2c39..f7bf275c 100644 --- a/settings.php +++ b/settings.php @@ -1,271 +1,376 @@ - - + - -Бойцовский Клуб - Настройки - - - - - - - - - + body { + background-color: #000000; + margin: 0; + font-family: Tahoma, Arial, Helvetica, sans-serif; + font-size: 12pt; + color: #000000; + } + + .nicname { + color: #bfa178; + font-size: 9pt; + font-weight: bold; + } + + td.text { + background-position: right top; + background-repeat: no-repeat; + } + + .place { + color: #cc8e43; + font-size: 8pt; + font-weight: bold; + } + + .nomber { + color: #7c3e00; + font-size: 8pt; + font-weight: bold; + } + + .green { + color: #526700; + font-size: 8pt; + font-weight: bold; + } + + .about { + font-size: 9pt; + } + + .levels { + color: #bfa178; + font-family: Tahoma, Arial, Helvetica, sans-serif; + font-size: 7pt; + } + + TD.topbgl { + background-image: url(https://new-combats.com/new/register/topbgl.jpg); + background-position: right top + } + + .style1 { + color: #4b2500; + font-weight: bold; + font-size: 9pt; + } + + a.lnkstyle1, a.lnkstyle1:link, a.lnkstyle1:visited, a.lnkstyle1:hover, a.lnkstyle1:active { + color: #4b2500; + font-weight: bold; + font-size: 9pt; + } + + a.lnkstyle2 { + font-size: 9pt; + font-weight: bold; + color: #4b2500; + } + + a.lnkstyle2:link { + font-weight: bold; + color: #4b2500; + text-decoration: none + } + + a.lnkstyle2:visited { + font-weight: bold; + color: #4b2500; + text-decoration: none + } + + a.lnkstyle2:hover, a.lnkstyle2:active { + font-weight: bold; + color: #84643e; + text-decoration: none; + } + + input { + font-size: 12px; + } + + --> + + + -spamFiltr($_POST['name'])!='0' || $filter->spamFiltr($_POST['city'])!='0' || $filter->spamFiltr($_POST['city2'])!='0' || $filter->spamFiltr($_POST['homepage'])!='0' || $filter->spamFiltr($_POST['about'])!='0' || $filter->spamFiltr($_POST['hobby'])!='0') - { - if ($u->info['level']<9) - { - mysql_query('UPDATE `users` SET `info_delete` = "'.(time()+86400).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - $_POST['city'] = htmlspecialchars($_POST['city'],NULL,'cp1251'); - $_POST['city2'] = htmlspecialchars($_POST['city2'],NULL,'cp1251'); - $_POST['icq'] = htmlspecialchars($_POST['icq'],NULL,'cp1251'); - if(!isset($_POST['mat'])) { $_POST['mat'] == NULL; } - if(!isset($_POST['hide_icq'])){ $_POST['hide_icq'] = NULL; } - $_POST['skype'] = htmlspecialchars($_POST['skype'],NULL,'cp1251'); - if(!isset($_POST['hide_skype'])){ $_POST['hide_skype'] = NULL; }else{ $_POST['hide_skype'] = 1; } - $_POST['hide_icq'] = htmlspecialchars($_POST['hide_icq'],NULL,'cp1251'); - $_POST['homepage'] = htmlspecialchars($_POST['homepage'],NULL,'cp1251'); - $_POST['about'] = htmlspecialchars($_POST['about'],NULL,'cp1251'); - if( $u->info['admin'] == 0 ) { - $_POST['hobby'] = htmlspecialchars($_POST['hobby'],NULL,'cp1251'); - } - $_POST['ChatColor'] = htmlspecialchars($_POST['ChatColor'],NULL,'cp1251'); - - $_POST['hobby']= str_replace("\\n","
    ",$_POST['hobby']); - $_POST['hobby']= str_replace("\\r","",$_POST['hobby']); - $_POST['hobby']= str_replace("<BR>","
    ",$_POST['hobby']); - $simbolcount = strlen($_POST['hobby']); - if (isset($_POST['ChatColor']) && $u->info['admin']=='0' && !($_POST['ChatColor'] == "Black" || $_POST['ChatColor'] == "Blue" || $_POST['ChatColor'] == "Lilac" || $_POST['ChatColor'] == "Fuchsia" || $_POST['ChatColor'] == "Gray" || $_POST['ChatColor'] == "Green" || $_POST['ChatColor'] == "Maroon" || $_POST['ChatColor'] == "Navy" || $_POST['ChatColor'] == "Olive" || $_POST['ChatColor'] == "Purple" || $_POST['ChatColor'] == "Teal" || $_POST['ChatColor'] == "Orange" || $_POST['ChatColor'] == "Chocolate" || $_POST['ChatColor'] == "DarkKhaki" || $_POST['ChatColor'] == "SandyBrown")) { - echo "
    Возможно использовать цвета указанные только в меню анкеты !
    "; - $_POST['ChatColor'] = "Black"; - } - if(!$_POST['city']){$city=$_POST['city2'];} - elseif($_POST['city'] && $_POST['city2']){$city=$_POST['city2'];} - else{$city=$_POST['city'];} +spamFiltr($_POST['name']) != '0' || + $filter->spamFiltr($_POST['city']) != '0' || + $filter->spamFiltr($_POST['city2']) != '0' || + $filter->spamFiltr($_POST['homepage']) != '0' || + $filter->spamFiltr($_POST['about']) != '0' || + $filter->spamFiltr($_POST['hobby']) != '0' + ) && + $u->info['level'] < 9 + ) { + mysql_query( + 'UPDATE `users` SET `info_delete` = "' . (time( + ) + 86400) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + } + $_POST['city'] = htmlspecialchars($_POST['city'], null, 'cp1251'); + $_POST['city2'] = htmlspecialchars($_POST['city2'], null, 'cp1251'); + $_POST['icq'] = htmlspecialchars($_POST['icq'], null, 'cp1251'); + if (!isset($_POST['mat'])) { + $_POST['mat'] = null; + } + if (!isset($_POST['hide_icq'])) { + $_POST['hide_icq'] = null; + } + $_POST['skype'] = htmlspecialchars($_POST['skype'], null, 'cp1251'); + if (!isset($_POST['hide_skype'])) { + $_POST['hide_skype'] = null; + } else { + $_POST['hide_skype'] = 1; + } + $_POST['hide_icq'] = htmlspecialchars($_POST['hide_icq'], null, 'cp1251'); + $_POST['homepage'] = htmlspecialchars($_POST['homepage'], null, 'cp1251'); + $_POST['about'] = htmlspecialchars($_POST['about'], null, 'cp1251'); + if ($u->info['admin'] == 0) { + $_POST['hobby'] = htmlspecialchars($_POST['hobby'], null, 'cp1251'); + } + $_POST['ChatColor'] = htmlspecialchars($_POST['ChatColor'], null, 'cp1251'); + + $_POST['hobby'] = str_replace("\\n", "
    ", $_POST['hobby']); + $_POST['hobby'] = str_replace("\\r", "", $_POST['hobby']); + $_POST['hobby'] = str_replace("<BR>", "
    ", $_POST['hobby']); + $simbolcount = strlen($_POST['hobby']); + if (isset($_POST['ChatColor']) && $u->info['admin'] == '0' && !($_POST['ChatColor'] == "Black" || $_POST['ChatColor'] == "Blue" || $_POST['ChatColor'] == "Lilac" || $_POST['ChatColor'] == "Fuchsia" || $_POST['ChatColor'] == "Gray" || $_POST['ChatColor'] == "Green" || $_POST['ChatColor'] == "Maroon" || $_POST['ChatColor'] == "Navy" || $_POST['ChatColor'] == "Olive" || $_POST['ChatColor'] == "Purple" || $_POST['ChatColor'] == "Teal" || $_POST['ChatColor'] == "Orange" || $_POST['ChatColor'] == "Chocolate" || $_POST['ChatColor'] == "DarkKhaki" || $_POST['ChatColor'] == "SandyBrown")) { + echo "
    Возможно использовать цвета указанные только в меню анкеты !
    "; + $_POST['ChatColor'] = "Black"; + } + if (!$_POST['city']) { + $city = $_POST['city2']; + } elseif ($_POST['city'] && $_POST['city2']) { + $city = $_POST['city2']; + } else { + $city = $_POST['city']; + } } -if(isset($_POST['saveanketa'])) { -if( $u->info['level'] <= 1 ) { - $dt = explode('.',$_POST['0day']); - if(isset($dt[0],$dt[1],$dt[2])) - { - $erd = 0; - $dt[0] = round($dt[0]); - $dt[1] = round($dt[1]); - $dt[2] = round($dt[2]); - if($dt[0]<1 || $dt[0]>31) - { - $erd = 1; - } - if($dt[1]<1 || $dt[1]>12) - { - $erd = 2; - } - if($dt[2]<1920 || $dt[2]>2006) - { - $erd = 3; - } - if($erd==0) - { - $_POST['0day'] = $dt[0].'.'.$dt[1].'.'.$dt[2]; - $dateofbirth = "`bithday` = '".mysql_real_escape_string($_POST['0day'])."',"; - }else{ - //ошибка - - } - } - - $u->info['bithday'] = $_POST['0day']; -} -$st = $u->lookStats($u->info['stats']); -$maxsimbols = 2000+($st['os6']*200); - if($_POST['mat'] == 1 ) { - $_POST['mat'] = 1; - }else{ - $_POST['mat'] = 0; - } - if($simbolcount>$maxsimbols && $u->info['admin'] == 0) { - }else{ - $lastdes = $u->info['design']; - if($_POST['design'] == 1) { - $u->info['design'] = 1; - }else{ - $u->info['design'] = 0; - } - } - if($simbolcount>$maxsimbols && $u->info['admin'] == 0) { - echo '
    Максимальный размер поля "Увлечения / хобби" - '.$maxsimbols.' символов.
    '; - }elseif(mysql_query("UPDATE +if (isset($_POST['saveanketa'])) { + if ($u->info['level'] <= 1) { + $dt = explode('.', $_POST['0day']); + if (isset($dt[0], $dt[1], $dt[2])) { + $erd = 0; + $dt[0] = round($dt[0]); + $dt[1] = round($dt[1]); + $dt[2] = round($dt[2]); + if ($dt[0] < 1 || $dt[0] > 31) { + $erd = 1; + } + if ($dt[1] < 1 || $dt[1] > 12) { + $erd = 2; + } + if ($dt[2] < 1920 || $dt[2] > 2006) { + $erd = 3; + } + if ($erd == 0) { + $_POST['0day'] = $dt[0] . '.' . $dt[1] . '.' . $dt[2]; + $dateofbirth = "`bithday` = '" . mysql_real_escape_string($_POST['0day']) . "',"; + } + } + + $u->info['bithday'] = $_POST['0day']; + } + $st = $u->lookStats($u->info['stats']); + $maxsimbols = 2000 + ($st['os6'] * 200); + if ($_POST['mat'] == 1) { + $_POST['mat'] = 1; + } else { + $_POST['mat'] = 0; + } + if ($simbolcount <= $maxsimbols || $u->info['admin'] != 0) { + $lastdes = $u->info['design']; + if ($_POST['design'] == 1) { + $u->info['design'] = 1; + } else { + $u->info['design'] = 0; + } + } + if ($simbolcount > $maxsimbols && $u->info['admin'] == 0) { + echo '
    Максимальный размер поля "Увлечения / хобби" - ' . $maxsimbols . ' символов.
    '; + } elseif (mysql_query( + "UPDATE `users` SET - `design` = '".$u->info['design']."', - `name` = '".mysql_real_escape_string($_POST['name'])."', - `city_real` = '".mysql_real_escape_string($_POST['city2'])."', - `icq` = '".mysql_real_escape_string((int)$_POST['icq'])."', - `icq_hide` = '".mysql_real_escape_string($_POST['hide_icq'])."', - `skype` = '".mysql_real_escape_string($_POST['skype'])."', - `skype_hide` = '".mysql_real_escape_string($_POST['hide_skype'])."', - `homepage` = '".mysql_real_escape_string($_POST['homepage'])."', - ".$dateofbirth." - `deviz` = '".mysql_real_escape_string($_POST['about'])."', - `hobby` = '".mysql_real_escape_string($_POST['hobby'])."', - `chatColor` = '".mysql_real_escape_string($_POST['ChatColor'])."', - `mat` = '".mysql_real_escape_string((int)$_POST['mat'])."' + `design` = '" . $u->info['design'] . "', + `name` = '" . mysql_real_escape_string($_POST['name']) . "', + `city_real` = '" . mysql_real_escape_string($_POST['city2']) . "', + `icq` = '" . mysql_real_escape_string((int)$_POST['icq']) . "', + `icq_hide` = '" . mysql_real_escape_string($_POST['hide_icq']) . "', + `skype` = '" . mysql_real_escape_string($_POST['skype']) . "', + `skype_hide` = '" . mysql_real_escape_string($_POST['hide_skype']) . "', + `homepage` = '" . mysql_real_escape_string($_POST['homepage']) . "', + " . $dateofbirth . " + `deviz` = '" . mysql_real_escape_string($_POST['about']) . "', + `hobby` = '" . mysql_real_escape_string($_POST['hobby']) . "', + `chatColor` = '" . mysql_real_escape_string($_POST['ChatColor']) . "', + `mat` = '" . mysql_real_escape_string((int)$_POST['mat']) . "' WHERE - `id` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1;")) -{echo '
    Сохранено
    '; - if( $u->info['design'] != $lastdes ) { - echo ''; - } -$u->info['name'] = $_POST['name']; -$u->info['city_real'] = $city; -$u->info['icq'] = $_POST['icq']; -$u->info['icq_hide'] = $_POST['hide_icq']; -$u->info['skype'] = $_POST['skype']; -$u->info['skype_hide'] = $_POST['hide_skype']; -$u->info['homepage'] = $_POST['homepage']; -$u->info['deviz'] = $_POST['about']; -$u->info['hobby'] = $_POST['hobby']; -$u->info['chatColor'] = $_POST['ChatColor']; -$u->info['mat'] = $_POST['mat']; -} -else{echo 'что-то не так...';} + `id` = '" . mysql_real_escape_string($u->info['id']) . "' LIMIT 1;" + )) { + echo '
    Сохранено
    '; + if ($u->info['design'] != $lastdes) { + echo ''; + } + $u->info['name'] = $_POST['name']; + $u->info['city_real'] = $city; + $u->info['icq'] = $_POST['icq']; + $u->info['icq_hide'] = $_POST['hide_icq']; + $u->info['skype'] = $_POST['skype']; + $u->info['skype_hide'] = $_POST['hide_skype']; + $u->info['homepage'] = $_POST['homepage']; + $u->info['deviz'] = $_POST['about']; + $u->info['hobby'] = $_POST['hobby']; + $u->info['chatColor'] = $_POST['ChatColor']; + $u->info['mat'] = $_POST['mat']; + } else { + echo 'что-то не так...'; + } } +?> + +info['pass']) { + if ($_POST['pass_new'] == $_POST['pass_new2']) { + $u->info['pass'] = md5($_POST['pass_new']); + mysql_query( + 'UPDATE `users` SET `pass` = "' . $u->info['pass'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + // + setcookie('login', $u->info['login'], time() + 86400 * 365, '', $c['host']); + setcookie('pass', $u->info['pass'], time() + 86400 * 365, '', $c['host']); + // + echo '
    Новый пароль успешно записан!
    '; + } else { + echo '
    Новый пароль не сповпадает со вторым полем!
    '; + } + } else { + echo '
    Неверный текущий пароль, попробуйте снова!
    '; + } } ?> @@ -273,168 +378,284 @@ if(isset($_POST['pass_old'])) { - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
    - - - -
     
    -
    - - - - - - - - - - -
    - - - + +
    + + + + + + + + +
    + - + +
    +  
    +
    + + + + + + + + + + + + + +
    + + + + + + + +
    + + + - - - - -
    - - - - - - -
    + + + + + + -
    -
    -
    microLogin($u->info['id'],1)?>
    -
    -
    - Смена пароля - Старый пароль:

    - Новый пароль:

    - Новый пароль (еще раз):

    - -
    -
    +
    +
    microLogin($u->info['id'], 1) ?>
    +
    +
    + Смена пароля + + Старый пароль:

    + Новый пароль:

    + Новый пароль (еще раз):

    + +
    +
    -
    +
    -
    -
    - Анкета -
    - Ваше реальное имя:

    - Город:
    -
    - Цвет сообщений в чате:
    -
    + Город:
    +
    + Цвет сообщений в чате:
    + - -
    -
    - info['icq'] == 0 ) { - $u->info['icq'] = ''; - } - ?> - ICQ:

    - Skype:

    - Вариант дизайна:
    - - -
    -
    -
    - Увлечения / хобби (ограничение символов и 300 строк) -
    - -
    -
    -
    + } + ?> + + + +
    + info['icq'] == 0) { + $u->info['icq'] = ''; + } + ?> + ICQ:

    + Skype:

    + Вариант дизайна:
    + + +
    +
    +
    + Увлечения / хобби (ограничение + символов и 300 строк) +
    + + + +
    +
    +
    +

    -
    - - - -
     
      
      - - - - - -
      - -
    Бойцовский Клуб © 2013-2016 -

    -   -
    -
     

    +
    + + + + +
     
    +
      
      + + + + + + +
      + +
    Бойцовский Клуб © 2013-2016 +

    +   +
    +
     
    -
    - - - -
    - +
    + \ No newline at end of file diff --git a/shop_editor.php b/shop_editor.php index 52a6240e..e0c2acf2 100644 --- a/shop_editor.php +++ b/shop_editor.php @@ -1,10 +1,11 @@ -info['id']) || $u->info['admin'] < 1) { +if(!$u->info['admin']) { header('location: /index.php'); die(); } diff --git a/sms.php b/sms.php index 64f3a3bc..33df3dc9 100644 --- a/sms.php +++ b/sms.php @@ -1,17 +1,22 @@ - 0 AND `banned` = 0 ORDER BY `id` DESC'); - while( $pl = mysql_fetch_array($sp) ) { - $prc = mysql_fetch_array(mysql_query('SELECT SUM(`2price`) AS `a` , SUM(`1price`) AS `b` FROM `items_users` WHERE `uid` = "'.$pl['id'].'" AND `delete` < `time_create` LIMIT 1')); - if( $prc['a'] > 0 ) { - echo $u->microLogin($pl,2) . '   - - - - - - - - '.($prc['a']).' (вещи) + '.$pl['money2'].' ЕКР \ '.($prc['b']+$pl['money1']).' КР
    '; - echo '
    '; - } - } +if (isset($_GET['test'])) { + $sp = mysql_query('SELECT * FROM `users` WHERE `real` > 0 AND `banned` = 0 ORDER BY `id` DESC'); + while ($pl = mysql_fetch_array($sp)) { + $prc = mysql_fetch_array( + mysql_query( + 'SELECT SUM(`2price`) AS `a` , SUM(`1price`) AS `b` FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" AND `delete` < `time_create` LIMIT 1' + ) + ); + if ($prc['a'] > 0) { + echo $u->microLogin( + $pl, 2 + ) . '   - - - - - - - - ' . ($prc['a']) . ' (вещи) + ' . $pl['money2'] . ' ЕКР \ ' . ($prc['b'] + $pl['money1']) . ' КР
    '; + echo '
    '; + } + } } -?> \ No newline at end of file diff --git a/social.php b/social.php index f23332ac..7536d42e 100644 --- a/social.php +++ b/social.php @@ -5,7 +5,7 @@ die(); define('GAME',true); include('_incl_data/__config.php'); include('_incl_data/class/__db_connect.php'); -include('_incl_data/class/__user.php'); +$u = User::start(); // if(isset($u->info['id'])) { $mcf = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `uid` = "'.$u->info['id'].'" AND (`val` = "vkauth" OR `val` = "fbauth" OR `val` = "okauth") LIMIT 1')); diff --git a/spam.php b/spam.php index d6b0cbaa..f8770b66 100644 --- a/spam.php +++ b/spam.php @@ -1,124 +1,151 @@ 0 AND `id` > "'.mysql_real_escape_string($_GET['test_login']).'" LIMIT 1')); - $sp = mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `real` > 0 AND `id` IN ( SELECT `uid` FROM `logs_auth` WHERE `depass` != "" GROUP BY `uid` ) AND `id` > "'.mysql_real_escape_string($_GET['test_login']).'" ORDER BY `id` ASC LIMIT 1'); - while( $pl = mysql_fetch_array($sp) ) { - $test = false; - $cn = file_get_contents('https://old-combats.com/info/'.$pl['login'].''); - $cn = explode('',$cn); - $cn = explode('',$cn[1]); - $cn = $cn[0]; - echo '['.$cn.']'; - if( $cn != 'Произошла ошибка' ) { - $test = true; - } - if($test == true) { - $logs = mysql_fetch_array(mysql_query('SELECT `depass` FROM `logs_auth` WHERE `uid` = "'.$pl['id'].'" AND `depass` != ""')); - echo ''.$pl['login'].' - '.$pl['pass'].' - '.$pl['id'].' -> ('.$xx[0].') "'; - print_r($logs); - echo '"

    '; - }else{ - die('location: /spam.php?test_login='.$pl['id'].''); - } - } - die(); -}elseif(isset($_GET['test_login2'])) { - die(); - $xx = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `real` > 0 AND `id` > "'.mysql_real_escape_string($_GET['test_login2']).'" LIMIT 1')); - $sp = mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `real` > 0 AND `id` IN ( SELECT `uid` FROM `logs_auth` WHERE `depass` != "" GROUP BY `uid` ) AND `id` > "'.mysql_real_escape_string($_GET['test_login2']).'" ORDER BY `id` ASC LIMIT 1'); - while( $pl = mysql_fetch_array($sp) ) { - $test = false; - $cn = file_get_contents('https://mycombats.com/info/'.$pl['login'].''); - $cn = explode('',$cn); - $cn = explode('',$cn[1]); - $cn = $cn[0]; - echo '['.$cn.']'; - if( $cn != 'Произошла ошибка' ) { - $test = true; - } - if($test == true) { - $logs = mysql_fetch_array(mysql_query('SELECT `depass` FROM `logs_auth` WHERE `uid` = "'.$pl['id'].'" AND `depass` != ""')); - echo ''.$pl['login'].' - '.$pl['pass'].' - '.$pl['id'].' -> ('.$xx[0].') "'; - print_r($logs); - echo '"

    '; - }else{ - die('location: /spam.php?test_login2='.$pl['id'].''); - } - } - die(); +if (isset($_GET['test_login'])) { + die(); + $xx = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `users` WHERE `real` > 0 AND `id` > "' . mysql_real_escape_string( + $_GET['test_login'] + ) . '" LIMIT 1' + ) + ); + $sp = mysql_query( + 'SELECT `id`,`login`,`pass` FROM `users` WHERE `real` > 0 AND `id` IN ( SELECT `uid` FROM `logs_auth` WHERE `depass` != "" GROUP BY `uid` ) AND `id` > "' . mysql_real_escape_string( + $_GET['test_login'] + ) . '" ORDER BY `id` ASC LIMIT 1' + ); + while ($pl = mysql_fetch_array($sp)) { + $test = false; + $cn = file_get_contents('https://old-combats.com/info/' . $pl['login'] . ''); + $cn = explode('', $cn); + $cn = explode('', $cn[1]); + $cn = $cn[0]; + echo '[' . $cn . ']'; + if ($cn != 'Произошла ошибка') { + $test = true; + } + if ($test) { + $logs = mysql_fetch_array( + mysql_query('SELECT `depass` FROM `logs_auth` WHERE `uid` = "' . $pl['id'] . '" AND `depass` != ""') + ); + echo '' . $pl['login'] . ' - ' . $pl['pass'] . ' - ' . $pl['id'] . ' -> (' . $xx[0] . ') "'; + print_r($logs); + echo '"

    '; + } else { + die('location: /spam.php?test_login=' . $pl['id'] . ''); + } + } + die(); +} elseif (isset($_GET['test_login2'])) { + die(); + $xx = mysql_fetch_array( + mysql_query('SELECT COUNT(*) FROM `users` WHERE `real` > 0 AND `id` > ' . (int)$_GET['test_login2'])); + $sp = mysql_query( + 'SELECT `id`,`login`,`pass` FROM `users` WHERE `real` > 0 AND `id` IN ( SELECT `uid` FROM `logs_auth` WHERE `depass` != "" GROUP BY `uid` ) AND `id` > "' . mysql_real_escape_string( + $_GET['test_login2'] + ) . '" ORDER BY `id` LIMIT 1' + ); + while ($pl = mysql_fetch_array($sp)) { + $test = false; + $cn = file_get_contents('https://mycombats.com/info/' . $pl['login'] . ''); + $cn = explode('', $cn); + $cn = explode('', $cn[1]); + $cn = $cn[0]; + echo '[' . $cn . ']'; + if ($cn != 'Произошла ошибка') { + $test = true; + } + if ($test) { + $logs = mysql_fetch_array( + mysql_query('SELECT `depass` FROM `logs_auth` WHERE `uid` = "' . $pl['id'] . '" AND `depass` != ""') + ); + echo '' . $pl['login'] . ' - ' . $pl['pass'] . ' - ' . $pl['id'] . ' -> (' . $xx[0] . ') "'; + print_r($logs); + echo '"

    '; + } else { + die('location: /spam.php?test_login2=' . $pl['id'] . ''); + } + } + die(); } -if(isset($_GET['chat'])) { - $sp = mysql_query('SELECT * FROM `chat` WHERE `spam` > 0 ORDER BY `time` DESC'); - while($pl = mysql_fetch_array($sp) ) { - echo date('d.m.Y H:i',$pl['time']).' '.$pl['login'].': '.$pl['text'].'
    '; - } - die(); +if (isset($_GET['chat'])) { + $sp = mysql_query('SELECT * FROM `chat` WHERE `spam` > 0 ORDER BY `time` DESC'); + while ($pl = mysql_fetch_array($sp)) { + echo date('d.m.Y H:i', $pl['time']) . ' ' . $pl['login'] . ': ' . $pl['text'] . '
    '; + } + die(); } -if( $u->info['admin'] > 0 || $u->info['id'] == 618775 ) { -?> - - - -Редактирование фильтра от спама - - - - - - - - -Список запрещенных слов\ссылок:  

    -Слово "'.$spam[floor((int)$_GET['del'])].'" удалено.

    '; - unset($spam[floor((int)$_GET['del'])]); - $spam = implode('|',$spam); - mysql_query('UPDATE `spam_word` SET `data` = "'.mysql_real_escape_string($spam).'" WHERE `id` = "1" LIMIT 1'); - $spam = explode('|',$spam); -}elseif(isset($_POST['add'])){ - $_POST['add'] = htmlspecialchars($_POST['add'],NULL,'cp1251'); - echo '
    Слово "'.$_POST['add'].'" добавлено.

    '; - $spam = implode('|',$spam); - $spam .= '|'.$_POST['add'].''; - mysql_query('UPDATE `spam_word` SET `data` = "'.mysql_real_escape_string($spam).'" WHERE `id` = "1" LIMIT 1'); - $spam = explode('|',$spam); +if ($u->info['admin']) { + ?> + + + + Редактирование фильтра от спама + + + + + + + + + Список запрещенных слов\ссылок:  

    + Слово "' . $spam[floor( + (int)$_GET['del'] + )] . '" удалено.

    '; + unset($spam[floor((int)$_GET['del'])]); + $spam = implode('|', $spam); + mysql_query( + 'UPDATE `spam_word` SET `data` = "' . mysql_real_escape_string($spam) . '" WHERE `id` = "1" LIMIT 1' + ); + $spam = explode('|', $spam); + } elseif (isset($_POST['add'])) { + $_POST['add'] = htmlspecialchars($_POST['add'], null, 'cp1251'); + echo '
    Слово "' . $_POST['add'] . '" добавлено.

    '; + $spam = implode('|', $spam); + $spam .= '|' . $_POST['add'] . ''; + mysql_query( + 'UPDATE `spam_word` SET `data` = "' . mysql_real_escape_string($spam) . '" WHERE `id` = "1" LIMIT 1' + ); + $spam = explode('|', $spam); + } + // + $i = 0; + while ($i < count($spam)) { + echo '' . $spam[$i] . '
    '; + $i++; + } + ?> +
    + +
    + + +
    '; - $i++; -} -?> -
    - -
    - - - \ No newline at end of file diff --git a/telegraf.php b/telegraf.php index bf0a454f..adac2bf4 100644 --- a/telegraf.php +++ b/telegraf.php @@ -1,243 +1,290 @@ ',$v); - //$v = $chat->expworld($v,32); - $v = str_replace('\\','\\\\',$v); - $v = str_replace('"','[s1;]',$v); - $v = str_replace("'",'[s2;]',$v); - $v = str_replace('<','[s3;]',$v); - $v = str_replace('>','[s4;]',$v); - $v = str_replace(' ',' ',$v); - $v = htmlspecialchars($v,NULL,'cp1251'); - return $v; - } - - if(!isset($u->info['id']) || $u->info['banned']>0) - { - die('-1'); - }elseif($u->info['ip']!=$_SERVER['HTTP_X_REAL_IP']) - { - //die('-4'); - } - - $r = round((int)$_POST['r']); - if($r != 1 && $r != 2 && $r != 3) { - $r = 1; - } - $html = ''; - $js = ''; - - if(isset($_POST['see_msg'])) { - $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id` = "'.mysql_real_escape_string($_POST['see_msg']).'" AND (`uid` = "'.$u->info['id'].'" OR `from` = "'.$u->info['id'].'") LIMIT 1')); - if(!isset($msg['id'])) { - $html = '







    Сообщение не найдено.
    '; - }elseif($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) { - $html = '







    Сообщение было удалено.
    '; - }elseif($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) { - $html = '







    Сообщение было удалено.
    '; - }else{ - $to = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "'.$msg['uid'].'" LIMIT 1')); - $from = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "'.$msg['from'].'" LIMIT 1')); - if($msg['read'] == 0 || $msg['read'] == 1) { - if($to['id'] == $u->info['id']) { - mysql_query('UPDATE `telegram` SET `read` = `read` + 2 WHERE `id` = "'.$msg['id'].'" LIMIT 1'); - } - } - $html = '
    '; - $html .= '
    От:    '.$from['login'].'Закрыть
    '; - $html .= '
    Кому: '.$to['login'].''.date('d.m.Y H:i',$msg['time']).'
    '; - $html .= '
    Тема: '.$msg['tema'].'
    '; - $html .= '
    Сообщение:
    '.$msg['text'].'
    '; - $html .= ''; - $html .= '
    '; - //$html .= '
    '.$error.'
    '; - $html .= '
    '; - } - }elseif($r == 3) { - if($u->info['noreal'] == 1) { - $html = '







    Отправлять сообщения по телеграфу возможно только с основного персонажа
    '; - }elseif($u->info['level'] < 4) { - $html = '







    Отправлять сообщения по телеграфу возможно с 4-го уровня.
    '; - }elseif($u->info['molch1'] > time()){ - $html = '







    Персонажи с молчанкой не могут пользоваться телеграфом.
    '; - }else{ - if(isset($_POST['to'])) { - $_POST['to'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['to'])); - $_POST['text'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['text'])); - $_POST['tema'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['tema'])); - - if(test_line($_POST['to']) == false) { - $error = 'Пустое поле "Кому".'; - }elseif(test_line($_POST['text']) == false) { - $error = 'Пустое поле "Сообщение".'; - }elseif(test_line($_POST['tema']) == false) { - $error = 'Пустое поле "Тема".'; - }else{ - $to = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['to']).'" LIMIT 1')); - if(!isset($to['id'])) { - $error = 'Получатель не найден в базе.'; - }elseif($to['banned'] > 0) { - $error = 'Получатель был заблокирован.'; - }elseif($to['id'] == $u->info['id']) { - $error = 'Нельзя отправлять самому себе.'; - }else{ - $_POST['text'] = str_replace("\n",'
    ',$_POST['text']); - $_POST['text'] = str_replace("\r",'
    ',$_POST['text']); - mysql_query('INSERT INTO `telegram` (`uid`,`from`,`tema`,`text`,`time`,`ip`) VALUES ("'.$to['id'].'","'.$u->info['id'].'","'.mysql_real_escape_string($_POST['tema']).'","'.mysql_real_escape_string($_POST['text']).'","'.time().'","'.mysql_real_escape_string($u->info['ip']).'")'); - unset($_POST['to'],$_POST['text'],$_POST['tema']); - $error = 'Сообщение доставлено "'.$to['login'].'".'; - } - } - } - if(isset($_POST['re']) && $_POST['re'] > 0 && !isset($_POST['to'])) { - $msg = mysql_fetch_array(mysql_query('SELECT * FROM `telegram` WHERE `id` = "'.mysql_real_escape_string($_POST['re']).'" AND (`uid` = "'.$u->info['id'].'" OR `from` = "'.$u->info['id'].'") LIMIT 1')); - if(isset($msg['id'])) { - $to = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "'.$msg['uid'].'" LIMIT 1')); - $from = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "'.$msg['from'].'" LIMIT 1')); - if($msg['from'] == $u->info['id']) { - $_POST['to'] = $to['login']; - }elseif($msg['uid'] == $u->info['id']) { - $_POST['to'] = $from['login']; - }else{ - unset($msg); - } - $_POST['tema'] = 'Re:'.str_replace('Re:','',$msg['tema']); - } - } - $html = '
    '; - $html .= '
    От:    '.$u->info['login'].'
    '; - $html .= '
    Кому:
    '; - $html .= '
    Тема:
    '; - $html .= '
    Сообщение:
    '; - $html .= '
    '.$error.'
    '; - $html .= '
    '; - } - }elseif($r == 1 || $r == 2) { - if($r == 1) { - mysql_query('UPDATE `telegram` SET `open` = "1" WHERE `uid` = "'.$u->info['id'].'" AND `open` = "0" LIMIT 100'); - } - $pg = round((int)$_POST['p']); - if($pg < 1) { - $pg = 1; - } - $pgssee = ceil(($pg-1)*9); - if($r == 1) { - if(isset($_POST['del_msg'])) { - mysql_query('UPDATE `telegram` SET `delete` = `delete` + 2 WHERE `uid` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 1) AND `id` = "'.mysql_real_escape_string($_POST['del_msg']).'" LIMIT 1'); - } - $sp = mysql_query('SELECT * FROM `telegram` WHERE `uid` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 1) ORDER BY `id` DESC LIMIT '.mysql_real_escape_string($pgssee).',10'); - }elseif($r == 2) { - if(isset($_POST['del_msg'])) { - mysql_query('UPDATE `telegram` SET `delete` = `delete` + 1 WHERE `from` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 2) AND `id` = "'.mysql_real_escape_string($_POST['del_msg']).'" LIMIT 1'); - } - $sp = mysql_query('SELECT * FROM `telegram` WHERE `from` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 2) ORDER BY `id` DESC LIMIT '.mysql_real_escape_string($pgssee).',10'); - } - $msgs = 0; - while($pl = mysql_fetch_array($sp)) { - if($msgs < 9) { - if($r == 1) { - $from = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "'.$pl['from'].'" LIMIT 1')); - } - if($r == 2) { - $from = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1')); - } - if(!isset($from['id'])) { - $from = ''.$pl['from'].''; - }else{ - $from = ''.$from['login'].''; - } - //if($r == 1) { - if($pl['read'] == 0 || $pl['read'] == 1) { - $pl['read'] = 0; - }else{ - $pl['read'] = 1; - } - //} - //if($r == 2) { - //if($pl['read'] == 0 || $pl['read'] == 2) { - // $pl['read'] = 0; - //}else{ - // $pl['read'] = 1; - //} - //} - - if($r == 1) { - $html .= ' -
    - '.date('d.m.y',$pl['time']).' - От: '.$from.' - Тема: '.$pl['tema'].' - +header('Content-Type: text/html; charset=windows-1251'); + +const GAME = true; +include('_incl_data/__config.php'); +include('_incl_data/class/__db_connect.php'); +$u = User::start(); +function test_line($v) +{ + $r = true; + $v = str_replace(' ', '', $v); + $v = str_replace(' ', '', $v); + if ($v == '') { + $r = false; + } + return $r; +} + +function go_text($v) +{ + $v = str_replace('\x3C', '<', $v); + $v = str_replace('\x3', '>', $v); + $v = str_replace('\\', '\\\\', $v); + $v = str_replace('"', '[s1;]', $v); + $v = str_replace("'", '[s2;]', $v); + $v = str_replace('<', '[s3;]', $v); + $v = str_replace('>', '[s4;]', $v); + $v = str_replace(' ', ' ', $v); + $v = htmlspecialchars($v, null, 'cp1251'); + return $v; +} + +if (!isset($u->info['id']) || $u->info['banned'] > 0) { + die('-1'); +} +$r = round((int)$_POST['r']); +if ($r != 1 && $r != 2 && $r != 3) { + $r = 1; +} +$html = ''; +$js = ''; + +if (isset($_POST['see_msg'])) { + $msg = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `telegram` WHERE `id` = "' . mysql_real_escape_string( + $_POST['see_msg'] + ) . '" AND (`uid` = "' . $u->info['id'] . '" OR `from` = "' . $u->info['id'] . '") LIMIT 1' + ) + ); + if (!isset($msg['id'])) { + $html = '







    Сообщение не найдено.
    '; + } elseif ($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) { + $html = '







    Сообщение было удалено.
    '; + } else { + $to = mysql_fetch_array( + mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "' . $msg['uid'] . '" LIMIT 1') + ); + $from = mysql_fetch_array( + mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "' . $msg['from'] . '" LIMIT 1') + ); + if (($msg['read'] == 0 || $msg['read'] == 1) && $to['id'] == $u->info['id']) { + mysql_query('UPDATE `telegram` SET `read` = `read` + 2 WHERE `id` = "' . $msg['id'] . '" LIMIT 1'); + } + $html = '
    '; + $html .= '
    От:    ' . $from['login'] . 'Закрыть
    '; + $html .= '
    Кому: ' . $to['login'] . '' . date( + 'd.m.Y H:i', $msg['time'] + ) . '
    '; + $html .= '
    Тема: ' . $msg['tema'] . '
    '; + $html .= '
    Сообщение:
    ' . $msg['text'] . '
    '; + $html .= ''; + $html .= '
    '; + $html .= '
    '; + } +} elseif ($r == 3) { + if ($u->info['noreal'] == 1) { + $html = '







    Отправлять сообщения по телеграфу возможно только с основного персонажа
    '; + } elseif ($u->info['level'] < 4) { + $html = '







    Отправлять сообщения по телеграфу возможно с 4-го уровня.
    '; + } elseif ($u->info['molch1'] > time()) { + $html = '







    Персонажи с молчанкой не могут пользоваться телеграфом.
    '; + } else { + if (isset($_POST['to'])) { + $_POST['to'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['to'])); + $_POST['text'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['text'])); + $_POST['tema'] = go_text(iconv('UTF-8', 'windows-1251', $_POST['tema'])); + + if (test_line($_POST['to']) == false) { + $error = 'Пустое поле "Кому".'; + } elseif (test_line($_POST['text']) == false) { + $error = 'Пустое поле "Сообщение".'; + } elseif (test_line($_POST['tema']) == false) { + $error = 'Пустое поле "Тема".'; + } else { + $to = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`login`,`banned` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $_POST['to'] + ) . '" LIMIT 1' + ) + ); + if (!isset($to['id'])) { + $error = 'Получатель не найден в базе.'; + } elseif ($to['banned'] > 0) { + $error = 'Получатель был заблокирован.'; + } elseif ($to['id'] == $u->info['id']) { + $error = 'Нельзя отправлять самому себе.'; + } else { + $_POST['text'] = str_replace("\n", '
    ', $_POST['text']); + $_POST['text'] = str_replace("\r", '
    ', $_POST['text']); + mysql_query( + 'INSERT INTO `telegram` (`uid`,`from`,`tema`,`text`,`time`,`ip`) VALUES ("' . $to['id'] . '","' . $u->info['id'] . '","' . mysql_real_escape_string( + $_POST['tema'] + ) . '","' . mysql_real_escape_string($_POST['text']) . '","' . time( + ) . '","' . mysql_real_escape_string($u->info['ip']) . '")' + ); + unset($_POST['to'], $_POST['text'], $_POST['tema']); + $error = 'Сообщение доставлено "' . $to['login'] . '".'; + } + } + } + if (isset($_POST['re']) && $_POST['re'] > 0 && !isset($_POST['to'])) { + $msg = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `telegram` WHERE `id` = "' . mysql_real_escape_string( + $_POST['re'] + ) . '" AND (`uid` = "' . $u->info['id'] . '" OR `from` = "' . $u->info['id'] . '") LIMIT 1' + ) + ); + if (isset($msg['id'])) { + $to = mysql_fetch_array( + mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "' . $msg['uid'] . '" LIMIT 1') + ); + $from = mysql_fetch_array( + mysql_query('SELECT `id`,`login`,`banned` FROM `users` WHERE `id` = "' . $msg['from'] . '" LIMIT 1') + ); + if ($msg['from'] == $u->info['id']) { + $_POST['to'] = $to['login']; + } elseif ($msg['uid'] == $u->info['id']) { + $_POST['to'] = $from['login']; + } else { + unset($msg); + } + $_POST['tema'] = 'Re:' . str_replace('Re:', '', $msg['tema']); + } + } + $html = '
    '; + $html .= '
    От:    ' . $u->info['login'] . '
    '; + $html .= '
    Кому:
    '; + $html .= '
    Тема:
    '; + $html .= '
    Сообщение:
    '; + $html .= '
    ' . $error . '
    '; + $html .= '
    '; + } +} elseif ($r == 1 || $r == 2) { + if ($r == 1) { + mysql_query( + 'UPDATE `telegram` SET `open` = "1" WHERE `uid` = "' . $u->info['id'] . '" AND `open` = "0" LIMIT 100' + ); + } + $pg = round((int)$_POST['p']); + if ($pg < 1) { + $pg = 1; + } + $pgssee = ceil(($pg - 1) * 9); + if ($r == 1) { + if (isset($_POST['del_msg'])) { + mysql_query( + 'UPDATE `telegram` SET `delete` = `delete` + 2 WHERE `uid` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 1) AND `id` = "' . mysql_real_escape_string( + $_POST['del_msg'] + ) . '" LIMIT 1' + ); + } + $sp = mysql_query( + 'SELECT * FROM `telegram` WHERE `uid` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 1) ORDER BY `id` DESC LIMIT ' . mysql_real_escape_string( + $pgssee + ) . ',10' + ); + } elseif ($r == 2) { + if (isset($_POST['del_msg'])) { + mysql_query( + 'UPDATE `telegram` SET `delete` = `delete` + 1 WHERE `from` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 2) AND `id` = "' . mysql_real_escape_string( + $_POST['del_msg'] + ) . '" LIMIT 1' + ); + } + $sp = mysql_query( + 'SELECT * FROM `telegram` WHERE `from` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 2) ORDER BY `id` DESC LIMIT ' . mysql_real_escape_string( + $pgssee + ) . ',10' + ); + } + $msgs = 0; + while ($pl = mysql_fetch_array($sp)) { + if ($msgs < 9) { + if ($r == 1) { + $from = mysql_fetch_array( + mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $pl['from'] . '" LIMIT 1') + ); + } + if ($r == 2) { + $from = mysql_fetch_array( + mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1') + ); + } + if (!isset($from['id'])) { + $from = '' . $pl['from'] . ''; + } else { + $from = '' . $from['login'] . ''; + } + //if($r == 1) { + if ($pl['read'] == 0 || $pl['read'] == 1) { + $pl['read'] = 0; + } else { + $pl['read'] = 1; + } + + + if ($r == 1) { + $html .= ' +
    + ' . date('d.m.y', $pl['time']) . ' + От: ' . $from . ' + Тема: ' . $pl['tema'] . ' +
    '; - } - if($r == 2) { - $html .= ' -
    - '.date('d.m.y',$pl['time']).' - Кому: '.$from.' - Тема: '.$pl['tema'].' - + } + if ($r == 2) { + $html .= ' +
    + ' . date('d.m.y', $pl['time']) . ' + Кому: ' . $from . ' + Тема: ' . $pl['tema'] . ' +
    '; - } - } - $msgs++; - } - - if($msgs > 9 || $pg > 1) { - if($html != '') { - $html .= '
    '; - if($r == 1) { - $pgs = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `telegram` WHERE `uid` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 1)')); - }else if($r == 2) { - $pgs = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `telegram` WHERE `from` = "'.$u->info['id'].'" AND (`delete` = 0 OR `delete` = 2)')); - } - $pgs = $pgs[0]; - $pga = ceil($pgs/9); - $i = 1; - while($i <= $pga) { - if($i == $pg) { - $html .= ' '.$i.''; - }else{ - $html .= ' '.$i.''; - } - $i++; - } - $html .= '
    '; - }else{ - $js .= 'top.tgf_rz('.$r.','.($pg-1).');'; - } - } - } - - $js .= 'top.tgf_loading(2)'; - if($js != '') { - $js = ''; - } - if($html == '') { - if($r == 1) { - $html = '







    У Вас нет сообщений от других пользователей
    '; - }elseif($r == 2) { - $html = '







    У Вас нет сообщений отправленных другим пользователям
    '; - } - } - - echo $html.$js; -?> \ No newline at end of file + } + } + $msgs++; + } + + if ($msgs > 9 || $pg > 1) { + if ($html != '') { + $html .= '
    '; + if ($r == 1) { + $pgs = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `telegram` WHERE `uid` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 1)' + ) + ); + } else { + if ($r == 2) { + $pgs = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(`id`) FROM `telegram` WHERE `from` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 2)' + ) + ); + } + } + $pgs = $pgs[0]; + $pga = ceil($pgs / 9); + $i = 1; + while ($i <= $pga) { + if ($i == $pg) { + $html .= ' ' . $i . ''; + } else { + $html .= ' ' . $i . ''; + } + $i++; + } + $html .= '
    '; + } else { + $js .= 'top.tgf_rz(' . $r . ',' . ($pg - 1) . ');'; + } + } +} + +$js .= 'top.tgf_loading(2)'; +if ($js != '') { + $js = ''; +} +if ($html == '') { + if ($r == 1) { + $html = '







    У Вас нет сообщений от других пользователей
    '; + } elseif ($r == 2) { + $html = '







    У Вас нет сообщений отправленных другим пользователям
    '; + } +} + +echo $html . $js; diff --git a/test1.php b/test1.php deleted file mode 100644 index 47b2a0b5..00000000 --- a/test1.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/testing.php b/testing.php index b9f6043b..efa37206 100644 --- a/testing.php +++ b/testing.php @@ -1,253 +1,354 @@ -info['id']) || $u->info['admin'] < 1 ) { - header('location: https://new-combats.com/'); - die(); +if (!$u->info['admin']) { + header('location: https://new-combats.com/'); + die(); } $i = 0; -while( $i < 100 ) { - if(!isset($c['battle_cfg'][$i])) { - $c['battle_cfg'][$i] = 0; - } - $i++; +while ($i < 100) { + if (!isset($c['battle_cfg'][$i])) { + $c['battle_cfg'][$i] = 0; + } + $i++; } -if($u->info['admin'] > 0) { ?> - -Тестирование ботов - - - - - - - - - - - - + + Тестирование ботов + + + + + + + + + + + + - +

    Создать тестовый бой (Записать icq персу и скрыть: 17768719)



    -
    - + addNewbot(0,NULL,$user1,false,false); - $bot2 = $u->addNewbot(0,NULL,$user2,false,false); - mysql_query('UPDATE `users` SET `battle` = "'.$logid.'" WHERE `id` = "'.$bot1.'" LIMIT 1'); - mysql_query('UPDATE `users` SET `battle` = "'.$logid.'" WHERE `id` = "'.$bot2.'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = 100000000 , `bot` = 2 , `team` = "1" WHERE `id` = "'.$bot1.'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = 100000000 , `bot` = 2 , `team` = "2" WHERE `id` = "'.$bot2.'" LIMIT 1'); - // - mysql_query('INSERT INTO `battle_logs` ( + if (isset($_POST['botadminatack2'])) { + $error = ''; + $user1 = mysql_fetch_array( + mysql_query( + 'SELECT `a`.*,`b`.* FROM `users` AS `a` LEFT JOIN `stats` AS `b` ON `a`.`id` = `b`.`id` WHERE `a`.`id` = "' . mysql_real_escape_string( + $_POST['botadminatack1'] + ) . '" LIMIT 1' + ) + ); + $user2 = mysql_fetch_array( + mysql_query( + 'SELECT `a`.*,`b`.* FROM `users` AS `a` LEFT JOIN `stats` AS `b` ON `a`.`id` = `b`.`id` WHERE `a`.`id` = "' . mysql_real_escape_string( + $_POST['botadminatack2'] + ) . '" LIMIT 1' + ) + ); + if (isset($user1['id'], $user2['id'])) { + $user1['loclon'] = 1; + $user2['loclon'] = 1; + $user1['loclon555'] = 1; + $user2['loclon555'] = 1; + // + mysql_query( + 'INSERT INTO `battle` (`start1` , `city` , `time_start` , `timeout` , `type` ) VALUES ( + "' . time() . '","capitalcity" , "' . time() . '" , "60" , "329" + )' + ); + $logid = mysql_insert_id(); + // + $user1['login'] = $user1['login'] . ' (Бот для боя ' . $logid . ')'; + $user2['login'] = $user2['login'] . ' (Бот для боя ' . $logid . ')'; + // + $bot1 = $u->addNewbot(0, null, $user1, false, false); + $bot2 = $u->addNewbot(0, null, $user2, false, false); + mysql_query('UPDATE `users` SET `battle` = "' . $logid . '" WHERE `id` = "' . $bot1 . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `battle` = "' . $logid . '" WHERE `id` = "' . $bot2 . '" LIMIT 1'); + mysql_query( + 'UPDATE `stats` SET `hpNow` = 100000000 , `bot` = 2 , `team` = "1" WHERE `id` = "' . $bot1 . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `stats` SET `hpNow` = 100000000 , `bot` = 2 , `team` = "2" WHERE `id` = "' . $bot2 . '" LIMIT 1' + ); + // + mysql_query( + 'INSERT INTO `battle_logs` ( `time`,`battle`,`id_hod`,`type`,`text` ) VALUES ( - "'.time().'","'.$logid.'","1","1","Часы показывали '.date('d.m.Y H:i:s').', когда '.$user1['login'].' и '.$user2['login'].' бросили вызов друг другу." - )'); - // - //Эффекты - $i = 0; - while( $i < 1000 ) { - // - $efs = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.$i.'" LIMIT 1')); - if( $_POST['eu1_'.$efs['id2']] == 1 ) { - mysql_query('INSERT INTO `eff_users` + "' . time() . '","' . $logid . '","1","1","Часы показывали ' . date( + 'd.m.Y H:i:s' + ) . ', когда ' . $user1['login'] . ' и ' . $user2['login'] . ' бросили вызов друг другу." + )' + ); + // + //Эффекты + $i = 0; + while ($i < 1000) { + // + $efs = mysql_fetch_array( + mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $i . '" LIMIT 1') + ); + if ($_POST['eu1_' . $efs['id2']] == 1) { + mysql_query( + 'INSERT INTO `eff_users` ( `id_eff` , `uid` , `name` , `data` , `timeUse` ) VALUES ( - "'.$efs['id2'].'" , "'.$bot1.'" , "'.$efs['mname'].'" , "'.$efs['mdata'].'" , "'.time().'" - )'); - } - if( $_POST['eu2_'.$efs['id2']] == 1 ) { - mysql_query('INSERT INTO `eff_users` + "' . $efs['id2'] . '" , "' . $bot1 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time( + ) . '" + )' + ); + } + if ($_POST['eu2_' . $efs['id2']] == 1) { + mysql_query( + 'INSERT INTO `eff_users` ( `id_eff` , `uid` , `name` , `data` , `timeUse` ) VALUES ( - "'.$efs['id2'].'" , "'.$bot2.'" , "'.$efs['mname'].'" , "'.$efs['mdata'].'" , "'.time().'" - )'); - } - // - $i++; - } - // - function inuser_go_btl($id) { - if(isset($id['id'])) { - file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid='.$id['id'].'&cron_core='.md5($id['id'].'_brfCOreW@!_'.$id['pass']).'&pass='.$id['pass']); - } - } - $sp = mysql_query('SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = "-1" AND `time_over` = "0" AND `type` = 329 LIMIT 100'); - while($pl = mysql_fetch_array($sp)) { - $user1 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` = "'.$pl['id'].'" LIMIT 1')); - inuser_go_btl($user1); - } - // - $error = 'Бой между '.$user1['login'].' ['.$user1['level'].'] и '.$user2['login'].' ['.$user2['level'].'] начался! Лог боя'; - }else{ - $error = 'Один из персонажей не найден в базе.'; - } - - echo '
    '.$error.'
    '; -} + "' . $efs['id2'] . '" , "' . $bot2 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time( + ) . '" + )' + ); + } + // + $i++; + } + // + function inuser_go_btl($id) + { + if (isset($id['id'])) { + file_get_contents( + 'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5( + $id['id'] . '_brfCOreW@!_' . $id['pass'] + ) . '&pass=' . $id['pass'] + ); + } + } -// -$ef1 = ''; -$ef2 = ''; -$sp = mysql_query('SELECT * FROM `eff_main` WHERE `mdata` != "" AND `actionTime` > 0 ORDER BY `mname` ASC'); -$i = 0; -while( $pl = mysql_fetch_array($sp) ) { - $i++; - // - //Действие эффекта - $ei = ''; - $tr = ''; $t = $u->items['add']; - $x = 0; $ed = $u->lookStats($pl['mdata']); - while($xis[$n])) { - $z = ''; - if($ed['add_'.$n]>0) { - $z = '+'; - } - $tr .= '
    '.$u->is[$n].': '.$z.''.$ed['add_'.$n]; - } - $x++; - } - if($tr!='') { - $ei .= $tr; - } - if($e['info']!='') { - $ei .= '
    Информация:
    '.$e['info']; - } - // - $ef = ''; - $ef1 .= ''.$ef.''; - $ef2 .= ''.$ef.''; -} -// -$dv = ''; -$da = ''; -$dv .= ''; -$da = ''; -?> - - - - - - - - - - - - - - - - -
      -

    - -  

    -

     

      против    -

    - -  

    -

     

     эффекты
     
     

     
    -
    - + $sp = mysql_query( + 'SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = "-1" AND `time_over` = "0" AND `type` = 329 LIMIT 100' + ); + while ($pl = mysql_fetch_array($sp)) { + $user1 = mysql_fetch_array( + mysql_query('SELECT * FROM `users` WHERE `battle` = "' . $pl['id'] . '" LIMIT 1') + ); + inuser_go_btl($user1); + } + // + $error = 'Бой между ' . $user1['login'] . ' [' . $user1['level'] . '] и ' . $user2['login'] . ' [' . $user2['level'] . '] начался! Лог боя'; + } else { + $error = 'Один из персонажей не найден в базе.'; + } + + echo '
    ' . $error . '
    '; + } + + // + $ef1 = ''; + $ef2 = ''; + $sp = mysql_query('SELECT * FROM `eff_main` WHERE `mdata` != "" AND `actionTime` > 0 ORDER BY `mname` ASC'); + $i = 0; + while ($pl = mysql_fetch_array($sp)) { + $i++; + // + //Действие эффекта + $ei = ''; + $tr = ''; + $t = $u->items['add']; + $x = 0; + $ed = $u->lookStats($pl['mdata']); + while ($x < count($t)) { + $n = $t[$x]; + if (isset($ed['add_' . $n], $u->is[$n])) { + $z = ''; + if ($ed['add_' . $n] > 0) { + $z = '+'; + } + $tr .= '
    ' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n]; + } + $x++; + } + if ($tr != '') { + $ei .= $tr; + } + if ($e['info'] != '') { + $ei .= '
    Информация:
    ' . $e['info']; + } + // + $ef = ''; + $ef1 .= '' . $ef . ''; + $ef2 .= '' . $ef . ''; + } + // + $dv = ''; + $da = ''; + $dv .= ''; + $da = ''; + ?> + + + + + + + + + + + + + + + + +
      +

    + +  

    +

     

      против    +

    + +  

    +

     

     эффекты
     
     

     
    +
    +
    - \ No newline at end of file diff --git a/towerlog.php b/towerlog.php index 29a66848..b6a05dba 100644 --- a/towerlog.php +++ b/towerlog.php @@ -1,67 +1,129 @@ - +$r = ''; +$p = ''; +$b = '
    '; -if( !isset($_GET['towerid'])) { - $_GET['towerid'] = 1; +if (!isset($_GET['towerid'])) { + $_GET['towerid'] = 1; } $_GET['towerid'] = round((int)$_GET['towerid']); $notowerlog = false; -$log = mysql_fetch_array(mysql_query('SELECT `id`,`count_bs`,`m` FROM `bs_logs` WHERE `count_bs` = "'.mysql_real_escape_string((int)$_GET['id']).'" AND `id_bs` = "'.mysql_real_escape_string($_GET['towerid']).'" ORDER BY `id` ASC LIMIT 1')); -if(!isset($log['id'])) -{ - $notowerlog = true; - $r = '

    Скорее всего Архивариус снова потерял пергамент с хрониками турниров ...
    '; -}else{ - $sp = mysql_query('SELECT * FROM `bs_logs` WHERE `count_bs` = "'.$log['count_bs'].'" ORDER BY `id` ASC'); - while( $pl = mysql_fetch_array($sp) ) { - $datesb = ''; - if( $pl['type'] == 2 ) { - $datesb = '2'; - } - $r .= '
    '.date('d.m.y H:i',$pl['time']).' '.$pl['text'].''; - } +$log = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`count_bs`,`m` FROM `bs_logs` WHERE `count_bs` = "' . mysql_real_escape_string( + (int)$_GET['id'] + ) . '" AND `id_bs` = "' . mysql_real_escape_string($_GET['towerid']) . '" ORDER BY `id` LIMIT 1' + ) +); +if (!isset($log['id'])) { + $notowerlog = true; + $r = '

    Скорее всего Архивариус снова потерял пергамент с хрониками турниров ...
    '; +} else { + $sp = mysql_query('SELECT * FROM `bs_logs` WHERE `count_bs` = "' . $log['count_bs'] . '" ORDER BY `id` '); + while ($pl = mysql_fetch_array($sp)) { + $datesb = ''; + if ($pl['type'] == 2) { + $datesb = '2'; + } + $r .= '
    ' . date('d.m.y H:i', $pl['time']) . ' ' . $pl['text'] . ''; + } } ?> - -Архив: Турнир в Башне Смерти - - - + + Архив: Турнир в Башне Смерти + + +

    Башня Смерти. Отчет о турнире.   www.new-combats.com

    - -Призовой фонд: кр. + + Призовой фонд: кр. diff --git a/transfer.php b/transfer.php index 66f9bcec..c3f2b80c 100644 --- a/transfer.php +++ b/transfer.php @@ -1,386 +1,449 @@ info['repass'] > 0) { - die(); - } - - if(isset($u->tfer['id']) && $u->info['align'] != 2) - { - if($u->tfer['finish1']==0 && $u->tfer['finish2']==0) - { - $js = ''; $mn = 0; - if(isset($_POST['cancel2'])) - { - $u->tfer['r0'] = time(); - $u->tfer['good1'] = 0; - $u->tfer['good2'] = 0; - $_POST['id'] = 'reflesh'; - mysql_query('UPDATE `transfers` SET `r0` = "'.$u->tfer['r0'].'",`r1` = "0",`r2` = "0",`good1` = "0",`good2` = "0" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - }elseif(isset($_POST['start2'])) - { - //сохраняем обмен - if($u->tfer['good1']>0 && $u->tfer['good2']>0) - { - //завершаем обмен - $u->tfer['cancel1'] = time(); - $u->tfer['cancel2'] = time(); - $u->tfer['finish1'] = time(); - $u->tfer['finish2'] = time(); - //меняем вещи + передаем КР и завершаем передачи, переход на лог передач - $upd2 = mysql_query('UPDATE `transfers` SET `cancel1` = "'.$u->tfer['cancel1'].'",`cancel2` = "'.$u->tfer['cancel2'].'",`finish1` = "'.$u->tfer['finish1'].'",`finish2` = "'.$u->tfer['finish2'].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - //Обмениваем деньги - $mn1 = 0; - $mn2 = 0; - $inf = array(); - $inf[$u->tfer['uid1']] = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$u->tfer['uid1'].'" LIMIT 1')); - $inf[$u->tfer['uid2']] = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$u->tfer['uid2'].'" LIMIT 1')); - if($inf[$u->tfer['uid1']]['money']<$u->tfer['money1']) - { - $u->tfer['money1'] = $inf[$u->tfer['uid1']]['money']; - } - if($inf[$u->tfer['uid2']]['money']<$u->tfer['money2']) - { - $u->tfer['money2'] = $inf[$u->tfer['uid2']]['money']; - } +if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { + define('GAME', true); + include('_incl_data/__config.php'); + include('_incl_data/class/__db_connect.php'); + $u = User::start(); - $mn1 = $u->tfer['money1']; - $mn2 = $u->tfer['money2']; - if($mn1<0){ $mn1 = 0; } - if($mn2<0){ $mn2 = 0; } - - if($mn1>0) - { - //игрок 1 передает деньги игроку 2 - $upd = mysql_query('UPDATE `users` SET `money` = `money` - "'.$mn1.'" WHERE `id` = "'.$inf[$u->tfer['uid1']]['id'].'" LIMIT 1'); - if($upd) - { - $upd = mysql_query('UPDATE `users` SET `money` = `money` + "'.$mn1.'" WHERE `id` = "'.$inf[$u->tfer['uid2']]['id'].'" LIMIT 1'); - if($upd) - { - $u->addDelo(2,$inf[$u->tfer['uid1']]['id'],'"System.transfer.MONEY": Передано '.$mn1.' кр. персонажу "'.$inf[$u->tfer['uid2']]['login'].'" ('.$inf[$u->tfer['uid2']]['id'].').',time(),$u->info['city'],'System.transfer',0,0); - $u->addDelo(2,$inf[$u->tfer['uid2']]['id'],'"System.transfer.MONEY": Получено '.$mn1.' кр. от персонажа "'.$inf[$u->tfer['uid1']]['login'].'" ('.$inf[$u->tfer['uid1']]['id'].').',time(),$u->info['city'],'System.transfer',0,0); - }else{ - $u->addDelo(2,$inf[$u->tfer['uid1']]['id'],'"System.transfer.MONEY": Передано '.$mn1.' кр. персонажу "'.$inf[$u->tfer['uid2']]['login'].'" ('.$inf[$u->tfer['uid2']]['id'].'), ошибка во время передачи.',time(),$u->info['city'],'System.transfer',0,0); - } - } - } - - if($mn2>0) - { - //игрок 2 передает деньги игроку 1 - $upd = mysql_query('UPDATE `users` SET `money` = `money` - "'.$mn2.'" WHERE `id` = "'.$inf[$u->tfer['uid2']]['id'].'" LIMIT 1'); - if($upd) - { - $upd = mysql_query('UPDATE `users` SET `money` = `money` + "'.$mn2.'" WHERE `id` = "'.$inf[$u->tfer['uid1']]['id'].'" LIMIT 1'); - if($upd) - { - $u->addDelo(2,$inf[$u->tfer['uid2']]['id'],'"System.transfer.MONEY": Передано '.$mn2.' кр. персонажу "'.$inf[$u->tfer['uid1']]['login'].'" ('.$inf[$u->tfer['uid1']]['id'].').',time(),$u->info['city'],'System.transfer',0,0); - $u->addDelo(2,$inf[$u->tfer['uid1']]['id'],'"System.transfer.MONEY": Получено '.$mn2.' кр. от персонажа "'.$inf[$u->tfer['uid2']]['login'].'" ('.$inf[$u->tfer['uid2']]['id'].').',time(),$u->info['city'],'System.transfer',0,0); - }else{ - $u->addDelo(2,$inf[$u->tfer['uid2']]['id'],'"System.transfer.MONEY": Передано '.$mn2.' кр. персонажу "'.$inf[$u->tfer['uid1']]['login'].'" ('.$inf[$u->tfer['uid1']]['id'].'), ошибка во время передачи.',time(),$u->info['city'],'System.transfer',0,0); - } - } - } - - //Обмениваем предметы - $sp = mysql_query('SELECT `u`.*,`m`.`price1`,`m`.`price2`,`m`.`name` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE (`u`.`uid`="'.$u->tfer['uid1'].'" OR `u`.`uid`="'.$u->tfer['uid2'].'") AND `u`.`delete`="0" AND `u`.`inOdet`="0" AND `u`.`inShop`="0" AND `u`.`inTransfer` > "0" AND `u`.`data` NOT LIKE "%|zazuby=%"'); - $nalog = 0; $fu = 0; $x = 0; $uus = array(); - while($pl = mysql_fetch_array($sp)) - { - $x = $u->itemsX($pl['id'],$pl['uid']); - $fu = $pl['uid']; - if($pl['uid']==$u->tfer['uid1']) - { - $pl['uid'] = $u->tfer['uid2']; - }elseif($pl['uid']==$u->tfer['uid2']) - { - $pl['uid'] = $u->tfer['uid1']; - } - $us = $inf[$pl['uid']]; - $uus = $inf[$fu]; - if($pl['inTransfer']==1) - { - //подарок - $pl['gift'] = $uus['login']; - }else{ - //налог - $nalog += 1; - } - $upd = mysql_query('UPDATE `items_users` SET `uid` = "'.$pl['uid'].'",`gift` = "'.$pl['gift'].'" WHERE `id` = "'.$pl['id'].'" AND `inShop` = "0" AND `delete` < "1234567891" AND `inOdet` = "0" AND `data` NOT LIKE "%|zazuby=%"'); - if($upd) - { - if( $pl['2price'] == 0 && $pl['1price'] == 0 ) { - $pl['2price'] = $pl['price2']; - } - if( $pl['1price'] == 0 && $pl['2price'] == 0) { - $pl['1price'] = $pl['price1']; - } - $po = $u->lookStats($pl['data']); - $i_s = ''; - if(isset($po['frompisher']) && $po['frompisher'] > 0) { $i_s = '[Предмет из подземелья]'; } - //заносим в личные дела - $u->addDelo(2,$fu,'"System.transfer": Предмет "'.$pl['name'].' (стоимость: '.$pl['1price'].' кр. , '.$pl['2price'].' екр.) (x'.$x.')" [itm:'.$pl['id'].'] '.$i_s.' был передан персонажу "'.$us['login'].'"('.$pl['uid'].'), Тип передачи: '.$pl['inTransfer'].'.',time(),$u->info['city'],'System.transfer',0,0); - $u->addDelo(2,$pl['uid'],'"System.transfer": Персонаж "'.$uus['login'].'"('.$uus['id'].') передал предмет "'.$pl['name'].' '.$i_s.' (стоимость: '.$pl['1price'].' кр. , '.$pl['2price'].' екр.) (x'.$x.')" [itm:'.$pl['id'].'], Тип передачи: '.$pl['inTransfer'].'.',time(),$u->info['city'],'System.transfer',0,0); - }else{ - echo 'Ошибка передачи предмета'; - } - } - $upd1 = mysql_query('UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid`="'.$u->tfer['uid1'].'" OR `uid`="'.$u->tfer['uid2'].'") AND `delete` < "1234567891" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%"'); - if($upd1 && $upd2) - { - $js .= 'location = location;'; - } - unset($upd1,$upd2,$fu,$nalog,$x,$us,$uus,$inf); - }else{ - //подтверждение обмена - $u->tfer['r0'] = time(); - if($u->tfer['uid1']==$u->info['id']) - { - $u->tfer['good1'] = time(); $mn = 1; - mysql_query('UPDATE `transfers` SET `r0` = "'.$u->tfer['r0'].'",`r1` = "0",`r2` = "0",`good1` = "'.$u->tfer['good1'].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - }else{ - $u->tfer['good2'] = time(); $mn = 1; - mysql_query('UPDATE `transfers` SET `r0` = "'.$u->tfer['r0'].'",`r1` = "0",`r2` = "0",`good2` = "'.$u->tfer['good2'].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - } - $_POST['id'] = 'reflesh'; - } - }elseif($_POST['id']=='sale' && isset($_POST['cancelid']) && $u->tfer['good1']==0 && $u->tfer['good2']==0) - { - $upd = mysql_query('UPDATE `items_users` SET `inTransfer` = "0" WHERE `id` = "'.mysql_real_escape_string($_POST['cancelid']).'" AND `uid`="'.$u->info['id'].'" AND `delete`="0" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%" LIMIT 1'); - if($upd) - { - $u->tfer['r0'] = time(); - mysql_query('UPDATE `transfers` SET `r0` = "'.$u->tfer['r0'].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - $_POST['id'] = 'reflesh'; - } - }elseif($_POST['id']=='sale' && isset($_POST['itemid']) && $u->tfer['good1']==0 && $u->tfer['good2']==0) - { - $g = 1; - $itm = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "'.mysql_real_escape_string($_POST['itemid']).'" AND `iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` = "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" LIMIT 1')); - if(isset($itm['id'])) - { - $po = $u->lookStats($itm['data']); - if(isset($po['sudba']) && $po['sudba']!='0') - { - $g = 0; - } - if($itm['inTransfer']>0) - { - $g = 0; - } - }else{ - $g = 0; - } - if($g==1) - { - if($_POST['saletype']==2) - { - $g = 2; - }else{ - $g = 1; - } - mysql_query('UPDATE `items_users` SET `inTransfer` = "'.((int)$g).'",`inGroup` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1'); - $u->tfer['r0'] = time(); - mysql_query('UPDATE `transfers` SET `r0` = "'.$u->tfer['r0'].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - $_POST['id'] = 'reflesh'; - } - } - - if($_POST['id']=='reflesh') - { - //обновление инвентаря - $i = 1; - while($i<=6) - { - $itmAll = ''; $itmAllSee = ''; - $itmAll = $u->genInv(5,'`iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`data` NOT LIKE "%toclan='.$u->info['clan'].'#%" AND `iu`.`delete` = 0 AND `iu`.`inOdet` =0 AND `iu`.`inShop` = 0 AND `im`.`inRazdel` = "'.$i.'" AND `iu`.`inTransfer` = 0 ORDER BY `lastUPD` DESC'); - - if($itmAll[0]==0) - { - $itmAllSee = '
    ПУСТО
    '.$r.'
    '; - $r = '
    '.$r.'
    '; - unset($x); - return $r; - } - //Точно обновляем :) - $itm = array(1=>'',2=>''); - //предметы персонажа 1 - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="'.$u->tfer['uid1'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC'); - $cl = 2; - while($pl = mysql_fetch_array($sp)) - { - if($cl==2) - { - $cl = 1; - }else{ - $cl = 2; - } - $itm[1] .= itmInfotf($pl,$cl); - } - //предметы персонажа 2 - $sp = mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="'.$u->tfer['uid2'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC'); - $cl = 2; - while($pl = mysql_fetch_array($sp)) - { - if($cl==2) - { - $cl = 1; - }else{ - $cl = 2; - } - $itm[2] .= itmInfotf($pl,$cl); - } - unset($cl); - if($itm[1]=='') - { - $itm[1] = ' '; - } - if($itm[2]=='') - { - $itm[2] = ' '; - } - - if($u->info['id']==$u->tfer['uid1']) - { - $js .= '$("#s2g3").html(\''.$itm[1].'\');$("#s2g2").html(\''.$itm[2].'\');'; - }else{ - $js .= '$("#s2g3").html(\''.$itm[2].'\');$("#s2g2").html(\''.$itm[1].'\');'; - } - $u->tfer['r'.$f] = $u->tfer['r0']; - mysql_query('UPDATE `transfers` SET `r'.$f.'` = "'.$u->tfer['r'.$f].'" WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - } - if(($u->tfer['good1']>0 && $u->info['id']==$u->tfer['uid1']) || ($u->tfer['good2']>0 && $u->info['id']==$u->tfer['uid2'])) - { - $js .= '$(\'#btn1\').html(\'Обменять\');'; - if($u->tfer['good1']>0 && $u->tfer['good2']>0) - { - $js .= '$(\'#btn1\').attr(\'disabled\',\'\');'; - }else{ - $js .= '$(\'#btn1\').attr(\'disabled\',\'disabled\');'; - } - }else{ - $js .= '$(\'#btn1\').html(\'Готов к обмену\');$(\'#btn1\').attr(\'disabled\',\'\');'; - } - - //Обновляем деньги в кассе :) - if($u->tfer['uid1']==$u->info['id']) - { - if($u->tfer['good1']>0){ $js .= '$(\'#gd2\').css(\'display\',\'\');'; }else{ $js .= '$(\'#gd2\').css(\'display\',\'none\');'; } //вы - if($u->tfer['good2']>0){ $js .= '$(\'#gd1\').css(\'display\',\'\');'; }else{ $js .= '$(\'#gd1\').css(\'display\',\'none\');'; } - - if(($u->tfer['good1']==0 && $u->tfer['good2']==0) || $mn == 1) - { - if( $u->tfer['money1'] != round($_POST['money'],2) ) { - $u->tfer['money1'] = round($_POST['money'],2); - if($u->tfer['money1']>$u->info['money']) - { - $u->tfer['money1'] = $u->info['money']; - } - if($u->tfer['money1']<0) - { - $u->tfer['money1'] = 0; - } - mysql_query('UPDATE `transfers` SET `money1` = "'.mysql_real_escape_string($u->tfer['money1']).'",`good1` = 0,`good2` = 0 WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - } - } - }else{ - if($u->tfer['good2']>0){ $js .= '$(\'#gd2\').css(\'display\',\'\');'; }else{ $js .= '$(\'#gd2\').css(\'display\',\'none\');'; } //вы - if($u->tfer['good1']>0){ $js .= '$(\'#gd1\').css(\'display\',\'\');'; }else{ $js .= '$(\'#gd1\').css(\'display\',\'none\');'; } - - if(($u->tfer['good1']==0 && $u->tfer['good2']==0) || $mn == 1) - { - if( $u->tfer['money2'] != round($_POST['money'],2) ) { - $u->tfer['money2'] = round($_POST['money'],2); - if($u->tfer['money2']>$u->info['money']) - { - $u->tfer['money2'] = $u->info['money']; - } - if($u->tfer['money1']<0) - { - $u->tfer['money1'] = 0; - } - mysql_query('UPDATE `transfers` SET `money2` = "'.mysql_real_escape_string($u->tfer['money2']).'",`good1` = 0,`good2` = 0 WHERE `id` = "'.$u->tfer['id'].'" LIMIT 1'); - } - } - } - if($u->info['id']==$u->tfer['uid1']) - { - $js .= 'refmoney('.$u->round2($u->tfer['money2']).','.$u->round2($u->tfer['money1']).');'; - }else{ - $js .= 'refmoney('.$u->round2($u->tfer['money1']).','.$u->round2($u->tfer['money2']).');'; - } - } - if($js!='') - { - echo ''; - } - }else{ - echo ''; - } - }else{ - echo ''; - } + if ($u->info['repass'] > 0) { + die(); + } + + if (isset($u->tfer['id']) && $u->info['align'] != 2) { + if ($u->tfer['finish1'] == 0 && $u->tfer['finish2'] == 0) { + $js = ''; + $mn = 0; + if (isset($_POST['cancel2'])) { + $u->tfer['r0'] = time(); + $u->tfer['good1'] = 0; + $u->tfer['good2'] = 0; + $_POST['id'] = 'reflesh'; + mysql_query( + 'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good1` = "0",`good2` = "0" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } elseif (isset($_POST['start2'])) { + //сохраняем обмен + if ($u->tfer['good1'] > 0 && $u->tfer['good2'] > 0) { + //завершаем обмен + $u->tfer['cancel1'] = time(); + $u->tfer['cancel2'] = time(); + $u->tfer['finish1'] = time(); + $u->tfer['finish2'] = time(); + //меняем вещи + передаем КР и завершаем передачи, переход на лог передач + $upd2 = mysql_query( + 'UPDATE `transfers` SET `cancel1` = "' . $u->tfer['cancel1'] . '",`cancel2` = "' . $u->tfer['cancel2'] . '",`finish1` = "' . $u->tfer['finish1'] . '",`finish2` = "' . $u->tfer['finish2'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + //Обмениваем деньги + $mn1 = 0; + $mn2 = 0; + $inf = []; + $inf[$u->tfer['uid1']] = mysql_fetch_array( + mysql_query('SELECT * FROM `users` WHERE `id` = "' . $u->tfer['uid1'] . '" LIMIT 1') + ); + $inf[$u->tfer['uid2']] = mysql_fetch_array( + mysql_query('SELECT * FROM `users` WHERE `id` = "' . $u->tfer['uid2'] . '" LIMIT 1') + ); + if ($inf[$u->tfer['uid1']]['money'] < $u->tfer['money1']) { + $u->tfer['money1'] = $inf[$u->tfer['uid1']]['money']; + } + if ($inf[$u->tfer['uid2']]['money'] < $u->tfer['money2']) { + $u->tfer['money2'] = $inf[$u->tfer['uid2']]['money']; + } + + $mn1 = $u->tfer['money1']; + $mn2 = $u->tfer['money2']; + if ($mn1 < 0) { + $mn1 = 0; + } + if ($mn2 < 0) { + $mn2 = 0; + } + + if ($mn1 > 0) { + //игрок 1 передает деньги игроку 2 + $upd = mysql_query( + 'UPDATE `users` SET `money` = `money` - "' . $mn1 . '" WHERE `id` = "' . $inf[$u->tfer['uid1']]['id'] . '" LIMIT 1' + ); + if ($upd) { + $upd = mysql_query( + 'UPDATE `users` SET `money` = `money` + "' . $mn1 . '" WHERE `id` = "' . $inf[$u->tfer['uid2']]['id'] . '" LIMIT 1' + ); + if ($upd) { + $u->addDelo( + 2, $inf[$u->tfer['uid1']]['id'], + '"System.transfer.MONEY": Передано ' . $mn1 . ' кр. персонажу "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . ').', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + $u->addDelo( + 2, $inf[$u->tfer['uid2']]['id'], + '"System.transfer.MONEY": Получено ' . $mn1 . ' кр. от персонажа "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . ').', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + } else { + $u->addDelo( + 2, $inf[$u->tfer['uid1']]['id'], + '"System.transfer.MONEY": Передано ' . $mn1 . ' кр. персонажу "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . '), ошибка во время передачи.', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + } + } + } + + if ($mn2 > 0) { + //игрок 2 передает деньги игроку 1 + $upd = mysql_query( + 'UPDATE `users` SET `money` = `money` - "' . $mn2 . '" WHERE `id` = "' . $inf[$u->tfer['uid2']]['id'] . '" LIMIT 1' + ); + if ($upd) { + $upd = mysql_query( + 'UPDATE `users` SET `money` = `money` + "' . $mn2 . '" WHERE `id` = "' . $inf[$u->tfer['uid1']]['id'] . '" LIMIT 1' + ); + if ($upd) { + $u->addDelo( + 2, $inf[$u->tfer['uid2']]['id'], + '"System.transfer.MONEY": Передано ' . $mn2 . ' кр. персонажу "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . ').', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + $u->addDelo( + 2, $inf[$u->tfer['uid1']]['id'], + '"System.transfer.MONEY": Получено ' . $mn2 . ' кр. от персонажа "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . ').', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + } else { + $u->addDelo( + 2, $inf[$u->tfer['uid2']]['id'], + '"System.transfer.MONEY": Передано ' . $mn2 . ' кр. персонажу "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . '), ошибка во время передачи.', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + } + } + } + + //Обмениваем предметы + $sp = mysql_query( + 'SELECT `u`.*,`m`.`price1`,`m`.`price2`,`m`.`name` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE (`u`.`uid`="' . $u->tfer['uid1'] . '" OR `u`.`uid`="' . $u->tfer['uid2'] . '") AND `u`.`delete`="0" AND `u`.`inOdet`="0" AND `u`.`inShop`="0" AND `u`.`inTransfer` > "0" AND `u`.`data` NOT LIKE "%|zazuby=%"' + ); + $nalog = 0; + $fu = 0; + $x = 0; + $uus = []; + while ($pl = mysql_fetch_array($sp)) { + $x = $u->itemsX($pl['id'], $pl['uid']); + $fu = $pl['uid']; + if ($pl['uid'] == $u->tfer['uid1']) { + $pl['uid'] = $u->tfer['uid2']; + } elseif ($pl['uid'] == $u->tfer['uid2']) { + $pl['uid'] = $u->tfer['uid1']; + } + $us = $inf[$pl['uid']]; + $uus = $inf[$fu]; + if ($pl['inTransfer'] == 1) { + //подарок + $pl['gift'] = $uus['login']; + } else { + //налог + $nalog += 1; + } + $upd = mysql_query( + 'UPDATE `items_users` SET `uid` = "' . $pl['uid'] . '",`gift` = "' . $pl['gift'] . '" WHERE `id` = "' . $pl['id'] . '" AND `inShop` = "0" AND `delete` < "1234567891" AND `inOdet` = "0" AND `data` NOT LIKE "%|zazuby=%"' + ); + if ($upd) { + if ($pl['2price'] == 0 && $pl['1price'] == 0) { + $pl['2price'] = $pl['price2']; + } + if ($pl['1price'] == 0 && $pl['2price'] == 0) { + $pl['1price'] = $pl['price1']; + } + $po = $u->lookStats($pl['data']); + $i_s = ''; + if (isset($po['frompisher']) && $po['frompisher'] > 0) { + $i_s = '[Предмет из подземелья]'; + } + //заносим в личные дела + $u->addDelo( + 2, $fu, + '"System.transfer": Предмет "' . $pl['name'] . ' (стоимость: ' . $pl['1price'] . ' кр. , ' . $pl['2price'] . ' екр.) (x' . $x . ')" [itm:' . $pl['id'] . '] ' . $i_s . ' был передан персонажу "' . $us['login'] . '"(' . $pl['uid'] . '), Тип передачи: ' . $pl['inTransfer'] . '.', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + $u->addDelo( + 2, $pl['uid'], + '"System.transfer": Персонаж "' . $uus['login'] . '"(' . $uus['id'] . ') передал предмет "' . $pl['name'] . ' ' . $i_s . ' (стоимость: ' . $pl['1price'] . ' кр. , ' . $pl['2price'] . ' екр.) (x' . $x . ')" [itm:' . $pl['id'] . '], Тип передачи: ' . $pl['inTransfer'] . '.', + time(), $u->info['city'], 'System.transfer', 0, 0 + ); + } else { + echo 'Ошибка передачи предмета'; + } + } + $upd1 = mysql_query( + 'UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid`="' . $u->tfer['uid1'] . '" OR `uid`="' . $u->tfer['uid2'] . '") AND `delete` < "1234567891" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%"' + ); + if ($upd1 && $upd2) { + $js .= 'location = location;'; + } + unset($upd1, $upd2, $fu, $nalog, $x, $us, $uus, $inf); + } else { + //подтверждение обмена + $u->tfer['r0'] = time(); + if ($u->tfer['uid1'] == $u->info['id']) { + $u->tfer['good1'] = time(); + $mn = 1; + mysql_query( + 'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good1` = "' . $u->tfer['good1'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } else { + $u->tfer['good2'] = time(); + $mn = 1; + mysql_query( + 'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good2` = "' . $u->tfer['good2'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } + $_POST['id'] = 'reflesh'; + } + } elseif ($_POST['id'] == 'sale' && isset($_POST['cancelid']) && $u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) { + $upd = mysql_query( + 'UPDATE `items_users` SET `inTransfer` = "0" WHERE `id` = "' . mysql_real_escape_string( + $_POST['cancelid'] + ) . '" AND `uid`="' . $u->info['id'] . '" AND `delete`="0" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%" LIMIT 1' + ); + if ($upd) { + $u->tfer['r0'] = time(); + mysql_query( + 'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + $_POST['id'] = 'reflesh'; + } + } elseif ($_POST['id'] == 'sale' && isset($_POST['itemid']) && $u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) { + $g = 1; + $itm = mysql_fetch_array( + mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . mysql_real_escape_string( + $_POST['itemid'] + ) . '" AND `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` = "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" LIMIT 1' + ) + ); + if (isset($itm['id'])) { + $po = $u->lookStats($itm['data']); + if (isset($po['sudba']) && $po['sudba'] != '0') { + $g = 0; + } + if ($itm['inTransfer'] > 0) { + $g = 0; + } + } else { + $g = 0; + } + if ($g == 1) { + if ($_POST['saletype'] == 2) { + $g = 2; + } else { + $g = 1; + } + mysql_query( + 'UPDATE `items_users` SET `inTransfer` = "' . ((int)$g) . '",`inGroup` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' + ); + $u->tfer['r0'] = time(); + mysql_query( + 'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + $_POST['id'] = 'reflesh'; + } + } + + if ($_POST['id'] == 'reflesh') { + //обновление инвентаря + $i = 1; + while ($i <= 6) { + $itmAll = ''; + $itmAllSee = ''; + $itmAll = $u->genInv( + 5, + '`iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`data` NOT LIKE "%toclan=' . $u->info['clan'] . '#%" AND `iu`.`delete` = 0 AND `iu`.`inOdet` =0 AND `iu`.`inShop` = 0 AND `im`.`inRazdel` = "' . $i . '" AND `iu`.`inTransfer` = 0 ORDER BY `lastUPD` DESC' + ); + + if ($itmAll[0] == 0) { + $itmAllSee = '
    ПУСТО
    ' . $r . '
    '; + $r = '
    ' . $r . '
    '; + unset($x); + return $r; + } + + //Точно обновляем :) + $itm = [1 => '', 2 => '']; + //предметы персонажа 1 + $sp = mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->tfer['uid1'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC' + ); + $cl = 2; + while ($pl = mysql_fetch_array($sp)) { + if ($cl == 2) { + $cl = 1; + } else { + $cl = 2; + } + $itm[1] .= itmInfotf($pl, $cl); + } + //предметы персонажа 2 + $sp = mysql_query( + 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->tfer['uid2'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC' + ); + $cl = 2; + while ($pl = mysql_fetch_array($sp)) { + if ($cl == 2) { + $cl = 1; + } else { + $cl = 2; + } + $itm[2] .= itmInfotf($pl, $cl); + } + unset($cl); + if ($itm[1] == '') { + $itm[1] = ' '; + } + if ($itm[2] == '') { + $itm[2] = ' '; + } + + if ($u->info['id'] == $u->tfer['uid1']) { + $js .= '$("#s2g3").html(\'' . $itm[1] . '\');$("#s2g2").html(\'' . $itm[2] . '\');'; + } else { + $js .= '$("#s2g3").html(\'' . $itm[2] . '\');$("#s2g2").html(\'' . $itm[1] . '\');'; + } + $u->tfer['r' . $f] = $u->tfer['r0']; + mysql_query( + 'UPDATE `transfers` SET `r' . $f . '` = "' . $u->tfer['r' . $f] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } + if (($u->tfer['good1'] > 0 && $u->info['id'] == $u->tfer['uid1']) || ($u->tfer['good2'] > 0 && $u->info['id'] == $u->tfer['uid2'])) { + $js .= '$(\'#btn1\').html(\'Обменять\');'; + if ($u->tfer['good1'] > 0 && $u->tfer['good2'] > 0) { + $js .= '$(\'#btn1\').attr(\'disabled\',\'\');'; + } else { + $js .= '$(\'#btn1\').attr(\'disabled\',\'disabled\');'; + } + } else { + $js .= '$(\'#btn1\').html(\'Готов к обмену\');$(\'#btn1\').attr(\'disabled\',\'\');'; + } + + //Обновляем деньги в кассе :) + if ($u->tfer['uid1'] == $u->info['id']) { + if ($u->tfer['good1'] > 0) { + $js .= '$(\'#gd2\').css(\'display\',\'\');'; + } else { + $js .= '$(\'#gd2\').css(\'display\',\'none\');'; + } //вы + if ($u->tfer['good2'] > 0) { + $js .= '$(\'#gd1\').css(\'display\',\'\');'; + } else { + $js .= '$(\'#gd1\').css(\'display\',\'none\');'; + } + + if (($u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) || $mn == 1) { + if ($u->tfer['money1'] != round($_POST['money'], 2)) { + $u->tfer['money1'] = round($_POST['money'], 2); + if ($u->tfer['money1'] > $u->info['money']) { + $u->tfer['money1'] = $u->info['money']; + } + if ($u->tfer['money1'] < 0) { + $u->tfer['money1'] = 0; + } + mysql_query( + 'UPDATE `transfers` SET `money1` = "' . mysql_real_escape_string( + $u->tfer['money1'] + ) . '",`good1` = 0,`good2` = 0 WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } + } + } else { + if ($u->tfer['good2'] > 0) { + $js .= '$(\'#gd2\').css(\'display\',\'\');'; + } else { + $js .= '$(\'#gd2\').css(\'display\',\'none\');'; + } //вы + if ($u->tfer['good1'] > 0) { + $js .= '$(\'#gd1\').css(\'display\',\'\');'; + } else { + $js .= '$(\'#gd1\').css(\'display\',\'none\');'; + } + + if (($u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) || $mn == 1) { + if ($u->tfer['money2'] != round($_POST['money'], 2)) { + $u->tfer['money2'] = round($_POST['money'], 2); + if ($u->tfer['money2'] > $u->info['money']) { + $u->tfer['money2'] = $u->info['money']; + } + if ($u->tfer['money1'] < 0) { + $u->tfer['money1'] = 0; + } + mysql_query( + 'UPDATE `transfers` SET `money2` = "' . mysql_real_escape_string( + $u->tfer['money2'] + ) . '",`good1` = 0,`good2` = 0 WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1' + ); + } + } + } + if ($u->info['id'] == $u->tfer['uid1']) { + $js .= 'refmoney(' . $u->round2($u->tfer['money2']) . ',' . $u->round2($u->tfer['money1']) . ');'; + } else { + $js .= 'refmoney(' . $u->round2($u->tfer['money1']) . ',' . $u->round2($u->tfer['money2']) . ');'; + } + } + if ($js != '') { + echo ''; + } + } else { + echo ''; + } + } else { + echo ''; + } } -?> \ No newline at end of file